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

Is it possible to create a subscriber to a bag?

asked 2022-04-08 10:57:54 -0500

rosss gravatar image

I have a bag with messages published on two different topics and I need to take this data, compute them and then publish to another topic. How can i subscribe to a bag without knowing the internal code of it (to create for example the callbacks of the subscribers)?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2022-04-08 15:56:58 -0500

Run the Rosbag normally and grab the topic you want as it is published again.

Rostopic echo /cmd_vel >> save_this.txt

(Above is just an example of how to do it, after starting the playing of Rosbag.)

edit flag offensive delete link more

Comments

Ok, so you are suggesting to extract directly the data. So then instead of a subscriber to the bag, I would need a publisher which has to read the file just extracted from the bag, and compute every line with some math I have to apply, right? If I am correct, could you tell me a way on how to use data from a text file in a publisher node? Thank you very much in advance

rosss gravatar image rosss  ( 2022-04-09 05:30:16 -0500 )edit

If it is a rosbag you can use rosbag play your_recorder_bag.baglike here: http://wiki.ros.org/rosbag/Commandline to use it as "a publisher" with messages you can subscribe and convert like you want in other node

ljaniec gravatar image ljaniec  ( 2022-04-09 17:50:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-04-08 10:57:54 -0500

Seen: 81 times

Last updated: Apr 08 '22