What is the most efficient way to record pose, velocity and acceleration of my robot during the simulation?

asked 2020-02-11 04:07:16 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

So first, I am not aware of any feature already implemented in Gazebo that would do this. If you know of anything, please let me know.

In the past, whenever I needed to record the pose for some debugging I would just launch a ROS node that would subscribe to /gazebo/get_model_state or /gazebo/link_states and similar topics and with some frequency write those data into a txt file somewhere on my disc.

This can only sample a new pose with certain frequency (around 3 times the time step or higher). I'm thinking writing a Gazebo-ROS model plugin could enable sampling the data more frequently and it just seems more neat to me. I could access the robot's pose, velocity and acceleration by Gazebo API.

I could choose to publish the data on a ROS topic and then read and save the data from the ROS topic when I want to, but maybe better would be to record the data in the plugin itself. I can imagine there could be some drawbacks, like writing to a file very frequently is time consuming (how does logging processes do that?). So maybe plugin could just remember all the data and write them down only after the simulation is closed. Though I don't know if that is even possible. I close my simulations by pressing CTRL+C in the terminal. Wouldn't that just make the plugin stop and the data could never be retrieved?

What do you think is the best approach? What are its pros and cons?

edit retag flag offensive close merge delete


Is it possible, that you could paint a real life picture where do you need this data at a frequency greater than what ros is doing now. I personally think the current rate of data publish rate is good enough for all purposes.

shiraz_baig gravatar imageshiraz_baig ( 2020-03-07 00:50:21 -0500 )edit