Home | Tutorials | Wiki | Issues
Ask Your Question
0

Setting a joint in the right pose

asked 2013-07-25 07:38:13 -0500

Chris gravatar image

updated 2013-07-26 04:27:16 -0500

Hi,


Updated description:

I would like to perform a rotation around a local Y-axis that points to another direction than the global Y-axis.

Global coordinate system is: span( (1,0,0); (0,1,0); (0,0,1) )

Local coordinate system shall be: span( (1/sqrt(2), -1/sqrt(2),0); (1/sqrt(2), 1/sqrt(2),0) ; (0,0,1) )

Now the desired rotation has to be around the new Y-axis (1/sqrt(2), 1/sqrt(2),0). As you can see below, when I add a rotation to the model pose, the sensor pose or the pose of the link, no rotation to my new coordinate system is added. Do I have to use the joint of type "revolute2" to add the "static" rotation around the Z-axis before performing the rotation around the "new / local" Y-axis? Is there another possibility?


Old description: I have to do a very simple operation: a child link (sensor) of a model shall do half of a rotation (SetJointPosition, 0 to -pi) around the parent link (box). I have a model for this with a parent and a child link. Everything is all right as long as the joints pose has no rotation in it.

<model name="box">
  <pose>0 0 0.5 0 0 0</pose>
  <static>false</static>
  <link name="link">
    <collision name="collision">...</collision>
    <visual name="collision">
      <geometry>
        <box>
          <size>1 1 1</size>
        </box>
      </geometry>
    </visual>
  </link>
  <link name="link2">
   <pose>0.0 0.0 0.51 0.0 0.0 0.0</pose>
    <sensor name="raysensor" type="ray">
      <always_on>true</always_on>
      <visualize>true</visualize>
      <ray>...</ray>
    </sensor>
  </link>
  <joint name="my_joint" type="revolute">
    <pose>0 0 0 0 0 0.785</pose>
    <parent>link</parent>
    <child>link2</child>
    <axis>
      <xyz>0 1 0</xyz>
    </axis>
  </joint>
</model>

Picture of the joint

The translation works. If I set an offset in x, y or z-coordinate the joint is shifted to the requested point. A rotation isn't done.

I tried to fix this with turning the whole model, but even this failed: Turning the whole model

What can I do to bring my joint in the right position?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-31 04:36:25 -0500

Chris gravatar image

I found out, that it is just a problem with the visualisation of the joint... the rotation is done correctly, although the joint axes are wrong...

The added rotation to the model turns the model and the sensor (and the joint, but it is not shown) I expected that the red x-axis points in the rotated direction...

image description

Here you can see the correct rotation -pi/2 (although the joint axis are not in the right positions)

image description

I want to add, that it is not enough to just rotate the sensor link!

image description image description

I think this might be connected with this bug?!

edit flag offensive delete link more
0

answered 2013-07-25 13:46:32 -0500

nkoenig gravatar image

Rotate the pose of the sensor link, not the pose of the joint.

<model name="box">
  <pose>0 0 0.5 0 0 0</pose>
  <static>false</static>
  <link name="link">
    <collision name="collision">...</collision>
    <visual name="collision">
      <geometry>
        <box>
          <size>1 1 1</size>
        </box>
      </geometry>
    </visual>
  </link>
  <link name="link2">
   <pose>0.0 0.0 0.51 0.0 0.0 0.785</pose>
    <sensor name="raysensor" type="ray">
      <always_on>true</always_on>
      <visualize>true</visualize>
      <ray>...</ray>
    </sensor>
  </link>
  <joint name="my_joint" type="revolute">
    <parent>link</parent>
    <child>link2</child>
    <axis>
      <xyz>0 1 0</xyz>
    </axis>
  </joint>
</model>
edit flag offensive delete link more

Comments

Thank you for your answer, but this is not what I wanted. This is the [result](http://tinypic.com/r/2mx08qe/5). Is it possible to get a "new" independent coordinate system? The new axes have to be translated and rotated so that the "new" y-axis points in another direction than the "original" y-axis. I want to rotate the sensor around the "new" y-axis.

Chris gravatar imageChris ( 2013-07-25 14:43:58 -0500 )edit

I'm not sure I completely understand your problem. Do you want a laser sensor that is located on top a box that rotates around the about the global Z-axis (assuming the box is sitting on the ground plane)?

nkoenig gravatar imagenkoenig ( 2013-07-25 14:49:42 -0500 )edit

I want to have a second coordinate system. For example the original coordinate system is span( (1,0,0); (0,1,0); (0,0,1) ) and then the second system is span( (1/sqrt(2), -1/sqrt(2),0); (1/sqrt(2), 1/sqrt(2),0) ; (0,0,1) ). Then I want to rotate around the axis (1/sqrt(2), - 1/sqrt(2), 0). Is this possible?

Chris gravatar imageChris ( 2013-07-25 15:01:13 -0500 )edit

I think you just need to set the axis of rotation to be about the local X axis: <xyz>1 0 0</xyz>

nkoenig gravatar imagenkoenig ( 2013-07-25 18:02:46 -0500 )edit

Yes, I tried to do this, but my local axes point in the same direction as the global axes... (like you see in the pictures)

Chris gravatar imageChris ( 2013-07-25 23:59:53 -0500 )edit

hii, i have attached a velodyne sensor on the top of polarisrangerev but I am not able to rotate it . can you plz suggest how can i rotate it along z axis. thanks!

anonymous gravatar imageanonymous ( 2014-09-09 06:28:32 -0500 )edit

anonymous, can you please post a new question with your problem?

nkoenig gravatar imagenkoenig ( 2014-09-09 16:12:24 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-25 07:38:13 -0500

Seen: 2,746 times

Last updated: Jul 31 '13