Presentation is loading. Please wait.

Presentation is loading. Please wait.

2008 – 2009 Team Unlimited (FTC # 1) Coding for the FIRST Tech Challenge NXT/G, LabVIEW & RobotC compared, and a Crash Course in RobotC Presented by Team.

Similar presentations


Presentation on theme: "2008 – 2009 Team Unlimited (FTC # 1) Coding for the FIRST Tech Challenge NXT/G, LabVIEW & RobotC compared, and a Crash Course in RobotC Presented by Team."— Presentation transcript:

1 2008 – 2009 Team Unlimited (FTC # 1) Coding for the FIRST Tech Challenge NXT/G, LabVIEW & RobotC compared, and a Crash Course in RobotC Presented by Team Unlimited, FTC #1 http://unlimited.syraweb.org/

2 2008 – 2009 Team Unlimited (FTC # 1)  Coding Environment Comparisons  Why RobotC?  NXT Overview  Sensor overview  Motor & Servo Overview  Coding Basics  RobotC Overview & Basics  Sample code  Code in RobotC Presentation Overview

3 2008 – 2009 Team Unlimited (FTC # 1) Coding Comparison NXT-G Graphics Based Learning Curve : Easiest LabVIE W Graphics Based Learning Curve : Moderate RobotC Text Based Learning Curve : Hardest

4 2008 – 2009 Team Unlimited (FTC # 1)  Graphics based coding environment  Similar to RoboLab (from RCX)  Layer over LabVIEW  Learning Curve : Easiest NXT-G Overview

5 2008 – 2009 Team Unlimited (FTC # 1) + Easy to learn + Simple user environment + FLL teams will have experience + Can use LabVIEW as a “My Block” creator - Less power than the other languages - Programs can take up a lot of room for long programs - Power hungry on low power machines - Lack of complicated math functions NXT-G : Advantages and Disadvantages

6 2008 – 2009 Team Unlimited (FTC # 1) NXT-G Home Screen

7 2008 – 2009 Team Unlimited (FTC # 1) NXT-G Side Bars

8 2008 – 2009 Team Unlimited (FTC # 1)  Graphics based coding environment  Professional coding environment  Has many advanced features that were removed from NXT-G (i.e. Trigonometric functions)  Learning Curve : Moderate LabVIEW Overview

9 2008 – 2009 Team Unlimited (FTC # 1) + Professional programming language + Code will flow automatically from left to right + Can export “My Blocks” to NXT-G + Has advanced math functions - Can lag the processing power of the NTX - Lots and lots of opinions - Small text that can’t be magnified LabVIEW : Advantages and Disadvantages

10 2008 – 2009 Team Unlimited (FTC # 1) Labview Home Screen

11 2008 – 2009 Team Unlimited (FTC # 1) + Extreme control of the code + Text is similar to the EasyC code (text) + Included joystick controller + Real time data updates (Sensors, motors, etc.) + Tons of online resources + Real Time Debugger - Steep learning curve - Can be frustrating to code - A lot of “trial and error” at the beginning RobotC : Advantages and Disadvantages

12 2008 – 2009 Team Unlimited (FTC # 1)  Text based coding environment  A “C” based coding environment created by Carnegie Mellon University  FTC and Vex legal  Inexpensive for extra license ($50)  “Complete control” over the code  Learning curve : Hardest Robot C Overview

13 2008 – 2009 Team Unlimited (FTC # 1) RobotC Home Screen

14 2008 – 2009 Team Unlimited (FTC # 1)  Speed  RobotC runs quicker on the NXT  Differences in speed are small until larger code is written  Control  In RobotC you have control over almost everything  Real Time Debugger to allow viewing of code line by line while running  Personal Preference  Text base control  Advanced math functions  Team Decision Why RobotC?

15 2008 – 2009 Team Unlimited (FTC # 1)  Sensor ports - four input ports for attaching sensors - Ports 1, 2, 3 and 4.  Loudspeaker - program with real sound output  Attachment points – for LEGO Technic pins, connect to chassis. NXT Controller Specifications 32-bit ARM7 microcontroller 256 Kbytes FLASH, 64 Kbytes RAM 8-bit AVR microcontroller 4 Kbytes FLASH, 512 Byte RAM Bluetooth wireless communication (Class II V2.0) USB full speed port (12 Mbit/s) 4 input ports, 6-wire cable digital platform 3 output ports, 6-wire cable digital platform 100 x 64 pixel LCD graphical display Loudspeaker - 8 kHz sound quality. Power source: 6 AA batteries

16 2008 – 2009 Team Unlimited (FTC # 1)  Motor ports - 3 output ports for attaching motors - Ports A, B & C  USB port - USB cable to the USB port, download programs from computer to NXT. Also can use the wireless Bluetooth connection. NXT Controller Continued

17 2008 – 2009 Team Unlimited (FTC # 1)  Touch sensor  Light sensor  Ultrasonic sensor  Compass sensor  Rotation sensors Recommend Sensors

18 2008 – 2009 Team Unlimited (FTC # 1)  Senses COLLISIONS  Useful for sensing a wall or robot  Simple binary switch “on” or “off Touch Sensor

19 2008 – 2009 Team Unlimited (FTC # 1)  Senses LIGHT (not color)  Useful for line following  Two types  Reflected – Shines a light  Ambient – Uses available light  With a filter, can detect a color Light Sensor

20 2008 – 2009 Team Unlimited (FTC # 1)  Senses PROXIMITY  Useful for sensing distance  Detects whole inch distances  At extreme proximity, distances can be wrong  I.e. below 2”, often can still get 2” as a response  Useful if you don’t want to touch the object with the robot Ultrasonic Sensor

21 2008 – 2009 Team Unlimited (FTC # 1)  Senses RELATIVE HEADING  Useful for alignment  Detects nearest 1°  Will detect headings relative to the Earth’s magnetic field.  Built in calibration to minimize interference  Does not get headings relative to the field  Set an Initial Value (will act as a zeroing for the program) Compass Sensor

22 2008 – 2009 Team Unlimited (FTC # 1)  Counts ROTATIONS  Built into every NXT Motor  Detects nearest 1°  Useful for precision manipulation of arms, grippers, etc. Rotation Sensor (NXT)

23 2008 – 2009 Team Unlimited (FTC # 1)  Counts ROTATIONS  Used on the DC Drive motors  Needed to use the PID Control of the kit  Useful for driving a distance (autonomous)  If you have four drive motors  1 DC Motor Control : Place one rotation sensor on each side  2 DC Motor Control : Place one rotation sensor on each motor Rotation Sensor (external)

24 2008 – 2009 Team Unlimited (FTC # 1)  12V DC Motors  4 Motors allowed for use  NXT Motors  3 Motors allowed for use  HS-475B Servos  6 Servos allowed for use Propulsion and Manipulation

25 2008 – 2009 Team Unlimited (FTC # 1)  Can use up to 4  Turning speed is from 0 - 152 rpm, PID loop controlled  Continuous rotation  Useful for drive motors  Consider a second DC controller (arms & mechanisms)  External Shaft Encoder 12V DC Motor

26 2008 – 2009 Team Unlimited (FTC # 1)  Can use up to 3  Turning speed is from 100-170 rpm  Continuous rotation  Integrated rotation sensor  Useful for non-loading bearing mechanisms (I.e. Intakes) NXT Motor

27 2008 – 2009 Team Unlimited (FTC # 1)  Can use up to 6  Limited motion ( ~ 190°)  Position controlled (127 is center, 0 is full left, 255 is full right)  Useful load bearing mechanisms (I.e. arms) HS-475B Servo Motor

28 2008 – 2009 Team Unlimited (FTC # 1)  Get a diagram of the field  Draw the general routine w/ arrows and numbers  Make side notes noting what happens at each number  i.e. 1) Servo’s raise  Start your first code draft Coding Basics Draft Out the Code

29 2008 – 2009 Team Unlimited (FTC # 1)  Dead Reckoning  A prewritten routine  Code flows A to B to C  If interrupted, will only try to continue  Easier to write  Sensing  Routine that can adapt  Code flows, but can respond  If interrupted, can attempt to correct  More complicated Coding Basics Dead Reckoning vs. Sensing

30 2008 – 2009 Team Unlimited (FTC # 1)  Time  Dependant on battery life  Useful for squaring on a wall  Can be imprecise  Used often for manipulators  Rotations  Independent of battery life  Useful for replicating a routine repeatedly  Very precise, always the same rotations  Used often for movement Coding Basics Time vs. Rotations

31 2008 – 2009 Team Unlimited (FTC # 1)  Sense the world and react to it  Touch switch is pressed, against something  Ultrasonic rapidly changes, something crossed paths  Light sensor spikes, on a line or off a line  Useful to be able to change course  Code “thinks” for itself  Only as smart as YOU code it! Coding Basics Reacting to the environment

32 2008 – 2009 Team Unlimited (FTC # 1)  Flow from place to place  DON’T JUMP ALL OVER THE PLACE!  Structure the code ahead of time, plan it out  Make things easy to fix  Make your code neat and clean  Plan the code out ahead of time  Don’t haphazardly place code in  Order your code  Do you want an interrupt?  Is there an importance to the steps? Coding Basics Flow of the code

33 2008 – 2009 Team Unlimited (FTC # 1)  Use comments to remind yourself  Often you will forget why something is in the code  Explains to the JUDGES what you were thinking  Allows for easy corrections  Write complete thoughts  “Checks for a touch sensor being pressed, if not, continue”  Use them LIBERALLY Coding Basics Commenting

34 2008 – 2009 Team Unlimited (FTC # 1)  You can never over test the code  Remember! Other robots will be on the field!  Codes can sometimes be “random”  No matter how great your code is, there is are random chances  Not all fields are the same  Just because it worked once, doesn’t mean it will later…  TEST! TEST! TEST! Coding Basics Test! Test! Test!

35 2008 – 2009 Team Unlimited (FTC # 1)  As a group we will “write” a coding outline  You are in the kitchen and you want to make a bowl of cereal. What steps do you need to take in order to get a bowl, milk…..? Exercise time

36 2008 – 2009 Team Unlimited (FTC # 1)  Make sure you are on version 1.46  If not, uninstall RobotC COMPLETELY before installing the newest version  Use the Sample codes included in RobotC  Access by File > Open Sample Programs  Save RobotC files in separate location on Hard Drive  Download and watch coding presentations at Robotics Academy RobotC Basics

37 2008 – 2009 Team Unlimited (FTC # 1)  Open RobotC  Change Menu Level to Expert  Window > Menu Level > Expert  Change Platform to FTC  Robot > Platform Type > FIRST Tech Challenge (NXT)  Close RobotC and Reopen  Open a blank file  File > New  Ctrl + N  Download Firmware to NXT  Robot > Download Firmware (more to come later)  Rename NXT  Robot > Download Firmware (more to come later) Starting up RobotC

38 2008 – 2009 Team Unlimited (FTC # 1) Installing Firmware : Connect NXT

39 2008 – 2009 Team Unlimited (FTC # 1) Installing Firmware : Select NXT Brick

40 2008 – 2009 Team Unlimited (FTC # 1) Installing Firmware : Select the firmware

41 2008 – 2009 Team Unlimited (FTC # 1) Installing Firmware : Download and Complete  Make sure that this message appears before exiting

42 2008 – 2009 Team Unlimited (FTC # 1) Rename NXT

43 2008 – 2009 Team Unlimited (FTC # 1) Name you NXT  Type in the name for your NXT (default is NXT). Recommended name is your team number out to 4 places ( I.e. FTC # 1 is 0001 ). If you have more than one NXT place an A, B, etc. after the number.

44 2008 – 2009 Team Unlimited (FTC # 1) Connecting with Bluetooth – 1  Go to Robot > NXT Brick > Link Setup

45 2008 – 2009 Team Unlimited (FTC # 1) Connection with Bluetooth – 2 & 3 2 ) Make sure that this box is checked to perform a bluetooth search 3) Select here to make a pair between the NXT and your Laptop 3) Select here to make a pair between the NXT and your Laptop

46 2008 – 2009 Team Unlimited (FTC # 1)  Take from the Field Preperation Guide (you can find it here) here  Remember to always do these steps at the Playing Field Bluetooth @ The Competition – 1

47 2008 – 2009 Team Unlimited (FTC # 1) Bluetooth @ The Competition – 2

48 2008 – 2009 Team Unlimited (FTC # 1)  Compile and Download  Compiles and downloads  Compile Program  Compiles locally  Debugger  Scans code for errors  Motor & Sensor Setup  Set up Motor and Sensors  Download firmware  Download firmware to NXT RobotC Menu Robot

49 2008 – 2009 Team Unlimited (FTC # 1)  Link Setup  Used to establish a link between NXT and Computer  Poll Brick  “Online Window”  File Management  Manage files on the NXT  Joystick Control  “FTC Controller Station” RobotC Menu Robot > NXT Brick

50 2008 – 2009 Team Unlimited (FTC # 1) RobotC Debugger  Allows for program control wirelessly  Allows to view where the code is currently  Allows to view errors in your code while running

51 2008 – 2009 Team Unlimited (FTC # 1) RobotC Debugger Button usages  Start/Stop – Starts or Aborts Program  Suspend – Pauses code  Step Into – Pauses code and proceeds to next line  Step Over – Pauses code and skips over next procedure  Step Out - Pauses code and exits procedure  Clear All – Resets all values to default  Refresh Rate  Once – Refreshes values manually  Continuous/Stop – Switch between continuous and stop updating

52 2008 – 2009 Team Unlimited (FTC # 1)  “FTC Controller Station”  Allows control over Teleoperator and Autonomous  Views controller data RobotC Debugger Joystick Control

53 2008 – 2009 Team Unlimited (FTC # 1)  While statement  Performs code as long as the statement is true  I.e. while (ServoValue[Servo1] < 255)  If statement  Performs entirety of code if statement is true  I.e. if (sensorValue[Touch] == 0 )  Else statement  Performs entirety of code if “If Statement” is false  I.e. else RobotC “Loops”

54 2008 – 2009 Team Unlimited (FTC # 1)  Brackets { }  Used to control flow of code  Semicolons ;  Used after lines to denote an end  Square Brackets [ ]  Used for sensors and motor declarations  Parenthesis ()  Used for time and math functions RobotC Puncuation

55 2008 – 2009 Team Unlimited (FTC # 1)  == (Test a condition)  I.e. while (sensorValue[Touch] == 0)  = (equals)  I.e. motor[motorD] = 0;  (less than, greater than)  I.e. if ( -10 < joystick.joy1_y1 < 10 )  || (or)  I.e. if ( joy1Btn(1) || joystick.joy2_TopHat == 0 ) RobotC Operators

56 2008 – 2009 Team Unlimited (FTC # 1)  // TEXT  Comments out a single line of text  /* TEXT */  Comments out all text within the /* and */  /*  Comments out all text after RobotC Commenting

57 2008 – 2009 Team Unlimited (FTC # 1) RobotC Simple Program

58 2008 – 2009 Team Unlimited (FTC # 1)  FTC Template  Joystick Control  DC Drive Motor sample  NXT Motor sample  Servo sample  Touch Sensor sample  Light Sensor sample  Ultrasonic Sensor sample  Compass Sensor sample Sample Code

59 2008 – 2009 Team Unlimited (FTC # 1)  Using the Template (take from here) here Using the FTC Template – 1

60 2008 – 2009 Team Unlimited (FTC # 1) Using the FTC Template – 2

61 2008 – 2009 Team Unlimited (FTC # 1) Using the FTC Template – 3

62 2008 – 2009 Team Unlimited (FTC # 1) Tele-Op Template

63 2008 – 2009 Team Unlimited (FTC # 1) Autonomous Template

64 2008 – 2009 Team Unlimited (FTC # 1) Joystick Control sample

65 2008 – 2009 Team Unlimited (FTC # 1) DC Motor sample

66 2008 – 2009 Team Unlimited (FTC # 1) NXT Motor sample

67 2008 – 2009 Team Unlimited (FTC # 1) Servo sample

68 2008 – 2009 Team Unlimited (FTC # 1) Touch Sensor sample

69 2008 – 2009 Team Unlimited (FTC # 1) Light Sensor sample

70 2008 – 2009 Team Unlimited (FTC # 1) Ultrasonic Sensor sample

71 2008 – 2009 Team Unlimited (FTC # 1) Compass Sensor sample

72 2008 – 2009 Team Unlimited (FTC # 1) Field Diagram

73 2008 – 2009 Team Unlimited (FTC # 1)  RobotC RobotC  RobotC Forums RobotC Forums RobotC Forums  Robotics Academy Robotics Academy Robotics Academy  FTC Function Guide (From Robotics Academy) FTC Function Guide FTC Function Guide  Setting up Dual Template Mode Setting up Dual Template Mode Setting up Dual Template Mode  Field Procedures for Bluetooth Field Procedures for Bluetooth Field Procedures for Bluetooth  Software Information (Links at our website) Software Information Software Information  Code and Software Presentation Code and Software Presentation Code and Software Presentation RobotC Resources

74 2008 – 2009 Team Unlimited (FTC # 1)  RobotC Sample code  Program files > Robotics Academy > RobotC for Mindstorms > Sample Programs > NXT  File > Open Sample Programs (if RobotC is open) RobotC Resources

75 2008 – 2009 Team Unlimited (FTC # 1)  Questions?  Download this presentation and the sample codes from our website:  http://unlimited.syraweb.org/ http://unlimited.syraweb.org/  Feel free to send us an email:  syraweb@syraweb.org syraweb@syraweb.org Questions?


Download ppt "2008 – 2009 Team Unlimited (FTC # 1) Coding for the FIRST Tech Challenge NXT/G, LabVIEW & RobotC compared, and a Crash Course in RobotC Presented by Team."

Similar presentations


Ads by Google