Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am not very good at mathematics and as such I hope I've come to the right place to ask this question.

Currently, I am programming an iRobot Roomba to make a circle. All is well, except that I need it to stop after a complete circle. The Roomba itself cannot know this, so I am taking a time-based approach.

However, this approach is not working.

What I am doing at the moment is this: Let's say I am letting the Roomba make a circle with a radius of 100mm, and set its speed to 100mm/s. The radius is the distance from the centre of the circle to the centre of the Roomba; the Roomba follows the circumference of the circle.

I had calculated that the time for it to complete one circle was (2*pi*100mm) / 100mm/s, which equates to roughly 628/100 = ~6.3s. However, I find that it easily takes the Roomba 10 seconds to follow the circumference, so this current approach leads to the Roomba stopping before even making a full circle.

Have I made a very stupid mistake in assuming I could just divide the circumference with the speed? I have no clue where to look. I looked all over the internet for a day now, but I haven't been able to find a clue.

I thank you for your time and any pointers in the right direction.

Edit: Two things I should indeed point out. The speed given is defined as the average speed of the two wheels on the Roomba. The speed works out to be correct in straight lines. When I increase the radius, between r = 200mm and r = 300mm there comes a point to where the Roomba makes the circle faster than calculated.

EDIT 2: For those interested, I was able to get it to work thanks to JohnJPershing's hints and Ross Millikan's Mathematical aid. I calculated Vl and Vr with help of his explanation and put them in the Roomba using the Drive Direct (145) opcode. Then, the calculated time (6.3 seconds) came to be true!

share|improve this question
1  
The real problem here is probably that the Roomba only achieves the full speed of 100mm/s when going in a straight line, and moves more slowly when turning. –  Joshua Pepper Mar 27 at 20:40
2  
A Roomba probably isn't a pointlike object, so its various parts move at different speeds when it's turning. How is that speed setting defined? For example if its taken from an outer wheel, then the radius of the circle that outer wheel is following is larger than 100mm. Also is it guaranteed that whatever is used for measuring the speed doesn't skid or anything? –  Jyrki Lahtonen Mar 27 at 20:40
    
Sorry, I should have mentioned that. The speed is defined as the average speed of the two wheels. "The velocity value is specified in millimeters per second and describes the averaged velocity of the two drive wheels: ((Vleft + Vright)/2)." When measuring the speed in a straight line, it is very accurate, however when it makes a circle, the calculations seem to not work out. By the sound of your reactions, circumference/speed isn't completely ridiculous after all, then! –  Joey van Hummel Mar 27 at 20:44

3 Answers 3

up vote 0 down vote accepted

The reason why your calculations aren't working is that the speed of the Roomba lowers when it turns. Not sure how to math it, but when i did Roomba programming, i found a way to tell how much the wheels turn so i could measure how far each had gone, and whether it made a full circle. I know that this is not an answer, but its my experience with this.

share|improve this answer
    
That would seem likely, but that doesn't make sense with larger radii taking shorter than calculated. –  Joey van Hummel Mar 27 at 21:09
    
He calculated 6.3 seconds, and observed 10 seconds, and that is a decrease for a tight turn compared to a straight track speed –  Asimov Mar 27 at 21:11
    
Ah yes, that is true. But I edited my post later to add my other observation that I forgot originally: Any radius larger than about 250mm takes shorter than calculated, meaning the speed would suddenly be increased rather than decreased. This leads me personally to believe I made a mathematical error rather than the Roomba changing its speed. –  Joey van Hummel Mar 27 at 21:13
    
Then I have no clue. I recommend looking to see if there is a way to control the exact amount the wheel turns, and use that with the radius of the wheel to do it. –  Asimov Mar 27 at 21:15
    
I'll be darned, I was wrong. It seems the Roomba behaves unpredictably. Thank you for your help! –  Joey van Hummel Mar 27 at 22:39

When it makes a circle the outter wheel has to be faster than the inner one. But how fast? Depends of the distance between the wheels, which I will say that is 2x, hence, the distance from the center of the Roomba and a given wheel is x.

Now lets take as a reference the circumference discribed by the moviment of Roomba based on its center, with radius r. The circumference described by the inner wheel is inside the former one, has radius r-x and the length is (r-x)*2*pi, and the outter wheel draws the biggest circumference path with radius of r+x and length of (r+x)*2*pi.

Now I will assume (for security purposes) that 100mm/s is the fastest a wheel can go, therefore 100mm/s is the speed of the outter wheel, and the inner one has to go slower.

Looking at the equation of velocity:

distance = velocity times time

Substitute distance with (r+x)*2*pi, and velocity with 100mm/s, you have that:

Time to complete a circle = (r+x)*2*pi / 100 seconds

There is the answer to your question, which may not be totaly correct because my assumptions might be wrong (maybe the outter wheel won't go at 100mm/s, maybe is faster, I can't know).

If you can control the speed of the wheels separately, we may measure the speed of the inner wheel with the same formula:

distance((r-x)*2*pi)) = velocity (?) times times((r+x)*2*pi / 100mm/s)

velocity of the inner wheel = 100(r-x)/(x+r) mm/s

share|improve this answer

If the centerline radius is $r$ and the distance from the center of the Roomba to each wheel is $d$, one wheel will have a radius of $r+d$ and one will have a radius of $r-d$. They will have to travel $2\pi(r+d)$ and $2\pi(r-d)$ to do that. Let's say the left wheel is outside and travels at $v_l$, while the right one travels at $v_r$ If we make a good circle, the time is $\frac {2\pi(r+d)}{v_l}=\frac {2\pi(r-d)}{v_r}$, which shows $v_l=\frac {r+d}{r-d}v_r$. You can't average the speeds and get the speed over the centerline. If you want to compute $v$, the speed of the centerline, you have $v=\frac r{r-d}v_r=\frac r{r+d}v_l$

share|improve this answer
    
Using your help, and with help from the Roomba Datasheet: "From basic geometry, the speeds of the left wheel, the right wheel, and the average speed are: Vl = rθ, Vr = (r+b)θ, V = (Vl + Vr) / 2 r = b(V+V)/(2(Vr-Vl)) you can solve for V and V: Vl = V(1-b/2r) Vr = V(1+b/2r)" b = the distance between the wheels, in my case 230mm I filled these in, and derived that Vr (my outer wheel) = 215mm/s. Then, using your equation, Distance for Right is 2pi(100 + 230/2) = 1350mm. Then, 1350mm / 215mm/s = ~6.3 Seconds, my original findings! –  Joey van Hummel Mar 27 at 22:37
    
Jeez, newlines would be nice. Anyway, it looks like it's the Roomba after all. Thank you so much, for your help, though. I learned a lot and it IS much clearer to me now. –  Joey van Hummel Mar 27 at 22:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.