ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Gazebo object pose and getAsEuler

asked 2011-10-25 04:09:10 -0600

Hello,

I'm working on a quad-rotor simulation in 3D space. I use the GetPose() method to get the current object pose in the space. And now there is the problem.

The GetPose() method return a Pose3D object. This object contains

  • A Vector3 for the body position.
  • A Quatern for the body orientation.

Now I should transform this quaternion in a Roll-Pitch-Yaw triple through the GetAsEuler() method of Quatern. Unfortunately this value is non-continue because it jump from pi to -pi and this cause trouble to my controller!

Exist any way to obtain a continue transformation from quaternion to euler triple?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-10-25 05:25:53 -0600

dornhege gravatar image

updated 2011-10-25 05:33:14 -0600

It depends what you want. The reason for the uncontinuity is that the angles are normalized. If you would use them incrementally values might grow arbitrarily, so they are not that nice to read (and which with huge values might lead to loss of precision). One solution would be to "renormalize" to the last angle, i.e.:

  • Remember the last angle
  • Get current (normalized) angle
  • add/substract 2*pi until (angle - last_angle) is smallest

The better solution would probably be to handle that nicely in the controller, but that depends on its functionality (e.g. if you calculate an angle difference in the controller normalize that difference). The angles packages provides: shortest_angular_distance for this.

edit flag offensive delete link more

Comments

Thank you. :)
thek3nger gravatar image thek3nger  ( 2011-10-26 00:10:21 -0600 )edit

Question Tools

Stats

Asked: 2011-10-25 04:09:10 -0600

Seen: 1,414 times

Last updated: Oct 25 '11