1.34k likes | 1.61k Vues
ROBOT C for VEX On-Site Professional Development. Lab Procedures. Logging onto computers Log in with: teachers / teachers1 VEX Robots/chargers Make sure during breaks, lunches and end of day to charge your robot Headsets
E N D
Lab Procedures • Logging onto computers • Log in with: teachers / teachers1 • VEX Robots/chargers • Make sure during breaks, lunches and end of day to charge your robot • Headsets • Each workstation has two headsets to allow both partners to watch the videos at the same time • Teacher folders and journals
ROBOTC this Week • There are several versions of ROBOTC on your desktops • This class we will use ROBOTC 3.0 Beta as much as possible
Discussion • What is a robot? • What can you teach with a robot? • Journaling
VEX 0.5 PIC Testbed • Features: • VEX PIC • 2 Motors • Servo Motor • Ultrasonic Rangefinder • Potentiometer • Ambient Light Sensor • Line Tracking Sensor • Limit Switch • Bumper Switch • RF Receiver • LED
VEX 0.5 PIC Overview • Coordinates the flow of information and power on the robot • All electronic components interface with the microcontroller • 8 Motor Ports • 16 Analog/Digital Ports for Sensors • Rx1 and Rx2 Ports for Radio Control
Background Information • ROBOTC is developed specifically with teachers, classrooms, and competitions in mind • Complete programming solution for the VEX PIC, VEX Cortex, and several other popular robot platforms • Approved for VEX Robotics, BEST, TSA and RoboFest Competitions! • Only programming language for the VEX PIC and VEX Cortex with a real-time debugger • You’ll learn more about this feature later on • Very similar to industry-standard C programming • Students get real-world programming experience
Industry Standard Coding Students that learn ROBOTC Programming are also learning key components of Industry Standard Programming Languages...
Industry Standard IDE Students programming in the ROBOTC IDE are also learning how to use features in Industry Standard IDE’s...
Platform Type Allows you to toggle ROBOTC’s programming mode between the VEX PIC and VEX Cortex, will enable features and commands for the system
ROBOTC Start Page Displays the latest ROBOTC news, version of ROBOTC, and ROBOTC Resources
Sample Programs Over 75 Included ROBOTC Sample programs, organized by robot behavior
Comments • Comments are used to make notes in code for the human programmers • Every sample program contains comments pertaining to robot configuration, ROBOTC commands, robot behavior, etc • // Single line comment – everything after “//” is ignored by the ROBOTC compiler • /* Multi-line comment*/ - everything between the “/*” and “*/” symbols is ignored by the ROBOTC compiler
ROBOTC Help In-depth explanations about the ROBOTC interface, commands, debugger, etc
Function Library Lists the available functions, with a description. List of available functions will expand or shrink depending on the “Menu Level”
Menu Level Customizes the ROBOTC interface and Function Library based on the user’s experience level
Motors and Sensor Setup • One central place to configure and name all of the motors and sensors attached to your Cortex
Teaching ROBOTC for IFI VEX Robots (TRC4V) • 40 tutorial videos • 275 pages of printable guides aligned to the videos • 50 pages of supplementary “helper guides” • 35 programming challenges • Freely available at www.robotc.net
Student-Paced Instruction • Everyone learns different things at different paces • Everyone MUST move at a different pace • Going too fast results in failure and frustration • Going too slow results in loss of attention (i.e. future failure) • TRC4V can be used as a teaching aid • One instructor can’t teach at 20 different paces simultaneously • One instructor plus 20 computers can
Downloading Firmware • What is Firmware? • Step 1: Download Master Firmware • Step 2: Download ROBOTC Firmware • Step 3: Power-cycle the VEX
ROBOTC Natural Language • Goal is to lower the barrier of entry into syntax-based programming by simplifying the code and using more “natural” command names • Lines of code for common robot behaviors are consolidated into single commands • forward(); • lineTrackforTime(); • stop(); • untilBump();
ROBOTC Natural Language • The Natural Language is an additional Platform Type in ROBOTC:
ROBOT Motion • Commands that cause the entire robot to perform a behavior
Setup • Allows you to specify what type of robot configuration you have from pre-specified models (RECBOT, Swervebot)
Movement • Commands that allow you to control individual motors / servos
Special • Commands that control the more unique VEX Hardware – LED’s and Flashlights
Until • Commands that allow you to create behaviors where the robot acts “until” a certain event • Button Press • Encoder Count Reached
Wait • Commands that wait for an elapsed amount of time in seconds or milliseconds
VEX Motors • 3 Main Types: • Original 3-wire motor • Newer 2-wire motor 269 • Newer 2-wire motor 393 • All motors are programmedthe same way in ROBOTC • Accept values between 127 (full forward) and -127 (full reverse)
Motor 2 for 5 Seconds Displays configuration changes from the Motors and Sensors Setup Defines the “main task” of the robot All commands belonging to task main must be in-between these curly braces
Motor 2 for 5 Seconds Turns the port2 rightMotor on at half power forward
Motor 2 for 5 Seconds Causes the robot to wait here in the program for 5.0 seconds
Motor 2 for 5 Seconds Stops the port2 rightMotor. End Result: rightMotor spins for 5.0 seconds.
Quick ROBOTC Exercise • Create this program yourself and download it to the Robot • Using the Program Debug Window
Renaming and Reversing • Robot > Motors and Sensors Setup • Optional with Motors (not Sensors) • Giving Motors custom names • Reversing motor polarity
Naming Rules • The Motors and Sensor Setup window allows you to give your motors and sensors custom names. The names, however: • Should be descriptive of the sensor or motor they refer to (rightMotor, frontBumper, ect.) • Must be all one word made up of letters, numbers, and underscores • Must contain no special characters (&, $, /, ect.) • Cannot already be a ROBOTC reserved word (task, motor, true)
Quick ROBOTC Exercise • Make Changes to the Program • Turn on leftMotor • Download and watch result • Reverse both motors • Download and watch result
Motor Exercises • Turn the rightMotor on forward at full speed for 6 seconds, then stop. • Turn the leftMotor on in reverse at three-fourths speed for 2.5 seconds, then stop. • Turn both motors on at half power for 3 seconds, stop for two seconds, reverse at half power for 3 seconds, then stop.