Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dublin Robotics Boosters NXT-Step Programming Workshop.

Similar presentations


Presentation on theme: "Dublin Robotics Boosters NXT-Step Programming Workshop."— Presentation transcript:

1 Dublin Robotics Boosters NXT-Step Programming Workshop

2 Basic Programming Workshop Review  Programming can not overcome poor robot and attachment design  Think strategically with missions & attachments  Use Bluetooth  KISS it!  Change ONE thing at a time  Document changes  Leapfrog development  Save, Save, Save

3 NXT-Step Programming Workshop: Taking your programming to the NXT Level  Adding on to the Basics:  Create a script or a checklist for the competition  This checklist should be run through each time you approach the table to ensure that EVERY ITEM is in it’s place and you are ready to go  This checklist should be read by a non-robot handling student throughout the competition.  This checklist can be as simple or as complex as needed to suit your team  Things to include  Check chassis  Check wiring is secure  NXT is “on” and set to it’s 1 st program/mission  Attachments are assembled and ready for use  Who is the robot handler, what mission are they doing (repeat as needed)

4 Default Ports Touch Sensor  Default port 1 Sound Sensor  Default port 2 Light Sensor  Default port 3 Ultrasonic Sensor  Default port 4 Attachment Motor  Default port A Drive Motors  Default ports B & C

5  Use the NXT to find accurate sensor readings  “View” option  Bluetooth can send sensor readings to PC  select the sensor block  readings will appear on the far left of the configuration panel Use that BRAIN!

6 Reading Sensors: Now it’s your turn… Objective… take sensor readings using your NXT Using your NXT and Bluetooth, we’re going to:  Take rotation reading (only reads in degrees)  Take light reading  Calibrate NXT light readings  Select “Calibrate” program from tools menu (it will download and run automatically).  Run this program EVERY time you approach the board if you use light sensors

7 Multitasking! What is multitasking?  Programming your robot to accomplish multiple tasks at the same time  Why use it? SAVES TIME!!  Example: Move forward and raise an attachment

8 Multitasking: Now it’s your turn… Objective… Program your NXT to walk and chew gum at the same time In NXT-G, we’re going to:  Create a multiple sequence beam  Program a standard move forward block  Add a 2nd sequence beam, programming the attachment motor to raise or lower  TIP: Add a move block below the 1 st sequence beam. Use “Shift” and click on the 1 st sequence beam, then drag down to connect to the move block, creating a new sequence beam.

9 Loops: Going in Circles… What’s a loop?  Requires a task to be repeated a set number of times before moving to the next block  Repeat (or continue) a task until a specific variable is met (using sensor input)  Requires that specific conditions are met before moving on to the next block

10 Loops: Now it’s your turn… Objective… using a loop, learn to meet a specific condition before moving on to the next block Using a loop, we’re going to:  Create a task that needs to repeat a set number of times before moving to the next block  Continue a task until a specific variable is met (using sensor input)

11 Breaking and Entering: using a crow bar What’s a Crow Bar?  A temporary block used to pry open a space within a loop or a switch

12 Crow Bar: Now it’s your turn… Objective… learn to manipulate blocks to pry open space for loops and switches Using a crow bar, we’re going to:  Create a 2 nd sequence beam inside a loop  Hint: The same process can be applied to a Switch

13 Can you count to ONE?: Single Count Loops  Single Count Loops:  Ensure that ALL tasks are met before leaving the loop  Why use a Single Count Loop?  It’s an insurance policy that everything is synchronized before moving on

14 Single Count Loops: Now it’s your turn… Objective… using a single count loop, learn to ensure ALL tasks are completed before leaving the loop Using a single count loop, we’re going to:  Create a program that needs to meet a specific requirement before moving to the next block  Hint:  Use a crowbar to put everything in a Loop

