Ask Your Question

Frame of Twist information for robot_localization

asked 2021-11-11 06:17:13 -0600

JadTaw gravatar image

updated 2021-11-11 07:33:12 -0600


If i am inputting a nav_msgs/Odometry from the wheel odometry into the robot_localization package, the nav_msgs/Odometry has pose information, and twist information.

I am only using the twist information in the robot_localization package.

The header.frame_id is odom, and the child_frame_id is base_footprint.

Since this is a planar robot, the twist field contains linear.x linear.y angular.z components.

My question is: In which frame are these three values expressed, in the child_frame_id, or in the header.frame_id.

For example, assuming the twist is in the frame of the child_frame_id, then if the robot has arbitrary orientation, and if the robot goes straight, vx will be non-zero, and all others zero. However, if the twist is in the frame of the header.frame_id (odom), then the orientation matters. For example, if the robot is aligned with the negative x-axis, and the robot goes straight, the vx will be negative. If the twist is expressed in the base_footprint frame, the vx will be positive.

So, robot_localization, which frame of reference does it expect the twist field to be expressed in?

edit retag flag offensive close merge delete


Twist != Odom. Which of the two is it?

gvdhoorn gravatar image gvdhoorn  ( 2021-11-11 07:18:09 -0600 )edit

I will edit my question to clarify

JadTaw gravatar image JadTaw  ( 2021-11-11 07:28:48 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2021-11-11 20:41:41 -0600

Mike Scheutzow gravatar image

For the Odometry message, the twist object velocities are the values relative to the child frame.

edit flag offensive delete link more

answered 2021-11-11 07:18:00 -0600

The Twist message type consists of a Linear Vector3 and Angular Vector3.

The Linear and Angular Vector3 represent a vector in free space:

# It is only meant to represent a direction. Therefore, it does not
# make sense to apply a translation to it (e.g., when applying a 
# generic rigid transformation to a Vector3, tf2 will only apply the
# rotation). If you want your data to be translatable too, use the
# geometry_msgs/Point message instead.


edit flag offensive delete link more


I clarified my question

JadTaw gravatar image JadTaw  ( 2021-11-11 07:33:33 -0600 )edit

Hi @JadTaw - thank you for the clarification and sorry if I am directly quoting, but I prefer to use the official documentation to show the explanation so it's not my interpretation:

**nav_msgs/Odometry** - All pose data (position and orientation) is transformed from the message header’s frame_id into the coordinate frame specified by the world_frame parameter (typically map or odom). In the message itself, this specifically refers to everything contained within the pose property. All twist data (linear and angular velocity) is transformed from the child_frame_id of the message into the coordinate frame specified by the base_link_frame parameter (typically base_link).
osilva gravatar image osilva  ( 2021-11-11 10:52:30 -0600 )edit

@osilva I think the immediately above quote from the documentation is somewhere between wrong and puzzling.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-11 20:52:51 -0600 )edit

I don’t disagree with that Mike. I re-read it a few times and tried to find another documentation to explain. I don’t feel I am experienced enough to come on with my own explanation either

osilva gravatar image osilva  ( 2021-11-12 03:18:24 -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: 2021-11-11 06:17:13 -0600

Seen: 25 times

Last updated: Nov 11 '21