Ask Your Question
1

Gazebo object pose and getAsEuler

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

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 -0500

dornhege gravatar image

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

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 imagethek3nger ( 2011-10-26 00:10:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 736 times

Last updated: Oct 25 '11