Coordinate frames in set_model_state topic with gazebo_ros
I am using ROS Indigo with gazebo 4.0.1 as installed by the ros-indigo-gazebo4-prerelease-* packages. I am trying to use the set_model_state
topic to move a Pioneer 2DX model around. The model contains the following frames:
- chassis
- right_wheel
- left_wheel
- right_wheel_hinge
- left_wheel_hinge
First, I issue the following command:
rostopic pub /gazebo/set_model_state gazebo_msgs/ModelState "model_name: 'pioneer2dx'
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0
twist:
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.1
reference_frame: 'chassis'"
The robot correctly begins to turn counter-clockwise. After it turns some nontrivial amount, I then issue a second command to stop it. I then issue this command:
rostopic pub /gazebo/set_model_state gazebo_msgs/ModelState "model_name: 'pioneer2dx'
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0
twist:
linear:
x: 0.4
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
reference_frame: 'chassis'"
My expectation is that the robot will move forward in the direction that it is currently facing. This is why I issued the command in the chassis
frame. However, the robot instead starts moving forward along the X-axis in the world coordinate frame.
I have verified this with a second robot model (my own), and assumed I did something wrong with my model until the same issue appeared with the P2DX. Is this working as intended, or is it a bug? I can easily convert the desired drive command to the "correct" reference frame, but it seems as though the robot ought to be able to accept commands to drive in its body coordinate frame.