Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic NXT-G Programming. NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)

Similar presentations


Presentation on theme: "Basic NXT-G Programming. NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)"— Presentation transcript:

1 Basic NXT-G Programming

2 NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)

3 Forward 2, Back 1, Talk

4 Loop 36 times

5 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...

6 Branch on a Variable & Use Wires

7 Design Principles & Strategies

8 KISS Tool Design First – Then Program Leapfrog Development Competitive Development Test Repeatedly Change 1 Small Thing at a Time Test Repeatedly

9 Design Principles & Strategies KISS Quick Attachment Switching Test Repeatedly Strength & Power Leverage Change 1 Small Thing At A Time Repetitive Testing Slow Motion Video

10 Tactical Techniques Standard Starting Location Standard Starting Configuration Straight Lines using Move Blocks Pivot Turns

11 Basic Techniques

12 Incremental Development with Bluetooth Where to go from here?

13 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

14 Incremental Development with Bluetooth

15 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

16 Precise Turns Left Face!

17 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…

18 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

19 Sensors When should I stop? Go Forward until you see dark – Use a move and a wait block – Check your light levels

20 Sensors When should I stop?

21 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

22 Sensors When should I stop?

23 Medium Techniques

24 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

25 MyBlocks Good things come in small packages

26

27

28 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.

29 Multi-Threaded Programming walking and chewing gum at the same time

30

31 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: http://mindstorms.lego.com/support/updates/ Take a look at how we use them in one of our programs.

32 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.

33 Mini-Blocks How can we squeeze all this stuff into my tiny brain?

34 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”

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 After the workshop we'll be posting “Cougar Calibrate.rbc”, our calibrate program, on CougarRobot.com

37 Sensor Calibration Is it night or just cloudy?

38

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'll post “Cougar Advance To Line.rbt” after the workshop on our website CougarRobot.com.

46 Dependent Threads & Synchronization throwing the newspaper while riding your bike Let's take a look at our Grey Balls mission!

47 Dependent Threads & Synchronization throwing the newspaper while riding your bike

48 Timers When will this match be over? Here's how we used a timer in our master program

49 Timers When will this match be over?

50

51 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

52 Master Programs/Menus/Scripting Your wish is my command

53 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”

54 Master Programs/Menus/Scripting Your wish is my command

55

56 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

57 Put It All Together!


Download ppt "Basic NXT-G Programming. NXT-G Sequence Beams Blocks Structures (special blocks) Wires (connect ports on blocks & structures)"

Similar presentations


Ads by Google