Calculating rotations of wheels for turning

Discussion specific to projects ideas and support.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

Most if not all Lego wheels (at least the technic ones) have their diameter and width molded into the rubber tire's sidewall. The measurement unit is mm.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
jwiger
Posts: 125
Joined: 24 May 2011, 20:41
Location: Where ever the military sends me (currently Central Texas)
Contact:

Re: Calculating rotations of wheels for turning

Post by jwiger »

Can you provide the numbers printed on the side of the tires? I can provide an average with a small tolerance. Unfortunately due to the molding and packaging process at LEGO factories the tires have small irregularities (slightly out of round or slight differences in the size of the molds). Over a small distance you won't see much error. The farther you travel the greater error you will accumulate using just the tires for odometry.

Give me the numbers, I'll give you radius/diameter/circumference
JimmyJam
"The more you know, the more you know, the less you know."
droidzz
Posts: 11
Joined: 23 Dec 2012, 22:36

Re: Calculating rotations of wheels for turning

Post by droidzz »

I tried the formula suggestions in this thread and wanted to post my results because the results are confusing

first some values
- distance_between_wheels = 12.7cm
- wheel_diameter = 3.21
- degrees_to_turn = 90

So if I apply the formula suggested..
(((distance_between_wheels * 2) * 3.14) / (360 / degrees_to_turn)) / (wheel_diameter * 3.14)

we get..
(((12.7 * 2) * 3.14) / (360 / 90)) / (3.21 * 3.14)
which result in 1.9781931464

I am using this value in the default NXT software as a move block so I set the rotation to 1.978 but this does not rotate 90 degrees, i would guess that it does around 130 degrees

Anyone know what I might be doing wrong?
bmancan
Posts: 9
Joined: 14 Oct 2012, 01:52

Re: Calculating rotations of wheels for turning

Post by bmancan »

droidzz wrote:I tried the formula suggestions in this thread and wanted to post my results because the results are confusing

Anyone know what I might be doing wrong?
Which wheels are you using that have a diameter of 3.21cm?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

Off the top of my head, here is the formula I just came up with, so it's untested:

Code: Select all

distance_between_wheels = 12.7; // Distance between wheels
wheel_diameter = 3.21;          // The wheel size
degrees_to_turn = 90;           // How many degrees to turn the robot
Ticks_per_rotation = 360;       // How many encoder advances there are per rotation

Ticks_per_rotation * (distance_between_wheels * PI) / (360 / degrees_to_turn) / (wheel_diameter * PI)
A couple things I noticed. First, you multiplied the distance between wheels by two and PI. You don't want to multiply by two (unless the distance_between_wheels measurement is actually radius instead of diameter).

I added Ticks_per_rotation so that it converts into the number of encoder ticks the motors need to turn (which happens to be in 1 degree increments). If you are using whole rotations (with floating point), then the "Ticks_per_rotation * " should be removed.

I think the rest of the error comes in through improper precision.

If you're using NXC, use the constant PI instead of 3.14, but if NXT-G, then type out at least 6 digits of PI (to a certain extent, the more the better).

The wheels you use should have as little surface touching the ground as possible. That is to say, use the wheels included with the RCX (81.6 x 15 ?), NXT 1.0, or NXT 9797 set instead of the ones included in the NXT 2.0 set.

The measurement between the wheels should be at the point that it turns (in theory, this would be the center of the touching area).

One last thing, the measurements on the Lego Technic tire sidewalls are only aprox. so you should determine the actual size.

A side note: The units of measure don't really matter, as long as they are the same (for distance_between_wheels and wheel_diameter). You could use inch, cm, L, etc.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
droidzz
Posts: 11
Joined: 23 Dec 2012, 22:36

Re: Calculating rotations of wheels for turning

Post by droidzz »

bmancan wrote:
droidzz wrote:I tried the formula suggestions in this thread and wanted to post my results because the results are confusing

Anyone know what I might be doing wrong?
Which wheels are you using that have a diameter of 3.21cm?

I have the NXT 2.0 set and built the initial quick start robot, the one that looks like this http://cache.lego.com/upload/contentTem ... 23B66E.jpg
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

A tracked robot is one of the hardest to make precise movements based on dead reckoning. There is a very large amount of "tire" that is touching the ground, and it makes it very difficult to turn with any kind of accuracy.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
droidzz
Posts: 11
Joined: 23 Dec 2012, 22:36

Re: Calculating rotations of wheels for turning

Post by droidzz »

mattallen37 wrote:A tracked robot is one of the hardest to make precise movements based on dead reckoning. There is a very large amount of "tire" that is touching the ground, and it makes it very difficult to turn with any kind of accuracy.
Would you recommend moving on to one of the other robots in the kit instead?
droidzz
Posts: 11
Joined: 23 Dec 2012, 22:36

Re: Calculating rotations of wheels for turning

Post by droidzz »

I tried with the adjusted formula and still it doesn't really match with any sort of reliability.
Only just starting with Robotics and finding it very frustrating.
So far I have only being able to move the robot forwards and backwards which is very limiting.

You mentioned about tracked robots being hard to make precise movements, what type of robot allows this?
Also are these limitation due to the default Lego software? I am going to switch to LeJOS soon anyway as I am a Java developer anyway and was wondering if this will allow more accurate control than the Lego software?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Calculating rotations of wheels for turning

Post by mattallen37 »

A robot with two driving wheels and one caster would be ideal for accurate turns.

From what I remember, NXT-G doesn't have great motor control, so I assume leJOS has better motor control built in. I mostly use NXC with the NXTs, and it supports really good motor control (at least for anything I need).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests