# Programming an odometer (a way to determine a robot's position)? (Elisa-3)

Hello all,

I need to code an odometer (a way to determine the position of a robot) from scratch. I am using an Elisa-3 robot (information about it can be found HERE).

The specs of the robot state that a speed value of 10 (on a scale of 0-127) equates to an actual speed of 50mm/s. While this is inaccurate (the actual speed is somewhat less and seems to vary based on the input value, but I'll leave that aside for now), I have tried using these values with the mathematical formulae listed HERE (a simpler version of the same can be found HERE), but to no avail (the problem being that the robot thinks it's rotated 360 degrees immediately and tries to stop, even if I program it to wait after it moves for the first time).

I have since tried a simpler code, making the robot move forward and back at one second intervals while adding its +ve and -ve velocities to a counter, yet the robot never reaches "0" (i.e. it moves forward and then back to its starting position); it just goes forward and back continuously.

I have looked at the inbuilt functions of the Elisa-3 library, but they are useless. The "computeAngle" function is supposed to the robot's orientation and position, yet neither it nor the initAccelerometer function work. (In fact, computeAngle computes its angle in the z axis instead.)

Which brings me back to my question: is there a better way to code an odometer from scratch? Also, are functions that set the speed of a robot universal (i.e. could I use a different library's "setSpeed" function with the Elisa-3)?

P.S. The wheels of the robot aren't identical: I need to set the speed of the right wheel to 9/10ths the speed of the left for it to move in a straight line. While this is an easy adjustment to make (or outright ignore) when it comes to calculations, I felt it was worth mentioning nevertheless.

An odometer tracks distance traveled. It does not care about angles or direction or speed.
Count the number of turns of the wheels.
Calculate the distance traveled for each turn.
Keep an accumulation of that distance.

You are confusing me with the discussion of different wheels. I can only assume that the wheels are the same, but that the output of the motors for a given throttle setting are different. This has no bearing on distance traveled unless you are attempting to use an assumed speed to do your distance calculations. This is called dead reckoning and usually leads to unhappiness in robot designers like yourself. It is terrible for navigation and bad for odometer calculations. An encoder on your drive system will tell you the real number of turns. Note that this is also poor input for navigation but it is much better for odometer calculations than throttle settings.

vinceherman:
An odometer tracks distance traveled. It does not care about angles or direction or speed.
Count the number of turns of the wheels.
Calculate the distance traveled for each turn.
Keep an accumulation of that distance.

You are confusing me with the discussion of different wheels. I can only assume that the wheels are the same, but that the output of the motors for a given throttle setting are different. This has no bearing on distance traveled unless you are attempting to use an assumed speed to do your distance calculations. This is called dead reckoning and usually leads to unhappiness in robot designers like yourself. It is terrible for navigation and bad for odometer calculations. An encoder on your drive system will tell you the real number of turns. Note that this is also poor input for navigation but it is much better for odometer calculations than throttle settings.

Thank you. How can I determine if a robot has returned to a certain location then?

Do not double post.

eecs124:
Thank you. How can I determine if a robot has returned to a certain location then?

What are you using to determine your position?
Setting the throttle at a certain value for a certain time is a very bad way to track position.
Counting revolutions of the wheels is a bad way to track position.

You had hinted that you were interested in position in your original post, but your primary subject was an odometer. What is it that you are actually trying to do? What is your task? What is your goal? In what environment?

Counting revolutions of the wheels is a bad way to track position.

The method is indeed error prone, due to wheel slippage, but is the one that most people use. It is the ONLY cheap method of tracking position.

It is the ONLY cheap method of tracking position.

And, it is worth exactly what is paid for it.