Download presentation
Presentation is loading. Please wait.
Published byDeborah Todd Modified over 8 years ago
1
2010 Cougar Advanced NXT-G Programming Workshop
2
Basic NXT-G Programming
3
NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)
4
Forward 2, Back 2, Talk 01-Basic Program.rbt Save this program as “01-Basic”
5
Loop 36 times 02-Simple Structure - Loop.rbt Save this program as “02-Simple”
6
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...
7
Branch on a Variable & Use Wires 03 Variables.rbt 03-Variables.rbt
8
Branch on a Sensor & Use Wires 03.1-Sensor And Branch.rbt Extra Credit!
9
Design Principles & Strategies
10
KISS Tool Design First – Then Program Leapfrog Development Competitive Development Test Repeatedly Change 1 Small Thing at a Time Test Repeatedly
11
Design Principles & Strategies KISS Quick Attachment Switching Test Repeatedly Strength & Power Leverage Change 1 Small Thing At A Time Repetitive Testing Slow Motion Video
12
Tactical Techniques Standard Starting Location Standard Starting Configuration Straight Lines using Move Blocks Pivot Turns (some folks call these Swing Turns)
13
Basic Techniques
14
Incremental Development with Bluetooth Where to go from here?
15
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
16
Incremental Development with Bluetooth Mission 1 - Basic
17
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
18
Precise Turns Left Face! 04-Left Face.rbt
19
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…
20
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
21
Sensors When should I stop? Go Forward until you see dark – Use a move and a wait block – Check your light levels
22
Sensors When should I stop?
23
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
24
Sensors When should I stop?
25
Medium Techniques
26
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
27
MyBlocks Good things come in small packages
29
Save this program as “5.4-GoToDark”
30
Multi-Threaded Programming walking 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.
31
Multi-Threaded Programming walking and chewing gum at the same time
33
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 Avoid Move “Unlimited” with “Wait Sensor” Avoid Move “Stop”
34
Multi-Threaded Programming walking and chewing gum at the same time
35
Advanced Techniques
36
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 We've posted “Cougar Calibrate.rbc”, our calibrate program, on CougarRobot.com
37
Sensor Calibration Is it night or just cloudy?
39
Position Registration Our Favorite, X marks the spot Back to Wall
40
Position Registration Our Favorite, X marks the spot
41
Back to Wall Back to Line
42
Position Registration Our Favorite, X marks the spot
43
Back to Wall Back to Line Advance to Line
44
Position Registration Our Favorite, X marks the spot
45
Back to Wall Back to Line Advance to Line We've posted “Cougar Advance To Line.rbt” on our website CougarRobot.com.
46
Position Registration Our Favorite, X marks the spot How should I register my position? 1. Register using touch 2. Register using light 3. Register using odometry What should I register my position against? 1. The strategic object you are manipulating 2. The mat 3. Field walls
47
Dependent Threads & Synchronization throwing the newspaper while riding your bike Let's take a look at our Final Mission, CA Black 5-8 Timmy and Friends! The turn in front of the dynamometer is now jam-proof!
48
Dependent Threads & Synchronization throwing the newspaper while riding your bike
49
Our Grey Balls mission from Climate Connection really showed smoothness of dependent threads.
50
Dependent Threads & Synchronization throwing the newspaper while riding your bike
51
Timers When will this match be over? Here's how we used a timer in our master program during Climate Connections
52
Timers When will this match be over?
54
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
55
Master Programs/Menus/Scripting Your wish is my command Let's build a simple sequencer. – Make 01-Basic into a MyBlock – Make 02-Loop 36 times into a MyBlock – Make 5.4 Go To Dark into a MyBlock
56
Master Programs/Menus/Scripting Your wish is my command Let's build a simple sequencer. – Start a new program – Drop the 3 MyBlocks onto a sequence beam – Add wait blocks – Add a sound at the start
57
Master Programs/Menus/Scripting Your wish is my command
58
Now Check out a Full Featured Sequencer...
59
Master Programs/Menus/Scripting Your wish is my command
60
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”
61
Master Programs/Menus/Scripting Your wish is my command
63
Resources http://www.cougarrobot.com http://nxtasy.org http://www.teamhassenplug.org/ http://www.teamhassenplug.org/NXT/NXTGTips/ http://www.teamhassenplug.org/NXT/NXT-GCodeIndex.html http://mindstorms.lego.com/nxtlog/ProjectDisplay.aspx?id=c3d cfabe-9802-444d-8b76-c7e23d41f9b8 http://www.nxtasy.org/repository/nxt-g-blocks/ Brian Davis Ph.D., Adjunct Assistant Professor at Indiana University South Bend, & LEGO MDP
64
Miscellaneous 60ish blocks per program At roughly 60 blocks per program the NXT-G editor will start to get really flakey
65
Miscellaneous Know how many degrees or rotations per inch You should be able to predict the numbers to feed to a move block by using a tape measure. You should also be able to predict the numbers to make the robot turn 90 degrees.
66
Miscellaneous NXT-G is Good at Modularization Nest and Parameterize Your Programs
67
Miscellaneous Innovate Early Consolidate Late
68
Miscellaneous Version control (can use “Pack and Go”) Backup solution (can use 7-Zip)
69
Put It All Together!
70
Our Thanks to...
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.