Ask Your Question

quaternions orientation representation

asked 2011-04-19 15:09:24 -0500

updated 2011-11-04 04:17:39 -0500

joq gravatar image

Hi, I'm trying to understand the geometry_msgs/Pose.msg Is there a way to non-ambiguously explain how quaternions are used to represent orientation? I understand how quaternions represent rotation. You take some initial orientation, and then rotate it around vector (x,y,z) by acos(w). However, when I'm trying to imagine orientation I can't understand what is the initial orientation. Is it set to some constant in ROS?

More specifically, if I have a orientation (w, x,y,z) in 3d to what orientation this corresponds in 2d?

Thanks in advance!

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2011-04-20 21:54:16 -0500

updated 2011-04-20 21:58:48 -0500

In order to make sense of a geometry_msgs/Pose message, you need to know the reference coordinate system and the intrinsic coordinate system. These should be clear from the context in which the Pose message is used. To specify the reference coordinate system, many ROS packages use the frame_id field of geometry_msgs/PoseStamped instead of using Pose directly.

For example, robot_pose_ekf publishes the robot pose as PoseStamped, where the reference coordinate system (the fixed world frame, if you like) is odom_combined, and the intrinsic coordinate system of the robot is base_link. As the document linked to by @dornhege points out, the default axis orientation for a body (e.g., a robot) is "x forward, y left, z up". So the interpretation of this particular Pose message is "rotate base_link by the rotation given in the quaternion, relative to the odom_combined frame".

More specifically, if I have a orientation (w, x,y,z) in 3d to what orientation this corresponds in 2d?

Generally: none. :-)

Ok, just being cheeky. In cases where a body can only move in 2D (like all the 2D navigation stuff), the rotation axis should be the z axis, since z is "up" (see above). Using the naming conventions from your link, that means that (n_x, n_y, n_z) = (0, 0, 1), so (x, y, z, w) = (0, 0, sin(theta/2), cos(theta/2)).

edit flag offensive delete link more


Thanks, Martin, I was unsure about the reference coordinate system when I wrote my question, but couldn't quite explain it.
Dimitar Simeonov gravatar image Dimitar Simeonov  ( 2011-04-21 09:29:11 -0500 )edit
There's another question/answer at with summaries of Quaternions.
tfoote gravatar image tfoote  ( 2011-06-14 11:03:36 -0500 )edit

Hello Martin, I have a node that gives goal.target_pose.pose.position.x and y and z and also goal.target_pose.pose.orientation.x and y and z and w. I cannot interpret these orientation values, for example, what does Orientation(0,000, 0,000, -0,260, 0,965) mean? Should these values be between 0 and 1? It would be very kind if u could help me with that!

Yami gravatar image Yami  ( 2013-09-04 02:52:01 -0500 )edit

@Yami: Please see the links from @tfoote's answer for an introduction to quaternions:

Martin Günther gravatar image Martin Günther  ( 2013-09-04 02:57:31 -0500 )edit

Thanks a world!

Yami gravatar image Yami  ( 2013-09-04 03:08:08 -0500 )edit

answered 2011-04-19 21:44:40 -0500

dornhege gravatar image

These should be the conventions used in ROS: Coordinate Systems

edit flag offensive delete link more

answered 2011-04-19 15:28:30 -0500

I found a pretty accessible explanation at:

It is a rotation of the center of gravity coordinate system.

Now I need to find what is that for PR2.

edit flag offensive delete link more


Link not accessible anymore.

searchrescue gravatar image searchrescue  ( 2016-06-24 11:17:32 -0500 )edit
ras_cal gravatar image ras_cal  ( 2016-11-03 09:27:39 -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



Asked: 2011-04-19 15:09:24 -0500

Seen: 34,316 times

Last updated: Apr 20 '11