Building and Programming M.Pathfinder

 

In this lesson you will build a modified Pathfinder called M.Pathfinder. Then you’ll figure out how to program it to do things by itself.

 

 

 

 

What you will need:

The Robotics Invention™ Kit

A disk to save your work

A copy of the Technical Guide

Building Bin

M. Pathfinder building instructions

 

 

What to do:

Build M. Pathfinder: Follow the directions on the M. Pathfinder Building Instructions handout.

 

Run M.Pathfinder:

  1. Turn on the RCX by pressing the red on-off button.

  2. Press the gray Program button repeatedly, until you reach Program #1. (The number 1 will show on the right side of the display window.)

  3.  Place the RCX on the floor where it has enough room to run, let it run, then catch it and turn it off.

 

How to make M.Pathfinder go and stop by itself

 

 

Text Box: Tech Guide
Tech Guide

 

 

 

 

 

The program stored in the RCX looks like this:

 

 

 

This program has one block. It turns on motors A and C. To turn off the motors, you had to chase it and press the on-off button.

 

Tech Guide

 

 

 

 

 

 

 

 

 

Here is a program that turns on motors A and C and then turns them off.

 

Recreate the program.

Download it to program #5 and run it.

 

What happened?

 

 

 Tech Guide

 

 

 

 

 

 

 

 

 

 

 

 

 

Tech Guide

Wait!! Use the wait command to delay turning off the motors.

 

 

Recreate the program. Download it to program #4 and run it.

 

What happened?

 

© The LEGO Group

           Here’s a shortcut—three blocks in one!

© The LEGO Group

Important note: In both programs the motors are turned off after 3 seconds.

 

Long, Short and Different

 

Look at the programs Long and Short. What do you think each is telling M. Pathfinder to do?

© The LEGO Group

   

Look at the program Different. What do you think it is telling M. Pathfinder to do?

 

 

 

 

 

 

 

 

 

                                                            

Tech Guide 

Text Box: Recreate the programs Short and Different.
Save each program onto your disk.
Download Short to Program #4
Download Different to Program #3
Run them
 

 

Tech Guide

 

Thinking about It

In the programs Long and Short, why do you have to turn on motors A and C after the Reverse Direction block?

In the program Different, why don’t you have to turn off motor A before you turn on motor C?

 

Remember: The only commands that turn motors on or off are on, on for, and off.

You know enough now to start writing programs on your own, telling M. Pathfinder what to do. Here are some ideas for what M. Pathfinder can be programmed to do. It can be programmed to:

 

·        Turn in a small circle. (fixed radius)

·        Spin. (zero radius)

·        Go forward

·        Go backward

·        Beep

·        ZigZag

·        Go around a box (or a chair or anything else)

·        Go from a certain point in the room out the door to the hallway.

You may choose to write a program for any of these ideas or come up with your own idea(s).

 

Hit the wall and go back

 

Be sure to solve the following problem before moving on to the next activity.

 

Write a program that tells M.Pathfinder to go toward the wall, hit the wall and go backwards. Here’s what to do:

 

 

1.       Using masking tape, mark a line on the floor 2 or 3 feet away from a wall.

2.       Write a program, telling M.Pathfinder to move forward towards the wall and go backwards after it hits the wall.

3.       Save your program.

4.       Download the program.

5.       Place M. Pathfinder on the line facing the wall. Run it.

 

 

When you run the program, pay attention to what it’s doing:

·         Did it hit the wall or did it go backwards too soon?

·         Did it go backwards as soon as it hit the wall, or did it try to run into the wall?

 

Note: Most people solving this problem for the first time have to go back to the computer and change their program. It rarely works perfectly on the first trial.

 

 

 

Now, move your line farther away from the wall. What do you think is going to happen when you run M.Pathfinder?

Try it.

 

 

What will you have to do to fix it?

 

 

 

Thinking about it

 

Do you think that M. Pathfinder can tell when it hit the wall? Why or why not?