Go Down

Topic: How to get Odometery (ticks) from an Arduino Robot (Read 337 times) previous topic - next topic

akoubaa

 Hello

I am teaching a robotics course and I am using the Arduino Robot.
I would like to make the students implement a position estimation using odometry only (dead reckoning). However, I could not find any native function in the Arduino Robot Library that allows the read data from encoders and get the rotation information of the wheels.
There is the method Robot.writeMotors (left, right), but there is no method to read the number of ticks of the motors while it is rotating. Do you have any idea on how to get the odometery from encoders? Are there any library for doing so?

My second question is we can set the speed of the motor to a value between -255 and 255, which is the level of current input to the motors. How is it possible to map these values to a speed in meter/second?

Thank you
Anis

cr0sh

Do you have any idea on how to get the odometery from encoders? Are there any library for doing so?
I don't know if there is a library, and I don't know much or anything about the Arduino robot (I know it exists, and I've looked at the schematic once) - but if it were me, I would look at the schematic, and see how the encoders relay the data back to the system (what pins, etc) - then write the code (likely an ISR) to count the ticks as the robot moves around. If you can find a library to do it - then great. Otherwise, you might need to write your own. Not too big of a deal - but if you manage it, be sure to put it up on github and/or the playground so that others can use it in the future.

My second question is we can set the speed of the motor to a value between -255 and 255, which is the level of current input to the motors. How is it possible to map these values to a speed in meter/second?
You could try a "brute force" method:

1. Make two dark/black ink marks on white paper - a couple of lines or such.

2. Hook up or add a line sensor to the robot (I can't remember if one is included standard?).

3. Write code to drive the robot forward at some speed (maybe 32, 64, 128, 255)

4. Sense the first mark - start a timer.

5. Sense a second mark - stop the timer.

6. Compute the "map" for each value (speed vs time).

7. If the graph is linear, then easy-peasy to make a conversion routine.

8. If the graph isn't linear - it'll be more tough, you'll need some kind of interpolation/curve fitting - or make a lookup table for every value.

9. Note that whatever method you use, it will only be valid for the surface you are running on, and no other.

In order to work with different surfaces (ie - carpet vs smooth floor), you need some way to track the speed/distance the robot travels vs. time. There are a myriad of ways to do it - but one of the easier ways might be to use an optical mouse sensor (for instance).
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

akoubaa

Thank you for the reply and pointers.
Regarding finding the real speed, yes, I though about something similar, in a slightly different way, that is fixing a timer in the robot to run for a specific time and them we measure the run distance.
I had also the idea of trying different speed and grounds.

Thanks anyway for the pointers
A

akoubaa

Just to add that I contacted David Cuartielles, one the developer of Arduino Robot tutorials, and I was informed that there are no encoders in the robot, and only a compass is used to compensate for orientation.
This means, we cannot estimate the run distance using encoder with the Arduino Robot.
It may be needed to use time*speed to estimate the distance.

Chagrin

Keep one wheel stationary, drive the other wheel, and perform a 180 degree turn (using the magnetometer). Then reverse the wheel power and perform another 180 degree turn. Perfect odometry using the distance between the wheels as your measurement ;)

Go Up