ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

postprocessing bag with transform node

asked 2019-01-29 06:09:54 -0600

ftbmynameis gravatar image


I have recorded a bag file from a robot (not simulated!) that contains raw sensor data that is in this state not usable by other nodes I require. I also have a node that would on the robot perform preprocessing on this raw sensor data. Now I'd also like to be able to use this same node and perform postprocessing on my recorded bagfile (containing raw sensor data).

My current approach is to have a launch file that runs a rosbag play node, another rosbag record node and also starts the transform node. But I don't know how to tell rosbag record node within the launch file that the rosbag play node has finished.

Also another related question: the recorded bag I have is quite large. Right now I do the playback using /use_sim_time = true. Would it be possible in this case to not use the sim_time and therefore fast forward the post processing process?

Thanks for any insights!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-29 06:36:56 -0600

Doing this using a launch file as you are is fairly straightforward.

If you set the required attribute to true (see here) for the rosbag node which is playing the data then when it finishes and closes, roslaunch will automatically shutdown all the other nodes, including the rosbag node which is writing the new file.

If your nodes are capable of processing the raw data much faster than they are played back in the bag then you scan speed up the playback using the -r <ratio> argument as described here.

Hope this helps.

edit flag offensive delete link more


Thanks for the reply. That already helps a lot. I will try to do it like that and see if it works. Is there an "easy" way to check how fast a node can process something, i.e. how do I find out the highest <ratio> argument? I am fairly new to ROS so these simple things are sometimes quite hard!

ftbmynameis gravatar image ftbmynameis  ( 2019-01-29 06:41:23 -0600 )edit

If you have a 1 to 1 ratio of raw to processed messages then you can run the conversion once then use rosbag info <file name> to check the number of messages in each bag. Try increasing the rate argument until it starts dropping messages. Not scientific but it should work.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-29 06:46:01 -0600 )edit

Question Tools

1 follower


Asked: 2019-01-29 06:09:54 -0600

Seen: 271 times

Last updated: Jan 29 '19