Society of Robots - Robot Forum

Software => Software => Topic started by: Crunchy Theory on January 19, 2011, 10:55:52 AM

Title: Differential drive - circular path around a point
Post by: Crunchy Theory on January 19, 2011, 10:55:52 AM
I'm trying to get my differential drive robot to drive in a circle around a point, the radius of which should be variable. The geometry is pretty simple, but I'm kind of stumped on finding a formula to control the wheel speeds to achieve this (assuming the servos are accurately centered and identical - this can be tweaked later). Has anyone done this before?

Here's a summary of the algorithm:

Start at point A
Rotate (in place) to a random direction
Move forward x inches to point B
Move in a circular path (with radius x) around point A back to point B
Title: Re: Differential drive - circular path around a point
Post by: waltr on January 19, 2011, 12:40:23 PM
Does your Bot have encoders on the wheels to measure distance traveled and to use as speed control feedback?

For the geometry you described, once the Bot gets to point 'B' it must turn 90° so it can start moving on a tangent to the circle.

Hints:
 At a distance 'A-B' from point 'A', what distance is each wheel is from point 'A'?
The two wheel will be at different distances from point 'A', right?
What is the circumference that each wheel will travel?
How fast will the Bot move around the circle?
Now, how fast does each wheel need to turn for the bot to go around the circle?

This sounds like a School assignment so if you answer the above questions you will solve the problem.
Title: Re: Differential drive - circular path around a point
Post by: TrickyNekro on January 19, 2011, 02:41:57 PM
You don't have to have encoders to do that... Encoders help with accuracy... but are considered "extras"...

Imagine that your bot is doing a cycle... The center of mass... is on the cycle, whereas the servo wheels are a bit off...
This means that the inner wheel is moving on a smaller radius cycle while the opposite is in effect for the other wheel...

What you want is that circular speed is maintained while the radius is different...

ω = r*u, where ω is the radial speed of your vehicle, r is the radius of the cycle that the each wheel travel on and u is the speed of the wheel...

So we what that ω is maintained so let's say:

ω1 = ω2 = ω3
ω1 = R1*u1
ω2 = R2*u2
ω3 = R*u

where u1 is the speed of the inner wheel if considered a matter point
u2 is the speed of the outer wheel if considered a matter point
u is the speed of the center of mass of the robot
R1 is the radius the inner wheel travels on
R2 is the radius the outer wheel travels on
R is the radius of the cycle on which the center of mass (center of differential drive) of the robot travels on

So let's say.... ω1 = ω2 => R1*u1 = R2*u2 => u1 = (R2/R1)*u2 => u1 = a*u2 where a = (R2/R1)...
So you have the the proportion of the speeds that wheels should have...

The robot travels on a circle that has a R radius... So if R1 < R2 you will have...

R = R1 + (R1 - R2)/2 = (3R1 - R2)/2

But you also have that R2 = R1 + d, where d is the wheels distance so....

R = R1 + d/2 and R = R2 - d/2 =>
R1 = R - d/2 and R2 = R + d/2

So you finally can have the proportion of the wheels speed only with the radius of the cycle you want your robot to ride...

u1 = ((R - d/2)/(R + d/2))*u2 and that's true cause ((R - d/2)/(R + d/2)) < 1 and u1 < u2....


So that's it.... that how you should calculate servos speed on radius of the cycle your robot rides...
Keep in mind that all calculations are done on the same units.. R is in m/inch, u = m/s or inch/2 and so on...
It's important in calculations that you consider units!!!!!!

Since you are using wheels and servos you may don't need to calculate exact values... u1 and u2 can be pulses
and the parenthesis can be the proportion of this pulses...

That's all for now...

Best Regards, Lefteris
Greece
Title: Re: Differential drive - circular path around a point
Post by: Crunchy Theory on January 19, 2011, 04:04:47 PM
Thanks a bunch, guys. I will try these hints when I get home  :)

Actually not a school project, just another hobby-bot. I built the robot with the intention of using a rangefinder as a primitive method of scanning an object and being able to recognize it later. I envisioned that after stumbling upon an object, it would drive in a circle around it while taking distance measurements from every angle, then comparing it to some saved data from a previously scanned object (I was looking into storing this data in the EEPROM, but honestly don't know if that's feasible yet).
Title: Re: Differential drive - circular path around a point
Post by: TrickyNekro on January 19, 2011, 06:38:51 PM
For that job... I would get a IR range finder.... Ultrasonic lacks precision... just saying in advance ;-)

Best of luck, Lefteris

Greece