# Compute velocities from wheel-encoders for odometry model

I am working with the navigation of a two wheeled robot, I am looking at the odometry tutorial www.ros.org/wiki/navigation/Tutorials/RobotSetup/Odom, 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 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?

( 2013-07-11 11:28:57 -0600 )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.

( 2013-07-12 07:21:49 -0600 )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. http://rossum.sourceforge.net/papers/DiffSteer/ I hope it was helpful. thanks

( 2014-01-12 14:08:48 -0600 )edit

Sort by » oldest newest most voted

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 base_controller.py file in ros_arduino_bridge : https://github.com/hbrobotics/ros_ard...

more

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.

more