Ask Your Question

Equivalent turtlesim/Pose and geometry_msgs/Pose

asked 2019-06-28 08:55:16 -0600

Shanika gravatar image

updated 2019-06-28 09:12:28 -0600


I have a question about the Pose message. There art two different Pose :

  • geometry_msgs/Pose.msg
    Point position
    Quaternion orientation

  • turtlesim/Pose.msg
    float32 x
    float32 y
    float32 theta
    float32 linear_velocity
    float32 angular_velocity

I want to know what is the equivalent of turtlesim pose.theta in the geometry pose :

  • pose.orientation.z ?
  • pose.orientation.w ?
  • yaw from euler_from_quaternion(pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w) ?

Thank you in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-28 09:04:55 -0600

updated 2019-07-02 05:53:28 -0600

There is no 1 to 1 mapping between turtlesim pose.theta and any of the values in geometry_msgs/Pose. The turtlesim pose is a 2D pose so it expresses orientation as a single angle in radians, but geometry_msgs/Pose is a 3D pose so it expresses rotation as a Quaternion (4D unit vector).

If you need to create a geometry_msgs/Pose from a turtlesim/Pose message then you can use the tf2::Quaternion.setRPY( Roll, Pitch, Yaw ) method and set Roll and Pitch to zero. This will create the quaternion and do all the complicated maths for you.

Here is some background on rotation quaternions if you want to learn about the theory.

Hope this helps.


If it is safe to assume that your robot will always be upright on a level surface then it will be safe to use the euler_from_quaternion method to calculate the roll, pitch and yaw of the pose and then to take the yaw value and use that. It should be noted that the behaviour of this approach will be strange and incorrect if the pose messages are not level!

edit flag offensive delete link more


I am trying to write a Go to Goal code for my robot based on turtlesim Go to Goal tutorial. Howerver, how I suscribe to my robot's pose is different than for the turtlesim one. I suscribed to my odom topic and use the pose of my odom message.

Shanika gravatar image Shanika  ( 2019-06-28 09:43:08 -0600 )edit

To clarify you need to convert a geometry_msgs/Pose into a turtlesim/Pose message?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-06-28 09:51:26 -0600 )edit

Yes. In the tutorial, they use the turtlesim/Pose.theta but I don't know to what it corresponds in the geometry_msgs/Pose.

Shanika gravatar image Shanika  ( 2019-07-01 02:04:52 -0600 )edit

I've updated me answer for you now.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-07-02 05:53:42 -0600 )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: 2019-06-28 08:55:16 -0600

Seen: 619 times

Last updated: Jul 02 '19