850 likes | 981 Views
Basic NXT-G Programming. NXT-G. Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures). Forward 2, Back 2, Talk. 01-Basic Program.rbt. Save this program!. Forward 2, Back 2, Talk. Save this program!. Loop 36 times.
E N D
NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)
Forward 2, Back 2, Talk 01-Basic Program.rbt Save this program!
Forward 2, Back 2, Talk Save this program!
Loop 36 times 02 Simple Structure - Loop.rbt Save this program!
Loop 36 times Save this program!
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 “Compare” block? A “Compare” block tests the value of a numeric variable against a another number. When might we use a “Compare” block? To test the value of a sensor...
Branch on a Variable & Use Wires 03 Variables.rbt 03-Variables.rbt
Branch on a Sensor & Use Wires 03.1-Sensor And Branch.rbt Extra Credit!
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 Specialized Tools Test Repeatedly Stiff & Stable is Repeatable and Reliable 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 (some folks call these Swing Turns)
Incremental Development with Bluetooth Where to go from here?
Incremental Development with Bluetooth Now we will write a program together using Bluetooth incremental development Move Forward Lower Arm Trapping 3 Pylons and Blue Ring Backup to Base Raise Arm Back to Starting Position
Incremental Development with Bluetooth Mission 1 - Basic
Precise TurnsLeft 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 TurnsLeft Face! 04-Left Face.rbt
VideoWhat’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…
VideoWhat’s really going on here? We're going to show you: Video at full speed Video in slow motion Video in frame by frame Watch: 1 House & Core Rig Slow Mo video.MP4
SensorsWhen should I stop? Go Forward until you see dark Use a move and a wait block Then add a stop block Check your light levels
SensorsWhen should I stop? Go Forward until you see dark Use a move and a wait block Then add a stop block Check your light levels The wait until sensor block is one way to stop on a line... Our way is better when you need both power and accuracy. Now we'll build an improved loop checking sensor every 6 degrees Then try changing the number of degrees
MyBlocksGood 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
Multi-Threaded Programmingwalking and chewing gum at the same time Advance on the blue ring while lowering the arm to just above the blue ring. Continue to move forward slowly while lowering the arm the rest of the way. Return to base.
Multi-Threaded Programmingwalking and chewing gum at the same time
Multi-Threaded Programmingwalking and chewing gum at the same time
More Tactical Techniques Standard Starting Location Standard Starting Configuration Straight Lines using Move Blocks Pivot Turns 1-Count Loops to Synchronize Threads “Crowbars” to pry open loops and switches Use your own loops to check sensors and control movement for best accuracy CONTROL your own destiny by writing your own code
Multi-Threaded Programmingwalking and chewing gum at the same time
MyBlocks with Parameters“Siri, take me here!” Parameters make MyBlocks reusable in more situations MyBlocks become adaptable You only program 1 MyBlock that is applicable in different scenarios
MyBlocks with Parameters“Siri, take me here!” Take our two part turn and add direction math Determine desired direction Add a variable for input Cut the wire and make a MyBlock!
Sensor CalibrationIs 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 We've posted “Cougar Calibrate.rbc”, our calibrate program, on CougarRobot.com Why is Cougar Calibrate better?