One thing that can be confusing for those first starting out with an NXT is the term "degrees". The reason why is because we use this one word for more than one meaning. We use this word to specify how much something turns or the turning angle. And since there are several things turning, it can be confusing as to which one you are talking about. The robot turns, the motor's shaft or axle turns, and the wheels turn about their axle. For robots that have their wheels connected directly to the motor's axle, the number of wheel rotations will equal the rotations of the motor. If there are gears between the wheel and the motor, you must take into account the gear ratio (which I will leave to another discussion another time).
The most common way of using the word degrees would be in talking about how much you want your robot to turn. Often we want our robot to make a 90 degree turn to the right or left. So when entering values in the MOVE block's configuration panel, people often enter 90 for the motor duration, thinking it will make their robot turn 90 degrees. Unfortuneately, this is not the case.
In the MOVE block's configuration panel, there is a place to specify duration. Duration refers to how long you want the motors to run. You have 4 choices (unlimited, rotations, degrees, seconds). Unlimited means that you are not specifying the duration in this MOVE block. This might be because you are planning to stop the motors somewhere else in the program. Another choice is seconds. Seconds means you will have the motors run for a specified time. We only use seconds for special circumstances, as it isn't really good for going a specified distance since the battery level affects the speed of the motors. Lower battery level means the motors go slower, and therefore don't go as far in a specified time. Rotations and degrees in the duration part of the configuration panel are refering to the number of revolutions of the motor's shaft or axle. Sometimes (often) we don't want to work with whole rotations, we want to use a fraction of a rotation and so we use degrees. (360 degrees = 1 rotation) Remember that if we attach our wheels directly to the motor, motor degrees will equal wheel degrees.
For each rotation of the wheel, the distance the robot travels is equal to the wheel circumference. I like to think of the diameter of the wheel as being the stride of the robot. This is because the diameter is closely related to the circumference of the wheel. (Circumference = Pi * D) For one of the LEGO wheels, the circumference is about 7 inches, so for every motor rotation (which in this case is the same as a wheel rotation) the robot will go forward 7 inches. From this we can calculate that for every 51.4 motor degrees the robot will travel 1 inch. You can use this as a multiplier to calculate the motor degrees to go however many inches you desire. If I want my robot to go 10 inches, I multiply 10 times 51.4 to get 514 degrees. I will enter this number for the motor degrees in the duration area of the MOVE block's configuration panel.
You don't really have to measure your wheel's diameter if you don't want to. Plug in a value for degrees into the configuration panel, and then measure how far your robot travels. Divide the degrees you used by the distance the robot traveled and you have your multiplier. Cool, huh? :)
Turns are kind of the same. There are several ways you can determine the number of motor degrees you need to enter to get your robot to turn a desired angle. Measure the distance between your two wheels (measure from the center of each tread). This will give you the width of your robot. For a swing turn, one wheel stays stopped and the other wheel travels a distance until the robot has turned 90 degrees. That distance is W * Pi/2, where W is the width you measured. Multiply this by the multiplier above and you have motor degrees. You might have to tweak this value a bit, but it should get you close. (The reason we have to tweak it is because of error... our measurements aren't exact, etc). For a point turn, both wheels travel the same distance, just opposite directions. The distance each wheel needs to turn for a 90 degree turn is equal to W*Pi/4. I'm assuming that everyone knows Pi is 3.14159. Once you get the distance, multiply it by the multiplier we got before (51.4). Your answer is the motor degrees you put into NXTG. Did you notice that the distance for a point turn is 1/2 that of the swing turn? So if you know it for one you can calculate the other.
Too much math? You can always use trial and error to find the value. If the turn is too big, reduce the duration. Too small? Just increase the duration. If you know the degrees for a 90 turn then you can double it for a 180, etc.
If you change your robot's design, you may have to calculate new values. This is because the values are determined by the geometry (or dimensions) of your robot.
I hope this has made sense and has been helpful!
No comments:
Post a Comment
Please keep comments clean! Thanks.
Note: due to comment moderation, it may take a while for a comment to display.