Calculating rotations of wheels for turning

Discussion specific to projects ideas and support.
littletim979
Posts: 20
Joined: 24 Dec 2011, 21:18

Calculating rotations of wheels for turning

Post by littletim979 »

i'm doing a competition and want to make a program to start with (since my team has not met yet) our robot is going to have no sensors for driving (besides the rotation sensors) how do i calculate amount of rotations a wheel needs to go (for example a 90 degree turn) if i have the distance between the 2 wheels and the diameter of the wheels that will be driving. i understand how to do it for going straight but have always had to just guess the first number for turns. the more accurate the first number the easier it is to get it perfect. also i will be using RobotC 3.x with PID turned on.
My Blog: MindstormsPodcast.wordpress.com/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

First I need to say that I have never tried to figure it out before, and haven't tested my theories, but take a look at the following.

For the sake of this example, lets say that the wheels are 5cm dia, and 20cm apart.

You said you already know how to calculate linear travel, using something like 5cm*PI (equals about 15.71cm). You can then divide by 360 (the 1 degree resolution of the encoders) to see that each degree of wheel rotation produces about 0.04363cm of linear travel.

The turning diameter is the distance between the wheels. At 20cm, the durning circle circumfrence would be 20cm*PI, or about 62.83cm.

That means that you need a difference of 62.83cm of travel from the wheels to have the robot turn around once.

To calculate a specific wheel rotation based on 90 degrees of turn, make the difference of rotation between each wheels equal to ((20cm*PI)/(360degrees/90degrees))/(5cm*PI), or 1 rotation (360 degrees).

Again, I haven't tested any of this.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
littletim979
Posts: 20
Joined: 24 Dec 2011, 21:18

Re: Calculating rotations of wheels for turning

Post by littletim979 »

thanks
My Blog: MindstormsPodcast.wordpress.com/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

Actually, I just realized I made a mistake. You need to multiply it by 2. So, turning 180 degrees, you need to run the motors to 4 rotations apart.

If you have the left wheel stopped, and only run the right one, the turning circle diameter will actually be 40cm. It applies to running both motors at the same time, as well.

The equation would actually be (((20cm*2)*PI)/(360degrees/90degrees))/(5cm*PI). Which I think can be shortened to ((20cm*2)/(360degrees/90degrees))/5.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

If the wheel size and distance is constant, you can actually use a constant instead of computing most of that on the NXT. You can do something like 20cm*2/5 as a constant (in this case 8). That represents how many rotations apart the motors need to be to turn the robot around completely. So you can shorten it down to 8/(360degrees/90degrees) which equals 2.

And to shorten it even more, you can use 8/360 as a constant of 0.0222_ and then multiply by the number of degrees you want to turn. The main disadvantage of this is that floating point math isn't always as accurate, and the constant of 0.0222_ is a very small number, which never terminates.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
simonauv
Posts: 13
Joined: 29 Aug 2012, 18:43
Location: Australia

Re: Calculating rotations of wheels for turning

Post by simonauv »

Is the radius of the turn measured from the centre of both the inside and outside wheel?

Another easy way of thinking about this is:

let the degrees = Y, the diametre of the circle traced by the outside wheel = D1, the diametre of the wheel = D2, and the rotation = R

then it can be represented by the following linear (rotations:angle) equation.

R = (D1 x Y) ÷ (360 x D2)

(NB: pi cancels out)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

You mean while cornering? Yes, the radius of turn would be from an imaginary point between the two non-turning wheels (the rear wheels). What does that have to do with this project though?

A mechanical differential (as the name implies) causes both wheels to average the same rotation as the differential spider housing. That means that for n number of rotations of the input shaft, there could be 1 rotation of wheel 1, and 3 rotations of wheel 2, or 2 and 2, or 3 and 1, or 0 and 4 etc. That means that the car will move ahead in linear proportion to the speed of the line from the transmission, regardless of how you steer. The speedo cable is connected somewhere between the transmission output, and the differential input. Thus cornering will not have an effect on the equation.

The only way for cornering to have an effect on the equation, would be if the speedo cable was connected to one of the driving axles (on the output side of the differential).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
simonauv
Posts: 13
Joined: 29 Aug 2012, 18:43
Location: Australia

Re: Calculating rotations of wheels for turning

Post by simonauv »

What does that have to do with this project though?
Just asking where you take your measurement from to work out the radius of the path the outside wheel makes as it pivots around a stationary inside wheel... that's all. I agree this has nothing to do with differentials at all.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

If one wheel is stationary, then you can just measure between the wheels.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
aditya3003
Posts: 1
Joined: 14 Oct 2012, 17:59

Re: Calculating rotations of wheels for turning

Post by aditya3003 »

Can anyone give the exact radius of the wheels- The small tribot one's and the slightly larger one's available in the resource kit.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests