Ask Your Question

get odometry from car-like robot

asked 2016-05-29 11:14:39 -0500

VEGETA gravatar image


I want to make a car-like robot with steering wheels in front as you well know. the problem is modeling it and using it with navigation stack successfully!

My solution is: use arduino! yes get commands from ros (which ones exactly?) then send them via rosserial to arduino and then process them and move the robot... then output odometry values.

how to output such odometry values back to ros? is it gonna be easy? or should i consider differential 4 wheel drive (point me where)?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-22 09:06:44 -0500

updated 2016-07-06 08:19:10 -0500

You can use whatever steering method you like. The navigation stack outputs velocity commands for the robot base to follow. You will need to make a node to use the inverse kinematic equations to determine how to control the robot. To get odom you do the reverse; get the encoder counts from the wheels and use the kinematic equations to determine the velocities of the robot. This is easiest with a differential drive, but with some work you should be able to get it working with Ackerman steering.


1 - You need to populate nav_msgs/Odometry messages. The link shows what information is required. Basically, the message requires a time stamp, frame id, the velocities (linear and rotational) of the robot, and the position (x, y, z) of the robot relative to its start pose.

2 - A tutorial on how to generate the odometry messages can be found on the wiki. The tutorial puts in hard coded velocity values simulating the robot going in a circle. To calculate the actual values you need to use the kinematic equations of your robot. You will need some way of knowing what angles your wheels are at and at what speed they are rotating. You then sub these values into the kinematic equations to determine the the robot's overall velocities. Summing these velocities over a series of time steps provides the robot's pose. Here is a link to an odom node I wrote a while ago for an omnidirectional robot.

3 - If you use the navigation stack with the move_base node, move_base will publish geometry_msgs/Twist messages, which contain linear and rotational velocities for the robot. Your arduino node will have to subscribe to that topic (default is cmd_vel), use the inverse kinematic equations to determine what speeds and angles the wheels need to be at to achieve the commands sent by move_base. The Arduino then sends this to the motors and actuators.

edit flag offensive delete link more


good info, thanks.

can you give me an example of this kinematic equation? say for differential drive since it is easy.

and how to make an inverse like you explained.


VEGETA gravatar image VEGETA  ( 2016-06-22 09:55:29 -0500 )edit

Here is a pdf on differential drive kinematics

Icehawk101 gravatar image Icehawk101  ( 2016-06-22 10:30:03 -0500 )edit

so what are the required values to be sent to ROS master as odometry?

VEGETA gravatar image VEGETA  ( 2016-07-05 11:20:14 -0500 )edit

I'm not entirely sure what you are asking

Icehawk101 gravatar image Icehawk101  ( 2016-07-05 11:57:49 -0500 )edit

well, i am a noob myself so i will try to answer. 1- what are the final values to be sent from the robot to ROS as odometry? like x or y... 2- how to get them or calculate them for diff-drive or car-like robot? 3- how to send/receive movement commands and convert them to readable values?


VEGETA gravatar image VEGETA  ( 2016-07-05 19:05:24 -0500 )edit

One note: The navigation stack output (move_base) will output commands appropriate for differential drive or holonomic wheeled robots. It will output some commands that include only rotation. Ackerman steering robot can't rotate in place. Do you know how to change move_base to mitigate the issue?

billy gravatar image billy  ( 2016-07-06 11:51:44 -0500 )edit

I've only worked with omnidirectional robots so I am unsure. Their may be path planner plugins made using Ackermann steering, I don't know

Icehawk101 gravatar image Icehawk101  ( 2016-07-06 12:10:11 -0500 )edit

OK, I will use a 4-wheeled robot with diff drive... how to write the driver for it? assuming pi3 or pir3+arduino as control boards? what will change here since you used it before?

VEGETA gravatar image VEGETA  ( 2016-07-19 17:45:25 -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

1 follower


Asked: 2016-05-29 11:14:39 -0500

Seen: 2,182 times

Last updated: Jul 06 '16