Unable to set link twist correctly using service /gazebo/set_link_state

asked 2016-06-28 05:52:41 -0500

guilhem gravatar image

Hi to all,

I'm simulating a robot with 12 revolute joints using ROS and Gazebo. I need to set joint positions and velocities to some initial value. It seems that there is no direct way to do this with a Gazebo topic or service, so I decided to work directly with the service /gazebo/set_link_state.

The service works fine when I set the link position, but I can't get it to work when setting the twist. For example, I type the following command while Gazebo is paused:

rosservice call /gazebo/set_link_state '{link_state: {link_name: l_hip_frontal_link, pose: {position: {x: 1, y: 1, z: 1}, orientation: {x: 0, y: 0, z: 0, w: 1}}, twist: {linear: {x: 0.01, y: 0.02, z: 0.03}, angular: {x: 0.04, y: 0.05, z: 0.06}}, reference_frame: world}}'

The result of

rosservice call /gazebo/get_link_state '{link_name: l_hip_frontal_link, reference_frame: world}'

is

link_state: 
  link_name: l_hip_frontal_link
  pose: 
    position: 
      x: 1.0
      y: 1.0
      z: 1.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
  twist: 
    linear: 
      x: 0.0139619
      y: 0.01826412
      z: 0.0288053
    angular: 
      x: 0.04
      y: 0.05
      z: 0.04
  reference_frame: world

The position is good, but the twist is not the required one.

I thought the physical constraints enforced by the joints could cause this issue. But this is not the case because the position is set correctly. Moreover, the problem remains the same when I replace all revolute joints by floating joints in my URDF file.

Do you know how I can set the desired twists ? I'm running Gazebo 2.2.3 with ROS Indigo, on Ubuntu 14.04. Thanks.

edit retag flag offensive close merge delete