Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use rosbag methods from within a C++ node?

Hello, I'm trying to create a node that will take a starting bagfile with turtlesim velocity data (like for the drawing of a square or something), then publish that data to turtlesim (like the command line usage of 'rosbag play') and rerecord the played data over the original bagfile. I want to put that process inside a loop, and then play and record over and over and over again to see if the final product bagfile is significantly different than than the original one (I remember reading that rosbag play does not always play the file exactly the same way, so I'm trying to get these changes to add up over time).

However, the problem I'm having is that I have no idea how to run rosbag methods from within a node (I'm using C++). For a previous beginning project, I was using these tutorials: h t t p : / / w w w . c s e . s c . e d u / ~ j o k a n e / t e a c h i n g / 5 7 4 / n o t e s - r o s . p d f (especially sections 4 through 9) to help me with the syntax to make a node that published velocity to turtlesim such that the turtle would draw a specific shape. However, now that I look at section 10 (bagfiles), I am stuck because it doesn't give me any information on how to use bagfiles from within a node--only in the command line.

Does anyone know how to do this? Is it even possible? Help would be much appreciated.

click to hide/show revision 2
No.2 Revision

How to use rosbag methods from within a C++ node?

Hello, I'm trying to create a node that will take a starting bagfile with turtlesim velocity data (like for the drawing of a square or something), then publish that data to turtlesim (like the command line usage of 'rosbag play') and rerecord the played data over the original bagfile. I want to put that process inside a loop, and then play and record over and over and over again to see if the final product bagfile is significantly different than than the original one (I remember reading that rosbag play does not always play the file exactly the same way, so I'm trying to get these changes to add up over time).

However, the problem I'm having is that I have no idea how to run rosbag methods from within a node (I'm using C++). For a previous beginning project, I was using these tutorials: h t t p : / / w w w . c s e . s c . e d u / ~ j o k a n e / t e a c h i n g / 5 7 4 / n o t e s - r o s . p d f http://www.cse.sc.edu/~jokane/teaching/574/notes-ros.pdf (especially sections 4 through 9) to help me with the syntax to make a node that published velocity to turtlesim such that the turtle would draw a specific shape. However, now that I look at section 10 (bagfiles), I am stuck because it doesn't give me any information on how to use bagfiles from within a node--only in the command line.

Does anyone know how to do this? Is it even possible? Help would be much appreciated.