How to import bag file with std_msgs/String
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rocco Galati
am 8 Dez. 2021
Beantwortet: Cam Salzberger
am 8 Dez. 2021
I have a bag file that contains a topic defined as:
/pavioliner/enc 342 msgs : std_msgs/String
I try to load it with:
bag = rosbag(filename);
topic1 = select(bag,'Topic',"/pavioliner/enc");
topic_data1 = readMessages(topic1);
and topic_data1 is:
topic_data1 =
342×1 cell array
>> topic_data1{1,1}.Data
ans =
'1638960492.408644536,0,0,0,-31946,8921'
I need to load into two different arrays only coloumns 5 and 6, but I can't understand how to parse the topic_data1 output.
Can you help me, please?
0 Kommentare
Akzeptierte Antwort
Cam Salzberger
am 8 Dez. 2021
It looks like this topic is passing numeric data as a string, for some reason. My recommendation would be to preallocate a couple of data arrays, loop through all the messages, split out the parts you needs, turn them into numbers, and then put them in the arrays.
-Cam
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu ROS Log Files and Transformations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!