Indeed you're right.  There is a mistake in which variable is used for initial orientation.  The fix is checked in r30363, I'll make a release tomorrow.

Thanks,
John

On Mon, Jun 21, 2010 at 3:59 AM, Leonardo Scandolo <lscandolo@gmail.com> wrote:
Sorry, I seem to have messed things up a little, actually the error does not present itself with set_model_state, but with spawn_gazebo_model. The behavior I'm getting is this:

I call gazebo/spawn_gazebo_model with orientation x: 0 y: 0 z: 0.70709 w: 0.707123 (obtained from tf::createQuaternionMsgFromYaw(3.1415 / 2.0) to make sure)

This spawns the object in gazebo, but with the wrong orientation, since afterwards I get

$rosservice call gazebo/get_model_state '{model_name: person, relative_entity_name: map}'
pose: 
  position: 
    x: -0.00155193534221
    y: 0.000118788809867
    z: 0.0239993194685
  orientation: 
    x: -1.93747979438e-07
    y: -4.43560139729e-07
    z: 0.0141537562013
    w: 0.999899804592
twist: 
  linear: 
    x: -0.000347819470335
    y: 0.000233947168454
    z: -0.000113238493213
  angular: 
    x: -0.000709853426088
    y: -0.00107237440534
    z: -3.73239927285e-05

This is the orientation for a (PI / 2) degrees yaw rotation, which is what shows on the gazebo gui : rpy: 0 0 1.57.

Hope this helps to clarify things a little bit.

Leonardo


On Fri, Jun 18, 2010 at 9:02 PM, John Hsu <johnhsu@willowgarage.com> wrote:
Hi Leonardo,

I've just tried the following,


  • roslaunch gazebo_worlds  empty_world.launch
  • rosrun gazebo spawn_model -file `rospack find gazebo_worlds`/objects/000.580.67.model -gazebo -model cup -z 2
  • rosservice call gazebo/get_model_state '{model_name: cup}'
    rosservice call gazebo/get_model_state '{model_name: cup}'
    pose:
      position:
        x: 0.0
        y: 0.0
        z: 1.99999995232
      orientation:
        x: 0.0
        y: 0.0
        z: 0.0
        w: 1.0
    twist:
      linear:
        x: 0.0
        y: 0.0
        z: 0.0
      angular:
        x: 0.0
        y: 0.0
        z: 0.0
    success: True
    status_message: GetModelState: got properties
  • rosservice call /gazebo/set_model_state '{model_state: { model_name: cup, pose: { position: { x: 0, y: 0 ,z: 1 }, orientation: {x: 0, y: 0.7071, z: 0, w: 0.7071} }, reference_frame: world } }'
    success: True 
    status_message: SetModelState: set model state done
  •  rosservice call gazebo/get_model_state '{model_name: cup}'
    pose:
      position:
        x: 7.45058056917e-10
        y: 0.0
        z: 1.0
      orientation:
        x: 0.0
        y: 0.70710682869
        z: 0.0
        w: 0.70710682869
    twist:
      linear:
        x: 0.0
        y: 0.0
        z: 0.0
      angular:
        x: 0.0
        y: 0.0
        z: 0.0
    success: True
    status_message: GetModelState: got properties
the model state seems to be as expected, not sure if I have the right steps you are referring to in order to recreate the error?
thanks,
John


On Fri, Jun 18, 2010 at 6:10 AM, Leonardo Scandolo <lscandolo@gmail.com> wrote:
Hello, I've been trying out the new CTurtle Gazebo API and I've seem to stumbled into a bug, but since I'm not really sure about it maybe you can clarify the behavior I'm seeing before creating a ticket.

The problem is this: when using the gazebo/set_model_state service, apparently the orientation quaternion appears to be translated to roll pitch and yaw and handed to gazebo, but the problem is that the rpy values handed are in radians and gazebo seems to work with degrees.
Even if I input the orientation quaternion obtained from gazebo/get_model_state back in through gazebo/set_model_state, it will produce the same error (the quat obtained from get_model_state seems to be correct). For example if the rpy in the gazebo gui for a model is '90 0 0', I will get orientation quat '0.707114 0 0 0.7071' from get_model_state, send it back in through set_model_state and it will come up as rpy '0.78 0 0' in gazebo, which is the correct rpy, only that now it is in radians. Am I missing something here ?

Leonardo Scandolo


_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users



_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users



_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users