Basic NXT-G Programming Workshop

advertisement
Dublin Robotics Boosters
Basic NXT-G Programming
Don’t touch that computer!


Build a solid robot that will do the job within the
parameters of the board
Build solid attachments that will accomplish the
desired missions




Set a goal
Think strategically
Build attachments that can be changed quickly or can multitask, if possible
Attachments should always start/stop in same position

Need to have a standard starting location


Consider building a jig for “quick starts” and eliminate errors
Consider using Bluetooth for practices

Bluetooth may NOT be used at tournaments
Programming 101

KISS - Keep It Simple Silly!

Ask yourself … Is this (method, model, etc) the simplest it can
be?
Programming 101
•
Change only 1 thing at a time
– It’s the ONLY way to tell what is wrong (or right)
in the new product.
– Document, Document, Document!
•
•
Make a record of what you changed so you can go back
to the original if it doesn’t work
Rename programs BEFORE you make changes
Programming 101

Testing, testing, testing… (and testing)

Test until you achieve successful results a minimum of 5
times in a row
Programming 101



SAVE your work frequently!!!
Coaches should have a back-up of ALL recent programs
Avoid having programs on multiple computers
Programming 101

Try several options and take the best



Be creative
Get as many kids involved in programming and design as
possible
Problem solve with each option


Can 1 option be adapted?
Can 2 options be merged?
Programming 101

Watch carefully to see where errors occur


Use slow-motion video if desired and available
Teammates should pay close attention to trial runs and mark
where errors occur (The ENTIRE team should be watching)
Programming 101

Leapfrog Development – Use this for PROGRAMS,
ROBOT and ATTACHMENTS





Once you have a working robot, program, tool or
attachment, DO NOT CHANGE IT.
Build something new that works better.
ONLY tear apart the old model AFTER you have built a
better model.
Then DON’T change the NEW one!
READ THE ABOVE AGAIN!!
Now for the Programming…

Input Ports (#1-4)


Used to attach sensors
Output Ports (A-C)

Used to attach motors
Programming…
Light Sensor


Reads light sensitivity
from surroundings
Reads reflection from IR
emitter
Ultrasonic
Sensor
• Senses distance
Sound Sensor
• Measures sound level
Touch Sensor
• Responds to press in
or release
Programming…

Sequence Beams



Controls the flow of your program
Blocks connected to the beam can be downloaded to the
robot. Unconnected blocks cannot.
Blocks

Move Block is most important, most used

Decide how you are going to measure distance to move robot
Programming… (Finally!)
Objective… Learn to manipulate Move Blocks
Building a Sequence Beam, we’re going to:
 Move forward, lift an attachment, return to base
Beginner 1
Objective… Learn to pivot and turn
Modifying that Sequence Beam, we’re going to:
 Move forward, lift an attachment, pivot left and move forward
again.
Beginner 2
Adding to the Beginner 2 program, how
can you get your robot back to base?
This is just one solution…
Beginner 3
Sensitivity Training
Objective… Learn to use Light Sensors
Using a Light Sensor to stop on a line:
 Start with the Beginner 2 Sequence Beam
 Change the last Move Block to unlimited
 Add a Wait Block (Flow Palette), select “Light Sensor”, looking for dark line
 Add Move Block to stop B&C motors
Beginner 4
Death to Uni-Taskers!!
Objective…Learn to run multiple Sequence Beams
Lower an attachment while moving out of base
 Start with the Beginner 4 Sequence Beam
 Add Move Block below 1st Forward Block
 Drag Sequence Beam to lower Move Block
Beginner 4.1
Getting All Touchy-Feely
Objective…Learn to use Touch Sensors
Using a Touch Sensor to stop at a wall:
 Start with a new Sequence Beam, move forward, unlimited
 Add a Wait Block (Flow Palette), select “Touch Sensor”, looking for
wall. Some programs/blocks NEED a “Stop” Block.
 Add Move Block to stop B&C motors, back up, pivot left and move
forward again
Beginner 5
Franken-bots



Q &A
Test your ‘Bots
What else can YOU do?
Nick’s NXT obsession… uhhmm… hobby
Fair Swings
Ferris Wheel
Double Ferris Wheel
Power Tower
Tower Crane
Marble Run
Himalayan
Download