nxtprograms.com

Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Multi-Bot Programs
Programs Index
 

(C-D) Turning

The programs in the section show different ways to make Multi-Bot turn.  Working through the examples in order will help you learn the different options for motor control.

Basic Turning

(Downloadable programs are available only on the CD "LEGO MINDSTORMS NXT 2.0 by Example").

Program Description and Observations Attachments
C1-MoveCurve   Easy
This program uses the Steering option of the Move block to make the robot drive in a gradual arc turn.

When Steering is used on a Move block, the Power and Duration apply to the outside motor (the one travelling the longer distance), and the inside motor will go a lesser speed and distance that is calculated based on the amount of steering.

(none required)
C2-MoveTurn   Easy
This program uses uses the Steering option of the Move block with the Steering slider at the second to last position, which will produce a turn with the inside wheel approximately stopped. 

Although similar to turning with only one motor (see below), these turns with the Steering option are usually significantly less accurate.

(none required)
C3-MovePivot   Easy
This program uses uses the Steering option of the Move block with the Steering slider at the last position (tightest turn).  This will produce a turn where both wheels move with the Power and Duration specified, but the inside motor moves in the opposite direction, producing a very tight "pivot" turn.

Although this is the easiest way to create a tight "pivot" turn, it is usually less accurate than a pivot turn created by controlling the two motors separately (see the Turning - Advanced) section below.

(none required)
C4-1WheelMove   Easy
This program uses the the Move block with only one motor selected to make the robot turn by moving one wheel while keeping the other stopped. 

Although similar to the turn produced by the C2-MoveTurn program (Move block with Steering), these turns are typically much more accurate.

(none required)
C5-1WheelMotor   Easy
This program uses the Motor block to make the robot turn by moving one wheel while keeping the other stopped. 

Although similar to the C4-1WheelMove program (Move block with one motor selected), you will notice that the Motor block maintains the selected power throughout the turn rather than slowing down at the end.  This may result in a more accurate turn for heavier robots.

(none required)
C6-LetterN   Easy
This program uses five Move blocks to make Multi-Bot move in an "N" shaped path in a simple but reasonably accurate way (using only motor for the turns). (none required)
C7-PathNTest   Easy
This program is an extension of the C6-LetterN program that retraces the N-shaped path in reverse afterwards, so that the robot should end up approximately where it started.

You can use this program to test how accurately a robot design turns and drives.  It is possible to design a robot that is significantly more accurate than Multi-Bot.  Give it a try!

(none required)

 

Advanced Turning

(Downloadable programs are available only on the CD "LEGO MINDSTORMS NXT 2.0 by Example").

Program Description and Observations Attachments
D1-Pivot   Easy
This program shows one simple way to do a pivot turn (wheels turning opposite directions) using two Motor blocks instead of the Move block with the Steering slider all the way to the side.

Unfortunately, similar to the B2-Motors program above which goes straight, the Brake option will not work if selected on the first motor (both motors use Coast in this example), so the end of the turn will not be accurate.

(none required)
D2-PivotWait1   Easy
This program fixes the braking problem with the D1-Pivot program by measuring rotations separately with a Rotation Sensor and then using a Stop to brake both motors.

However, a remaining problem is that the rotations on motor C are not being measured, so it possible that motor C may travel fewer or more than the desired rotations.

(none required)
D3-PivotWait2   Advanced
This program is a more complete variation on the D2-PivotWait1 technique that stops only after both motors have completed the full rotations required.

Now both motors are guaranteed to travel the required rotations.  However, it is now possible that either motor may travel more than the desired rotations.

(none required)
D4-PivotSeq   Intermediate
This program shows a more accurate way to do a pivot turn using two Motor blocks, by using two sequence beams.

Compared to the D2-PivotWait1 program, this technique measures rotations independently on both motors, so both motors are told to stop when they finish.

However, one subtle problem remains.  Because the program will stop when the main sequence finishes, if motor C gets hung up for some reason (try stopping or slowing it by hand), it may not finish the requested rotations.

(none required)
D5-PivotSeq2   Advanced
This program solves the subtle problem with the D4-PivotSeq program by using a block wired between the two sequences to force the main sequence to wait for the second sequence to finish before continuing. 

Now the program will sound the tone and then end (or continue if there was another motion after the turn) only after both motors have completed their rotations.

(none required)

 

Using My Blocks to Turn

(Downloadable programs are available only on the CD "LEGO MINDSTORMS NXT 2.0 by Example").

Program Description and Observations Attachments
D6-PivotBlocks   Expert
This program does a left and right pivot turn using two My Blocks named PivotLeft and PivotRight. These My Blocks make it easy to reproduce accurate pivot turns using parallel Motor blocks (instead of the Move block) internal to the My Blocks.

Note that the fix for the two Motor block pivot turn included in the D5-PivotSeq2 program is not necessary in these My Blocks, because a My Block with multiple sequences will wait for all of the sequences to complete before finishing and returning to the main program.

(none required)
D7-PivotAngleBlocks   Expert
This program does a left and right pivot turn using two more advanced My Blocks named LeftPivotAngle and RightPivotAngle, which are extensions of the simple PivotLeft and PivotRight My Blocks.

The LeftPivotAngle and RightPivotAngle My Blocks allow the program to specify the amount of robot heading angle desired in the turn, rather than the amount of motor rotation.  This makes it significantly easier to do, say, a "90 degree turn" by simply specifying 90 degrees of robot heading angle.

(none required)
D8-PathBlocks   Expert
This program is similar to the C6-LetterN program, which drives the robot along an N-shaped path, except that it uses the My Blocks Forward, LeftPivotAngle, and RightPivotAngle, and it is currently configured for a robot with treads.

If the three My Blocks are already written, the main program is easy to create.  Comparing the program to C6-LetterN, note how straight distances in centimeters and turns in robot heading angle make the program even easier to write and understand compared to using motor degrees.   The program can also be easily re-configured for Multi-Bot using wheels vs. treads.

(none required)

 

[Back to Programs Index]

 

Home     Projects     Help     Contacts

 

Copyright 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.