0
$\begingroup$

Rosanswers logo

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 ?


Originally posted by kubiack on ROS Answers with karma: 36 on 2014-10-29

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by kubiack with karma: 36 on 2014-11-04

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.