nxtprograms.com

Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Path Measurer
Building: Intermediate
Program: Advanced

Building Instructions


1-6

Start by building a robot vehicle with 2-motor drive, such as the Five Minute Bot (Click the picture for building instructions).

Building Instructions
 


7

Connect the wire from the touch sensor to port 1 on the NXT. 


Path Measurer Programming

Two different programs are provided for the Path Measurer.  These programs can be used on any robot with standard 2-motor drive (one motor drives a left wheel and one motor drives a right wheel), although you may need to modify the programs to account for differences in orientation of the motors (forward vs. backward) or the NXT (which motor port is on the left side).  See the instructions below.

The PathMeasure program provides an easy way to measure path segments with three types of movement: straight forward, and one-wheeled turns to the left and right.  See the instructions below. 

The MoveMeasure is a more complex program that provides eight types of movement, including three types of turns in each direction, and straight forward and backward motions.  See the instructions below.

 

Using the PathMeasure Program

The PathMeasure program allows you to select from three directions for each of the segments in your path: straight forward and one-wheeled turns left and right.  If you want to measure different kinds of turns, such as pivot turns where the wheels turn opposite directions, use the MoveMeasure program instead.  The PathMeasure program can be used as follows:

1. At the beginning of each segment, select the direction using the NXT buttons:
   Left Arrow: Left Turn
   Enter Button: Straight Forward
   Right Arrow: Right Turn
The rotation sensors for the B and C motors will be reset to zero.

2. Press and hold the touch sensor on the remote control to make the robot move in the direction indicated.  You can press the sensor more than once, and you can also adjust the wheel positions by hand at the end of the segment if needed.  The degrees travelled by each motor are displayed on the screen.

3. To begin a new segment, press the NXT button for the new direction as in step 1, and the rotation sensors will be reset back to zero to begin the next measurement.

Modifying the PathMeasure Program to Match your Robot

As written, the PathMeasure program assumes that the motors should be run in the "forward" direction to make the robot move forward, and that motor B is on the left of the robot and motor C is on the right (like the settings on the configuration panel for the Move block).  If your robot needs different settings, you will need to modify the program. 

To modify the PathMeasure program, find the 3-tabbed Switch in the lower sequence of the program pictured to the right.  Click on the three tabs to show the Motor and Move blocks used for the three motion directions (left, straight, right) and change them as necessary.

 


Using the MoveMeasure Program

The MoveMeasure program is a more complex alternative to the PathMeasure program that allows you to select from eight directions for each of the segments in your path.  The MoveMeasure program is used as follows:

Left Arrow Button: Select Previous Motion Type
Right Arrow Button: Select Next Motion Type
Enter Button: Reset Rotation Sensors to Zero
Press and Hold Touch Sensor: Drive in the Selected Direction

As with the PathMeasure program, you can press the touch sensor more than once to complete a motion if desired, and you can also adjust the wheel positions by hand at the end of the motion if desired.

 
Using the arrow buttons to select the motion type will rotate continuously through a cycle of eight different directions (starting at 4 = Straight Forward) as follows:
 
  Motion Motor B Motor C
1 Left Reverse Turn Backward Stop
2 Left Pivot Turn Backward Forward
3 Left one-wheeled Turn Stop Forward
4 Straight Forward Forward Forward
5 Right one-wheeled Turn Forward Stop
6 Right Pivot Turn Forward Backward
7 Right Reverse Turn Stop Backward
8 Straight Reverse Backward Backward
 

Two icons on the top of the screen display the selected motion type by indicating which direction the motor on that side of the robot will move (forward, backward, or stop).

Rotation measurements in degrees are displayed for the left and right motors.

Modifying the MoveMeasure Program to Match your Robot

As written, the MoveMeasure program assumes that the motors should be run in the "forward" direction to make the robot move forward, and that motor B is on the left of the robot and motor C is on the right (like the settings on the configuration panel for the Move block).  If your robot needs different settings, you will need to modify the MoveMeasure program. 

To modify the MoveMeasure program, find the 8-tabbed Switch in the lower sequence of the program pictured to the right.  Click on the tabs to show the Motor and Move blocks used for the eight motion directions and change them as necessary (see the table of motions above).

 

 

Challenges
  • Use the Path Measurer to map out and measure a path from a starting point to a goal, including two or three turns along the way.  Then use the measurements to write your own autonomous (not remote controlled) program using Move and/or Motor blocks to make the NXT follow that path.  Test your program and adjust the durations if necessary to see how accurately you can get to the goal.  

  • Try using the PathMeasure or MoveMeasure program on a different robot, perhaps one of your own design.  If your robot goes backwards when forward is indicated, or if left and right are reversed, then you will need to modify the programs to suit your robot (see instructions above). 

 

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.