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

ROS + Gazebo Recording and playing back robot trajectory

asked 2014-10-29 10:59:24 -0500

kubiack gravatar image

updated 2014-11-04 07:10:53 -0500

I have a setup with a differential robot rolling in a simple environment. The robot is controlled by a ROS node and is simulated in Gazebo.

I am looking for a way to record the actual trajectory of the robot in the simulator and to be able to replay the same trajectory later.

I have already tried multiple solutions, but none of them worked well:

  1. rosbag record /tf -O tf.bag => rosbag play tf.bag : Doesn't work at all : robot don't moves
  2. rosbag record /gazebo/model_states -O gms.bag => rosbag play gms.bag /gazebo/model_states:=/gazebo/set_model_state : Error message concerning the data type
  3. rosbag record /cmd_vel -O vel.bag => rosbag play vel.bag

The last option is the best for now, but it records the commands sent to the robot controller, not the actual pose. So in the playback, the trajectory can be slightly different which is a problem for my application.

Is there any other way to record and replay a reference trajectory ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-04 07:03:03 -0500

kubiack gravatar image

updated 2014-11-04 07:08:48 -0500

I am progressing on this problem.

I created a second model of the same robot, with <static>true</static> and I can move it using :

rostopic pub -r 10 gazebo/set_model_state  gazebo_msgs/ModelState '{model_name: MyRobot, pose: { position: { x: 0, y: 0, z: 2 }, orientation: {x: 0, y: 0.491983115673, z: 0, w: 0.870604813099 } }, twist: { linear: { x: 0, y: 0, z: 0 }, angular: { x: 0, y: 0, z: 0}  }, reference_frame: world }'

I then just need to be able to convert the recorded positions (with rosbag record /gazebo/model_states ) to gazebo/set_model_state messages.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-10-29 10:59:24 -0500

Seen: 2,766 times

Last updated: Nov 04 '14