ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# How to get Twist from rtabmap rgbd_odometry for use with move_base

Hello,

I am using rtabmap rgbd_odometry to get odometry for my robot and now want to make use of move_base to get cmd_vel commands. When I receive the velocity commands though, I'll need to make sure my motor controller follows the command sent by move_base using a control loop which means I need information on the sensed Twist of the robot. But in the odometry message from rgbd_odometry, there is only position data (from what I've gathered, this is so because rtabmap does not require Twist to work).

Is there any option to turn on Twist calculation in rgbd_odometry or should I calculate this myself based on the position data (dx/dt, dy/dt and dtheta/dt)?

Also, doesn't move_base require Twist in the odometry message to properly calculate the cmd_vel ?

edit retag close merge delete

Sort by » oldest newest most voted

Hi,

The twist values were added not so long ago (see this commit). If you build the package from source, you should get the twist values in odometry messages. If you don't want to rebuild the package, you can set the twist values like in the referred commit (using the stamps for dt) with a second node.

Yes, move_base uses twist values, though I think it may still work with null twist values (the rtabmap's navigation example worked with stereo_odometry (same as rgbd_odometry) node and null twist values)

cheers

more

Thanks!

odometry_->previousTransform().getTranslationAndEulerAngles(x,y,z,roll,pitch,yaw);


It looks like that line is getting just the previous position and angle. Shouldn't the velocity calcualtion be based on the change in position and angle?

( 2015-12-26 14:37:55 -0600 )edit

The "previousTransform" is the transformation between the previous pose and the current updated pose (see here).

( 2015-12-27 15:33:32 -0600 )edit

Note that it is the change in robot frame, not odometry frame, so that 'x' varies only with forward/backward motions. However, I'm not sure if the changes should be in odometry frame, but it seems to make more sense in robot frame.

( 2015-12-27 15:35:19 -0600 )edit

The "frame_id" I give rgbd_odometry is the robot's frame so /odom comes out in the robot's frame. I'll be going with a second node to compute the velocity based on the change in position to avoid recompile. Is it OK for me to copy the pose covariance for twist or better to leave them as 0?

( 2015-12-27 18:50:58 -0600 )edit

There is a discussion about the covariance in this post. You may fix the covariance like in the viso2 package.

( 2016-01-04 09:02:08 -0600 )edit