Introduction to NXT Software and Functionality Bot’oberfest October 15, 2007

advertisement
Introduction to NXT Software and
Functionality
Bot’oberfest
October 15, 2007
Topics
Differences between Common, Complete and
Custom Palettes
Opening and Saving Programs
Tools Menu
Download Menu
NXT Window
Basic Programming with the Common Palette
Icons
Troubleshooting: Downloading and Updating
Firmware
Using the Feedback Block
Common Palette
Move
Record/Play
Sound
Quic k Ti me™ and a
T IFF (LZW ) dec ompres s or
are needed to s ee t his pic t ure.
Display
Wait for (sensors)
Loop
Switch
Common Palette
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
There are 20 challenges
under the Common Palette
Each challenge has a
video of what should
happen, a design guide,
and a build guide.
It’s a fun way to learn about
building and programming
NXTs
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Complete Palette
Links to Common Palette icons
Actions
Sensors
Quic kT i me™ and a
T IFF (LZW) dec om pres s or
are needed t o s ee thi s pi c ture.
Flow
Data
Advanced
Custom Palette
My Blocks - You can store
reusable blocks of programming
that you created here
Quic kT i me™ and a
T IFF (LZW) dec om pres s or
are needed t o s ee thi s pi c ture.
Web Downloads - You can save
programs friends email you or
programs you get from sites like
www.mindstormseducation.com
Opening Programs
For a NEW program
1. Click on File/New on the
Menu Bar or
2. Type a name for your
program under Start New
Program and click Go
For a SAVED program
1. Click on File/Open or
2. Click on the drop down
arrow in the box under
Open Recent Program,
pick your program, and
click Go
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Open new file
Open saved file
Saving Programs
If you have already
named your program, you
can click File on the Menu
Bar then click Save.
If you have not named
your program, change the
name from Untitled to
something that indicates
what your program does.
Avoid long names and
random punctuation
symbols in your filenames
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Look to see where your files are
being saved so it will be easy for
you to find them again!
Tools Menu
Calibrate Sensors
One way to calibrate your
light and sound sensors.
Details on last slide of
PowerPoint.
There is an easier way to
calibrate light sensor.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Update Firmware
• Connect and turn
on NXT.
• If you’re online, click
Check.
• Find the most
recent update.
• Download.
• Be sure to see
where it downloads!
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Block Import Export
Click on Browse button
to find and select the
Block/file you want to
import.
Click on the dropdown
arrow by Advanced to
select where you want
the block to be stored.
Click on the Add Blocks
to Palette button
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Download to Multiple NXTs
You can
download one
or more
program files
to multiple
NXTs.
Detailed directions
are at the end of
this PowerPoint and
available by clicking
on the Mindstorms
help icon on the
Menu Bar
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
NXT Window
Download
and Run
selected
NXT
Window
QuickTi me™ a nd a
TIFF (LZW) de com press or
are need ed to se e th is p icture.
Download
Stop
Download
and Run
Wonderful NXT Window - Communications Tab
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Name your robot
Check battery life remaining
Check file storage available
Check firmware version
Check NXTs connected
NXT Window - Memory Tab
Delete, upload or download files.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
To delete, select the group, like Sound, to see the Sound
files on the NXT.
Highlight the file you want to delete.
Click Delete. You can delete all if you wish.
NOTE: This deletes files from your NXT, not your computer.
Basic Programming with the Common
Palette
Move Wait Block - for motors
Record/Play Wait Block Sound Wait Block - Plays a sound
Quic kT i me™ and a
T IFF (LZW) dec om pres s or
are needed t o s ee thi s pi c ture.
Display Wait Block - Words, data,
graphics
Wait for Wait Block - Sensor icons
Loop Wait Block - Repeat action until
Switch Wait Block - If “True” do X, if
“False” do Y
Basic Programming with the
Common Palette
Quick Time™a nd a
TIFF ( LZW) d ecomp res sor
ar e nee ded to see this pictur e.
Move Icon
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Used to control your motors
Inside the motor
Built in rotation sensor
LCD display on NXT brick
shows number of rotations
as they are counted
Move Icon - Properties
QuickTi me™ and a
TIFF ( LZW) decompressor
are needed to see thi s pi ctur e.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
This move icon programming says that the
motor is connected to Port C. Its Direction is
forward at Power 60% for Duration 1.7 seconds
(unlimited, rotations, degrees are other options
for Duration) and then Brake. Rotation and
degrees measure rotation of motor, not wheel
Basic Programming with the
Common Palette
Quick Time™a nd a
TIFF ( LZW) d ecomp res sor
ar e nee ded to see this pictur e.
Record/Play Icon
Lets you record and
save movements of
your robot
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Basic Programming with the
Common Palette
Sound Icon
• Recognized sound patterns
and tones
• Can be programmed to
respond to one clap, two
claps or a musical note.
• In what kind of
environment would you
NOT want to use this
sensor?
Quic kTime™ and a
TIFF (LZW) decompress or
are needed to see this pic ture.
Basic Programming with the
Common Palette
QuickTi me™ and a
T IFF (LZW ) decompressor
are needed to see t his pict ure.
Display Icon
Can be programmed to display images, text, or
drawings.
Below the display is programmed to show a
Happy Face
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Display
You’ll want to add a Time block
after the Display block so that
the images stays displayed.
Otherwise, it happens so fast
you don’t see it. Sample code
below.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
QuickT ime ™an d a
TIFF ( LZW) de compr ess or
ar e need ed to see this pictur e.
Basic Programming with the
Common Palette - Wait Icon
QuickT i me™ and a
T IFF (LZW) decom pressor
are needed t o see thi s pi cture.
Wait Icon - Sensors
Timer
Touch
Light
Sound
Ultrasonic
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Touch Sensor
Detect On (When pushed in
so the electrical connection
is made) or
Off (when not pressed and
no connection is made)
Opening for inserting an
axle so you can extend the
touch range and/or add
height/width at the tip
(Be careful about using these extensions if
you are also using an ultrasonic
sensor!)
Quic kTime™ and a
TIFF (LZW) decompress or
are needed to see this pic ture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Ultrasonic Sensor
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
CUTE!
Measures distances
from objects
Sends out a signal,
waits for return of
signal, while
keeping track of
time between send
and receive
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Ultrasonic - Icon and Properties
Does best with objects straight in front of it.
Will sense objects on the side - especially if you
DON’T want it to ! :-)
Is very useful and easy to program
QuickT ime ™an d a
TIFF ( LZW) de compr ess or
ar e need ed to see this pictur e.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
This ultrasonic sensor is connected to Port 4 and will do an action
like go forward until the distance between it and an object is less than 26 cm.
Light Sensor
Measures light on a scale
of 0 (no light) to 100 (very
bright)
Must be calibrated in
lighting where program
will run
Possible to turn off the
infrared source so sensor
only measures ambient
light
QuickTime™ and a
TIFF (LZW) decompress or
are needed to s ee this pic ture.
Calibrating the Light Sensor
Attach a light sensor and turn on your NXT.
You’ll be at My Files.
Arrow over to View and press orange button.
Arrow over to Reflected light and press orange
button.
Arrow to the number of the port you connected
your light sensor to and press the orange button.
Calibrating continued
Place your NXT with the light sensor over the
dark line (or whatever the darker, lower value
light ) and write down the number that displays
on the NXT.
Place your NXT with the light sensor over the
white or lighter area and write down the number
that displays on the NXT.
Add the two number together and divide by 2.
This gives you the number you enter as the
value for Light: in the Light Sensor Block
properties window.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Why does the NXT wiggle when it follows the
dark line?
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Motor B on, C off so robot will turn. You told it to
turn until the light value is greater than 42. Then
Motor C goes on and Motor B stops and the
NXT turns the other direction until the light
sensor reads a value of more than 42. That’s the
source of the cute “sashay”.
See the light sensor and its
programming in action.
QuickTime™ and a
H.264 decompressor
are needed to see this picture.
Basic Programming with the
Common Palette
Quick Time™a nd a
TIFF ( LZW) d ecomp res sor
ar e nee ded to see this pictur e.
Loop Icon
Very handy for making
actions repeat
Be careful! If you set the
Loop block to unlimited
(forever) it will keep doing
that action until you shut it
off our the battery dies!
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
You can change Control to
Sensor, Time, Count, or Logic
Basic Programming with the Common
Palette
Switch Block Icon and properties window
Quick Time™a nd a
TIFF ( LZW) d ecomp res sor
ar e nee ded to see this pictur e.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Use this block to have your robot choose
between two sequences of code.
If light value is greater than 42, turn
Motor B on and Motor C off.
If light value is less than 42, Motor C on
and Motor B off.
The input value for the switch block can
Be a sensor or a Logic value of number,
text, or number
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Troubleshooting
Downloading and updating
Firmware
Handout from Kristie Brown,
LEGO Education Representative for the
Southeast.
Using the Feedback Block
What provides feedback to the NXT?
Sensors
Motors
Built-in timers
Buttons on the Brick
(Also, the Receive Message programming block lets you
receive input from a message sent via Bluetooth.)
You will learn specifics of using these in
Intermediate Programming
Sensors for Feedback
Sensors detect changes in conditions
Touch - Haven’t hit wall. to Have hit the wall!
Sensors can only respond to ONE condition at a
time.
The same light sensor icon cannot identify and
follow both a red line and a black line
Sensors can only respond True or False.
Timers for Feedback
QuickTime™ and a
TIFF (LZW) decompress or
are needed to s ee this pic ture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
You will learn more
about these in
intermediate
programming.
Buttons for Feedback
Left, Right, and Enter (orange) buttons can
be used for feedback.
The Cancel button cannot.
Websites
http://www.legoeducation.com
http://coweb.cc.gatech.edu/ice-gt
http://pacerobonotes.wetpaint.com
(Resources page of wiki has many more links)
http://coweb.cc.gatech.edu/ice-gt/135 videos
http:washtington.edu/info/videos
Sources
MINDSTORMS Education NXT “Getting
Started with NXT”.
Kelly, Jim. LEGO MINDSTORMS NXT-G
Programming Guide.
Calibrate Sensors
Select the light sensor and the port the sensor is connected to. Then click the Calibrate button.
This will download a small program to the NXT and run it automatically.
On the NXT’s screen you will see text that reads “Min Value:”. Point the light sensor towards a
material or spot that represents what the light sensor should measure as dark. Press the orange
Enter button on the NXT.
Next you will see text that reads “Max Value:”. Point the light sensor towards a material or spot
that represents the brightest location the sensor will encounter during the program. Press the
orange Enter button again. Calibration is complete.
Calibrating a sound sensor
Select the sound sensor and the port the sensor is connected to. Then click the Calibrate button.
This will download a small program to the NXT and run it automatically.
On the NXT’s screen you will see text that reads “Min Value:”. Position the sound sensor in the
environment it will encounter when the program is running and where any background noise is
measurable. Press the orange Select button on the NXT.
Next you will see text that reads “Select Max:”. Measure or make the loudest sound you want to
measure and press the Select button again. Calibration is complete.
Source: NXT Help button
Download to Multiple NXTs
This function allows you to download one or more programs to multiple NXTs. This is especially
useful if you need to load a number of NXTs with the same program(s) for a competition or
classroom assignment.
The Download to Multiple NXTs feature is only available in the educational version of the LEGO
MINDSTORMS NXT Software.
You can download a number of programs to an NXT until this memory is full. An average program
is 11 kilobytes in size but this varies. When the memory is full, you can select programs to delete
in order to make space. See the Help file “Managing files and memory on the NXT” for details.
Note: Before using this function, make sure that all of the programs you would like to download
are open in the software. When you open more than one program at the same time, the program
names appear as tabs along the top of the work area (as shown in the graphic below). Also, make
sure your bricks are "available" by pressing Scan in the NXT window. Otherwise they will not
appear in the Download to Multiple NXTs window.
Image – show at least three program tabs in a row and a bit of surrounding interface
When the programs that you would like to download are open, launch the function by choosing
Download to Multiple NXTs... in the Tools menu. This will open the Download to Multiple NXTs
dialog box, shown below.
Image of Download to Multiple NXTs dialog box with callouts 1 & 2 marked
1. Choose NXTs lists all of the NXTs that are currently available.
2. Choose Programs lists all of the programs that are currently open.
Note: If you do not see an NXT in the list, close the Download to Multiple NXTs tool and open the
NXT window (accessible from the controller). Make sure that all the NXTs have been configured in
this window before launching the Download to Multiple NXTs tool.
Downloading to Multiple NXTs
First, choose the NXTs to which you would like to download by clicking in the box(es) to the left of
the NXT names. You can select all available NXTs by clicking the Select All button below the list.
Clicking the Deselect All button deselects all of the NXTs.
Then choose the programs you would like to download by clicking the boxes to the left of the
program names.
When your selection is complete, click the Download button below the program list. This begins
the download process. The progress columns display the download progress.
Download to Multiple NXTs
During the compilation process there are four status messages that can be displayed in the
Programs list box:
* Skipped - if you did not select that program file
* Compiling - if the file is currently compiling
* Done - when that program has been compiled
* Error - if a problem is encountered while compiling the program
Once all of the selected programs have been compiled, the download process begins. During
download, there are four status messages that can be displayed in the NXT list box:
* Skipped - if you did not select that NXT
* Downloading - if it is currently downloading to the NXT
* Done - when downloading all programs to that NXT is complete
* Error - if a problem is encountered during the download process
Click the Close button when you are finished downloading programs to multiple NXTs.
Note: To share programs between computers (allowing the programs to be edited on a different
computer), you should exchange the .rbt file of the program by using email or a USB drive.
Source NXT Help button
Download