Ask Your Question
0

clarification: publishing nav_msgs/Odometry Twist

asked 2018-12-14 20:39:48 -0500

kasliwalr gravatar image

Hi All,

I checked all questions regarding nav_msgs/Odometry but could not find an answer. I have an IMU onboard my turtlebot and I want to publish the odometry from it. I am following the ROS odometry tutorial.

I understand the part regarding publishing of transforms; in my case these would be

  • base_link_frame ---> imu_frame once
  • odom_frame ---> base_link_frame continuously.

But I have a doubt about publishing the odometry information. The reference code in the tutorial publishes twist like so

odom.child_frame_id = "base_link"
odom.twist.twist.linear.x = vx;
odom.twist.twist.linear.y = vy;
odom.twist.twist.angular.z = vth;

with this comment

This populates the message with odometry data and sends it out over the wire. We'll set the child_frame_id of the message to be the "base_link" frame since that's the coordinate frame we're sending our velocity information in.

The velocity used is that of the robot (i.e. base_link) w.r.t. odom, yet it mentions setting child_frame_id to be that of base_link. As I understand, the velocity w.r.t base_link should be zero.

thanks, Rishabh

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-12-15 06:40:11 -0500

stevemartin gravatar image

It is correct, this tutorial creates the odom frame, which is needed if you are not using the plugins for the simulation and want to publish odom on a real robot. That code above publishes the Odometry values and setting the child_frame to be the base_link would actually move your URDF described robot in RViz based on the Odometry values.

edit flag offensive delete link more

Comments

I don't doubt the tutorial's correctness but what does this mean? "We'll set the child_frame_id of the message to be the "base_link" frame since that's the coordinate frame we're sending our velocity information in. How can velocity of robot with respect to base_link be anything other than zero

kasliwalr gravatar imagekasliwalr ( 2018-12-15 15:54:25 -0500 )edit

But keep in mind that Odometry is a child frame of Map. So as Map is static, Odometry gets the position w.r.t. to the map and it should change. Now when it comes to the velocity it is the same thing, it counts wrt to the map and the code above has nothing to do with the tf, it only gives value

stevemartin gravatar imagestevemartin ( 2018-12-16 15:50:50 -0500 )edit

to the odometry. You are confusing with TF (Transform)

stevemartin gravatar imagestevemartin ( 2018-12-16 15:51:11 -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

2 followers

Stats

Asked: 2018-12-14 20:39:48 -0500

Seen: 331 times

Last updated: Dec 15 '18