How to go around in a circle?

I have the mBot robot and I'm trying to get it to go to the other side of a cylindral obstacle.

Something like this:

What I know:

• Radius of the cylinder - r
• Robot's distance from the cylinder
• Wheel thickness - 1.5 cm
• Distance between the middle of each wheel - 11.5 cm

How would I achieve the above path?

The distance between the left and right wheel of the robot is 6 inches.

So the left wheel should travel at a distance of 2(pi)(radius+6)

And the right wheel should travel at a distance of 2(pi) (radius-6)

The problem with my robot is that you can't tell it to go 20cm to the right, nor can you tell it to turn 90 degrees to the right.

All you can do is set each motor's speed 0-255, so there's not way to put it in the formula disatance = time x speed.

I assume I have to set each motor's speed to a different value so they would go in a circle of radius x and then just exit at the half of the circle (like shown in the picture)

The distance travelled is directly proportional to speed $s = v*t$, so if you want to achieve specific distance ratio, the ratio of wheel speeds should be the same: $${{s_{left}} \over {s_{right}}} = {{v_{left}*t} \over {v_{right}}*t}$$ Be warned though, that without encoders, you won't be able to accurately set speed (wheel speed with the same PWM for left and right motor may be different), so the robot will follow given path only approximately.

1. The robot will drive towards the cylinder.
2. The robot should make 90 degree turn.
3. The robot should drive, with one wheel going slower as the other. (But it will be an constant).

Between point 2 & 3 in the image, the displacement of the robot will be 90 degrees turned in 2*R*Pi/4 distance.

The time of both wheels need to be the same. So, if you want to do this path in 10 seconds:

One wheel will be set at (2*(Radius-6)Pi/4) inch/s. And the other wheel at (2(Radius+6)*Pi/4) inch/s.

But as Mactro mentions, the ratio should be the same.

(2 * (100 - 6) * Pi) / 4 = 147.654854719 (2 * (100 + 6) * Pi) / 4 = 166.50441064

So, 148/167 ratio for a 100 inch radius.

Your assesment of the situation seems correct. You have no robot body or wheel distance measurement that you can easily use. You need two pieces of the distance,velocity,time equation to do something that can work.

You best option is to ask the mBot developers to add some time functions to the arduino library (or perhaps this is available somewhere else, or something you can hack). You can then command a velocity, measure the time elapsed, and guess the distance you have moved. You can also change the velocity based on the elapsed time to approximate the shape you want.

The results will not be perfect but you will be able to use and learn the basic equations for differential drive robots. This will serve you if you continue working with robots and get a more capable one with wheel encoders or other position sensing.