I need help to determine dead reckoning parameters ((x,y) coordinates and orientation) for my mobile robot, actually I found the code (written for Arduino)shown in the attachment and I don't know if it is good for this task , but in the code I faced some commands which are not clear to me :
The first command is clear which means the number of ticks or pulses for one centimeter but what about the second one, what is it? How could I determine the ticks for one degree for my robot?
Hint: Rover 5 with two motor and encoders, the encoder gives 1000 state changes per 3 wheel rotations.
But, floating point math on an arduino will be comparatively SLOW.
Also, how close to your target do you really need to be? If you are doing this for yourself, I can’t imagine extreme precision is required. If you are doing this for a class/competition, a skid steer platform is not the optimum choice.
The basic equations are all very basic high school math.
Assuming that:
d is the diameter of the wheel in cm.
p is the number of pulses per full wheel rotation.
You can calculate other things:
c (the circumference of the wheel) = pi * d
Pd (the number of pulses for one degree of rotation) = p / 360
Dn (the distance traveled for a number of pulses, n) = n * (c / p) <---- I’m not sure this is right. I’ll have to figure it out later.
I’m writing these off the cuff while getting ready for a short shopping trip, so please forgive any mistakes. This is very basic algebra combined with a very little geometry (knowing that 360 degrees is a circle).
Make sure that you verify p.
Also, most robots slip and it is really difficult to rely purely on odometry. For example, if there are 360 pulses per wheel rotation, the the wheels could be as much as almost two degrees different even without slippage or losing any pulses.
In my opinion odometry is best used with other senses for calculating distance and position. It’s also extremely useful for making sure that the two wheels are going the same speed; two motors from the same factory and same stats will probably not be exactly the same speed.
Actually, I want to implement a mobile robot, its task is to move in specific orientation (given by me in degree). If the robot faces an obstacle in its way, it should avoid that obstacle and then re-correct its current heading angle to the desired angle or desired orientation. Orientation error between -5 to +5 degrees is acceptable to me.
Actually due to low budget, I bought Rover 5 and I don’t know if it is the suitable platform for this task. But I faced a trouble in determining the odoemtery for mobile robot correctly, now I am trying to do that and about using integer math instead of floating point math, I will take these consideration. Actually I will share the code here after complete it.
I am waiting for any advices that could help me in performing this task.
Assuming each motor has the same power, you can get an empirical measure with a distance sensor; measure distance between bot and wall, advance for 4-5 secs, count the state changes, measure the new distance from the wall. Distance_travelled/state_changes gives you how much cm you get per encoder state change. If it doesn’t go forward straight, give slightly less pwm to the stronger motor.