15 Switches: If/Then Conditions What’s a Switch?  If Condition A is met, then program chooses path 1  If Condition B is met, then program chooses path 2  Example: Condition A: If the Light Sensor reads above 50, NXT says “Light”; Condition B: If the Light Sensor reads below 50, NXT says “Dark”

16 Switches: Now it’s your turn… Objective… using a switch, teach your robot to make a choice between two actions Using a switch, we’re going to:  Create a program that requires a if/then statement, dependent upon sensor input.

17 Data Wires: Playing Telephone with Your Programming  Data Wires are:  Data wires send information from one block to one or more blocks later in a program  Three types of Data Wires:  Numeric: integers (whole numbers), positive or negative  Logic: one of two possible values, true or false  Text: a string of letters “Hello”, “turn right”, “643cheese”  Why use them?  Could send a light reading to a variable block  Could send a touch sensor reading to a move block  Could send text to the NXT screen letting you know what a specific condition is (a light sensor reading)  Must use a text block to convert a reading to text

18 Data Blocks: Information Overload  Logic, Math & Compare Blocks:  Blocks in which math calculations or comparisons are performed  Range & Random Blocks:  Looks for values in a given range or randomly selects a value  Variable & Constant Blocks:  Carry and hold information for later use  Variable Blocks get information from other blocks  Constant Blocks must have values, like numbers or a true/false, input manually by the programmer  Why use them?  So we can reference values later in a program

19 Data Wires and Data Blocks: Putting it all together  See the Help section for specific color coding and other helpful information about data wires Uses math to calculate distance Data Wires Data Hub Constants

20 My Blocks: Space Saving Miracles  My Blocks are:  Customized collection of blocks condensed into a single block  Why use a My Block?  Saves screen space & simplifies look of your program  Creates a “program” that can be used multiple times within a single block or program.  Hints:  If you change anything within a My Block, it changes that My Block throughout your programming.  Double click the My Block to see what’s inside it.

21 My Blocks: Now it’s your turn…  Objective: Learn to create a My Block  We’re going to… Create a simple program and make it into a My Block

22 Telling your NXT where to go…  Using the information that we’ve already learned…  How can you use a loop to determine your NXT’s location on the board?  Would it be more accurate if your robot had multiple Touch and Light Sensors? Why or why not?  Hints:  If you tell your robot to “square” to a wall or a line, is it in a more accurate position on the board than telling your robot to move X number of rotations?  How does the position of the Light/Touch Sensor on the robot affect the programming?

23 Telling your NXT where to go…  Using the information that we’ve already learned…  How can you use a Touch Sensor with a loop to:  Find a wall  How can you use a Light Sensor with a loop to:  Find a line

24 Telling your NXT where to go…  Find a wall  Find a line

25 Telling your NXT where to go…  Using the information that we’ve already learned…  Using 2 Touch Sensors can you modify your “Find a Wall” program to:  Square to Wall

26 Telling your NXT where to go…  Square to wall

27 Telling your NXT where to go…  Using the information that we’ve already learned…  Using 2 Light Sensors can you modify your “Find a Line” program to:  Square to Line

28 Telling your NXT where to go…  Square to line

29 Telling your NXT where to go…  Using the information that we’ve already learned…  How can you use a Light Sensor with a switch to:  Follow a line

30 Telling your NXT where to go…  Follow a line

31 Master Programs: The King of the NXT-G World (insert evil laugh here)…  Master Programs are:  A program that runs all the table top missions as a single mission  It breaks the missions into individual sections, pausing between each, waiting for input from the NXT brick before proceeding to the next one.  Why use a Master Program?  Saves space  Eliminates stressful searching for programs on NXT brick during competition

32 Kudos and credit where it’s due: We couldn’t do it without you…  Cindy Bryden  Dan Monroe  Cougar FLL Team  Programming Lego Mindstorms NXT by Owen Bishop  uct uct  Created October 2010 by:  Nick and Sherri Behr


Download ppt "Dublin Robotics Boosters NXT-Step Programming Workshop."

Similar presentations


Ads by Google