Basic NXT-G Programming
NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)
Forward 2, Back 1, Talk
Loop 36 times
Branch on a Variable & Use Wires What's a “Variable”? – It's a box to put something in, like text, a number, or a true/false value. Why might we use a “Variable”? – To reference it later in the program. What is a “Range” block? – A “Range” block tests the value of a numeric variable against a range. When might we use a “Range” block? – To test the value of a sensor...
Branch on a Variable & Use Wires
Design Principles & Strategies
KISS Tool Design First – Then Program Leapfrog Development Competitive Development Test Repeatedly Change 1 Small Thing at a Time Test Repeatedly
Design Principles & Strategies KISS Quick Attachment Switching Test Repeatedly Strength & Power Leverage Change 1 Small Thing At A Time Repetitive Testing Slow Motion Video
Tactical Techniques Standard Starting Location Standard Starting Configuration Straight Lines using Move Blocks Pivot Turns
Basic Techniques
Incremental Development with Bluetooth Where to go from here?
Incremental Development with Bluetooth Now we will write a program together using Bluetooth incremental development – Back to Wall (advanced technique) – Turn Left – Lower Arm – Go to ice core sample – Lift sample – Drive back to base
Incremental Development with Bluetooth
Precise Turns Left Face! Hold one wheel still Drive with the other wheel Make your drive in two parts, slow then fast You’re not done until you have strung it together with the moves before and after the turn
Precise Turns Left Face!
Video What’s really going on here? Once we looked at a slow motion video of our robot we found out we hadn’t really been seeing what our robot was doing…
Video What’s really going on here? We're going to show you: – Video at full speed – Video in slow motion – Video in frame by frame
Sensors When should I stop? Go Forward until you see dark – Use a move and a wait block – Check your light levels
Sensors When should I stop?
Go Forward until you see dark – Use a move and a wait block – Check your light levels – Using the wait until sensor blocks is notoriously inaccurate so... – Now we'll build an improved loop checking sensor every 6 degrees
Sensors When should I stop?
Medium Techniques
MyBlocks Good things come in small packages Take our “Go to Dark” loop program and make it a MyBlock Combine a move with our “Go to Dark” MyBlock
MyBlocks Good things come in small packages
Multi-Threaded Programming walking and chewing gum at the same time Set arm height for Ice Core Sample while making the run. Finish raising the arm while making the run back.
Multi-Threaded Programming walking and chewing gum at the same time
Mini-Blocks How can we squeeze all this stuff into my tiny brain? First we'll take a look at the mini-blocks on the big screen. When you get home be sure to download them from: Take a look at how we use them in one of our programs.
Mini-Blocks How can we squeeze all this stuff into my tiny brain? The Mini-Block library is no longer necessary or appropriate with NXT-G 1.1 or 2.0. It is a great tool if you are using NXT-G 1.0 Special thanks to Brian Davis Ph.D., Adjunct Assistant Professor at Indiana University South Bend, & LEGO MDP for explaining this to us when he reviewed our presentation.
Mini-Blocks How can we squeeze all this stuff into my tiny brain?
More Tactical Techniques Standard Starting Location Standard Starting Configuration Straight Lines using Move Blocks Pivot Turns 1-Count Loops to Synchronize Threads Avoid Move “Unlimited” with “Wait Sensor” Avoid Move “Stop”
Advanced Techniques
Sensor Calibration Is it night or just cloudy? First we'd like to explain the Calibrate Block Then we'll show you how we use it in our Calibrate program After the workshop we'll be posting “Cougar Calibrate.rbc”, our calibrate program, on CougarRobot.com
Sensor Calibration Is it night or just cloudy?
Position Registration Our Favorite, X marks the spot Back to Wall
Position Registration Our Favorite, X marks the spot
Back to Wall Back to Line
Position Registration Our Favorite, X marks the spot
Back to Wall Back to Line Advance to Line
Position Registration Our Favorite, X marks the spot
Back to Wall Back to Line Advance to Line We'll post “Cougar Advance To Line.rbt” after the workshop on our website CougarRobot.com.
Dependent Threads & Synchronization throwing the newspaper while riding your bike Let's take a look at our Grey Balls mission!
Dependent Threads & Synchronization throwing the newspaper while riding your bike
Timers When will this match be over? Here's how we used a timer in our master program
Timers When will this match be over?
Master Programs/Menus/Scripting Your wish is my command We use a Master Program – We have a plan and a script – Our Master Program helps us follow it quickly
Master Programs/Menus/Scripting Your wish is my command
Last year we improved our Master Program by altering “LB or EB” program. LB (left button) is repeat last mission EB (enter button) is run next mission. We added RB (right button) which jumps ahead one mission in the sequence Our new program is “LB or EB or RB”
Master Programs/Menus/Scripting Your wish is my command
Resources cfabe d-8b76-c7e23d41f9b8 Brian Davis Ph.D., Adjunct Assistant Professor at Indiana University South Bend, & LEGO MDP
Put It All Together!