ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Compute velocities from wheel-encoders for odometry model

asked 2013-07-11 08:02:14 -0500

salime gravatar image

updated 2013-07-11 10:01:26 -0500

I am working with the navigation of a two wheeled robot, I am looking at the odometry tutorial, in this part:

//compute odometry in a typical way given the velocities of the robot
double dt = (current_time - last_time).toSec();
double delta_x = (vx * cos(th) - vy * sin(th)) * dt;
double delta_y = (vx * sin(th) + vy * cos(th)) * dt;
double delta_th = vth * dt;

x += delta_x;
y += delta_y;

it says "A real odometry system would, of course, integrate computed velocities instead"

so, if I have the velocity readings from the wheel encoders, how can I compute this velocities for the odometry model?

edit retag flag offensive close merge delete


Can you clearly state the meaning of 'velocity readings from the wheel encoders'? Does it refer to the rpm of each motor or the distance traversed by each wheel per unit time?

Hemu gravatar image Hemu  ( 2013-07-11 11:28:57 -0500 )edit

I have the encoder count per second in each wheel, the wheel radius and the distance between these two wheels. I am wondering how can I get the velocity in meters per second with this information.

salime gravatar image salime  ( 2013-07-12 07:21:49 -0500 )edit

Hello usually computing an odemetry is dependent on the type steering on the robot there are different type of methods for computing velocities from encoder counts first thing I would advice you to do is to read this article and you will then have better starting point. I hope it was helpful. thanks

hamidoudi gravatar image hamidoudi  ( 2014-01-12 14:08:48 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2018-06-28 11:16:55 -0500

Mark Rose gravatar image

In some robots you can't measure velocity directly. Instead, you measure movement (of the motors, for example) and calculate both the new position and velocity from that movement. As an example, the ros_arduino_bridge package does exactly that from the encoder measurements of a differential-drive system.

You can see an example of writing an Odometry message with updated position and velocity based on encoder deltas and publishing the updated transform in lines 146–185 of the file in ros_arduino_bridge :

edit flag offensive delete link more

answered 2017-11-21 09:23:17 -0500

gzah gravatar image

As you stated you have a two-wheeled robot your kinematics looks something like this:

vth = (v1 - v2)/l;
vx = (v1 + v2)/2;
vy = 0;

With v1 and v2 being the respective wheel speeds and the x direction being defined as "forward" and l the distance between the wheels.

To get from the counts/s of the encoder to actual speed in m/s simply multiply it by the circumference of the wheel and divide by the counts of the encoder per wheel-revolution.

edit flag offensive delete link more

Question Tools



Asked: 2013-07-11 08:02:14 -0500

Seen: 3,632 times

Last updated: Jun 28 '18