Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ros_parse_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Houssaini Ziyad
ros_parse_data
Commits
833260e0
Commit
833260e0
authored
1 year ago
by
Houssaini Ziyad
Browse files
Options
Downloads
Patches
Plain Diff
Add new directory containing python parser ros
parent
99f1b35c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_parser_ros/display_topics.py
+1
-1
1 addition, 1 deletion
python_parser_ros/display_topics.py
python_parser_ros/save_topics_format.py
+8
-2
8 additions, 2 deletions
python_parser_ros/save_topics_format.py
with
9 additions
and
3 deletions
python_parser_ros/display_topics.py
+
1
−
1
View file @
833260e0
...
...
@@ -25,7 +25,7 @@ def save_rosbags_topics(file_name : str, directory : str):
content_split
=
content
.
split
(
"
/
"
)[
-
1
]
#Case when you specify the directory containing the rosbags files or read directory the file
b
=
bagreader
(
content
)
df_topics
=
b
.
topic_table
df_topics
.
to_csv
(
os
.
path
.
join
(
directory
,
content_split
[:
-
5
]
+
'
.csv
'
))
...
...
This diff is collapsed.
Click to expand it.
python_parser_ros/save_topics_format.py
+
8
−
2
View file @
833260e0
...
...
@@ -9,6 +9,12 @@ import shutil
def
convert_topics_to_file
(
files
,
topics
,
directory
):
"""
This function allows to extract the data published in the topics choosen in the command line and save all the topics choosen in a new directory
which in this directory there are each new directory containing the data topics save into a csv and matlab format.
"""
if
(
directory
not
in
os
.
listdir
()):
os
.
mkdir
(
directory
)
else
:
...
...
@@ -31,7 +37,7 @@ def convert_topics_to_file(files , topics , directory):
os
.
mkdir
(
os
.
path
.
join
(
directory
,
file_split
))
data_frame
.
to_csv
(
os
.
path
.
join
(
directory
,
file_split
,
file_split
+
'
.csv
'
))
print
(
"
Convert the topic {} to a csv format in the directory {}
"
.
format
(
topic
,
os
.
path
.
join
(
directory
,
file_split
)))
print
(
"
Convert the topic {} to a csv format in the directory {}
.csv
"
.
format
(
topic
,
os
.
path
.
join
(
directory
,
file_split
)))
data_mat
=
data_frame
.
to_dict
(
'
list
'
)
topic_name
=
topic
.
replace
(
'
/
'
,
'
_
'
)
savemat
(
os
.
path
.
join
(
directory
,
file_split
,
file_split
+
'
.mat
'
)
,
data_mat
)
...
...
@@ -40,7 +46,7 @@ def convert_topics_to_file(files , topics , directory):
except
Exception
as
e
:
print
(
'
Unable to read the topic or
o
the
r probles ...
{}
'
.
format
(
e
))
print
(
'
Unable to read the topic or the
file speciefied ...Error :
{}
'
.
format
(
e
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment