ROBOTC for VEX Online Professional Development Instructor: Jesse Flot
Welcome Tech Check Tools VEX Hardware Basic Movement Program Planning ROBOTC Natural Language
Tech Check
Tech Check Voice communication Screen sharing Introduce yourself Checkmark yourself Screen sharing DEMO: Starting ROBOTC LAB: Show your ROBOTC
What can you teach with a robot? Type your thoughts in the space below
Tools
Tools CS2NLearn - The Learning Management System (LMS) Logging in, and where to post homework Three Main Pieces of Software 1. WebEX 2. ROBOTC Application 3. ROBOTC Curriculum / Tutorial Videos
Tools The Forums Class Forum for announcements and asking questions can be found under the Announcements and Information section: http://www.robotc.net/forums/ Active ROBOTC Community
Hardware Overview
VEX 2.0 Cortex Overview Coordinates the flow of information and power on the robot All electronic components interface with the Cortex 10 Motor Ports 8 Analog Sensor Ports 12 Digital Sensor Ports VEXnet Wireless I2C and UART Ports
RECBOT 2 Driving Motors 1 Arm Motor 2 Quadrature Encoders 1 Potentiometer 1 Touch Sensor 1 Ultrasonic Rangefinder 1 Gyroscope
Squarebot and Swervebot These robot models will work, too, with some small adaptations:
ROBOTC Overview
Background Information ROBOTC is developed specifically with teachers, classrooms, and competitions in mind Complete programming solution for the VEX Cortex, VEX IQ, VEX PIC, and several other popular robot platforms (with simulations!) Only programming language for the VEX Cortex and VEX IQ with a real-time debugger Quickly see motor and sensor values, troubleshoot issues Very similar to industry-standard C programming Students get real-world programming experience Trainer Notes: The next few slides are meant to highlight features in ROBOTC that will help trainees succeed as they program and answer their own questions.
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...
VEX Cortex Video Trainer using ROBOTC
Trainer notes: Feel free to lean heavily on these videos Trainer notes: Feel free to lean heavily on these videos. They do a decent job of breaking down the code and explaining behaviors, freeing you up to help troubleshoot. It’s highly recommended that you watch these together using your presentation computer and speakers, rather than having each attendee watch them individually – too much noise for anything to be intelligible.
VEX Cortex Video Trainer (VCVT) 50+ tutorial videos teach step-by-step how to program using ROBOTC and the Cortex 100+ pages of supplementary “helper guides” 40+ 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) VCVT can be used as a teaching aid One instructor can’t teach at 20 different paces simultaneously One instructor plus 20 computers can
VEX Cortex Video Trainer (VCVT) 60 tutorial videos teach step-by-step how to program using ROBOTC and the Cortex 100+ pages of supplementary “helper guides” 40+ programming challenges Freely available at www.robotc.net Direct link to the video trainer: http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/index.html
VEX Cortex System Configuration
Platform Type Make sure to configure ROBOTC to work with the Cortex!
Compiler Target Make sure your Compiler Target is set to “Physical Robot”. Show this in ROBOTC IDE.
VEX Cortex Communication Mode Allows you to specify: How programs are downloaded Whether the Cortex looks for a VEXnet connection when it starts up With “VEXnet or USB” the Cortex will look for a VEXnet connection before running code Trainer Notes: You can have attendees switch to “USB Only”, but you will have to remember to have them switch back before doing any wireless programming or remote control programs.
VEX Cortex Microcontroller The Cortex has two processors that are responsible for different tasks Master Processor: VEXnet communication, low-level motor control User Processor: Interpret ROBOTC Programs Each processor has software called “firmware” that allows it to perform its tasks Trainer Notes: Quick overview of the system, for new trainees.
Activity: Download Firmware Step 1: Choose Appropriate Platform Type Step 2: Update Master and ROBOTC Firmware
ROBOTC Programming
Motor Port 3 Forward Defines the “main task” of the robot All commands belonging to task main must be in-between these curly braces
Motor Port 3 Forward Turns the port3 motor on at full power forward
Motor Port 3 Forward End Result: robot spins one motor for 3 seconds Robot stays here in the program for 3000 milliseconds End Result: robot spins one motor for 3 seconds
Get Your Motors Running Motor Check Right Motor is plugged into MOTORS 2 Left Motor is plugged into MOTORS 3 Download Sample Program File > Open Sample Program > Training Samples > Motor Port 3 Forward Run the Sample Program What does it do? How could we make the robot move forward?
Renaming and Reversing Robot > Motors and Sensors Setup Optional with Motors 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)
Basic Movements Forward / Reverse
Basic Movements Point Turns
Basic Movements Swing Turns
Basic Movements Manual Adjustments
ROBOTC “Natural Language”
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
Wait Commands that wait for an elapsed amount of time in seconds or milliseconds
Setup Allows you to specify what type of robot configuration you have from pre-specified models (RECBOT, Swervebot)
Sample Programs
Moving Forward and Backward
Quick ROBOTC Exercise Use the Natural Language commands to create a program that: Turns on leftMotor and rightMotor at ¾ speed for 5 seconds Download and watch result Reverse both motors at ¼ speed for 5 seconds Trainer Notes: This slide is meant to be a class activity, for trainees to actually get some guided experience with the ROBOTC interface, ROBOTC Commands, Cortex system, ect. The steps should be: Open ROBOTC Verify the Platform Type is set to Cortex Natural Language Library Create the Program Connect the Cortex to the Computer (via USB or VEXnet) Turn on the Cortex Go to Robot > Compile and Download Program Run the program – Observe the testbed Turn on leftMotor in the program, after rightMotor and before the wait command (left motor should also be turned off after the wait command). Compile and Download the Program Run the Program – observe the testbed Reverse the motor powers for both motors Download and run the program – observe the motors spinning in the other direction.
Coming Soon! Graphical Mode All of the Natural Language commands have been converted into drag-and-droppable blocks No more “syntax” mistakes or typos for new programmers
Program Planning Trainer Notes: The following slides detail program planning. At this point the Program Planning doc can be distributed or referenced during the training. All group exercises should follow the program planning steps to get in the habit of following it.
Behavior Based Programming A behavior is anything your robot does: turning on a single motor, moving forward, tracking a line, navigating a maze Three main types of behaviors: basic behaviors – single commands to the robot (turn on a motor) simple behaviors – simple task performed by the robot (move forward, track a line) and complex behaviors – robot performs a complex task (solve the maze) Complex behaviors can always be broken down into simple behaviors, which are then broken down into basic behaviors Trainer notes: Supplementary printouts found in the Fundamentals > Introduction to Programming section can be printed and handed outs.
The Labyrinth Challenge Trainer Notes: Introduce the Labyrinth challenge as a possible programming challenge. Additional challenge description / schematic can be found in the VEX Cortex Video Trainer > Movement > Challenge Description Section. This can be printed and handed out, if desired. The Labyrinth was chosen for this example because it allows for a very simple, visual representation of the topics. Things like the PLTW Material Sorter could also be discussed, as that would resonate well with the PLTW network.
The Labyrinth Challenge Trainer notes: this is the path the robot will have to take to complete the labyrinth, broken down from a complex behavior, into simple behaviors
Programming Discussion The Challenge: The Labyrinth The Solution: ??? The Programmer’s (your) Role Understanding Program Flow and Behavior Based Programming Plan out the robot’s path / actions - Pseudocoding Translate the Pseudocode into real code The Robot’s role To carry out your instructions! The Solution: Programmer and Robot working together, fulfilling their roles True for all robotic challenges!
Pseudocode Pseudocode is a shorthand notation for programming which uses informal programming structures (if touch1 is pressed…) verbal descriptions of code (move forward, stop) Emphasis is placed on expressing the behavior or outcome of each portion of code rather than on correct syntax (it should be reasonable, though). Your lines of Pseudocode should also be listed in the same order as they will appear in the ROBOTC Program
Pseudocode Sample Pseudocode:
Pseudocode Additional Details: Pseudocode is used to outline a program before translating it into proper syntax. Helps in the initial planning of a program, by creating the logical framework and sequence of the code. An additional benefit is that it can be translated into different programming languages and is therefore somewhat universal.
Putting it all Together Effective Program Planning is essential to writing correct code. Carrying out that plan is equally important! Once you have your plan, don’t try to implement it all at once! Systematically add sections of code, testing at every step!
ROBOTC Rules/Syntax Syntax is the cause of 80% of programming errors… Most important thing to do when troubleshooting: Check Syntax Missing Semicolons Incorrect Braces on Structures Misspelled words Improper ‘case’ – motor vs. MoToR ROBOTC is friendly about most of these errors... but can’t catch everything.
Labyrinth Challenge Begin programming for the Labyrinth Challenge! Use Standard ROBOTC or the Natural Language Remember to Pseudocode the Behaviors first!
Homework! Homework assignments can always be found and turned-in on CS2NLearn You’ll also be expected to watch a series of videos for review Optional practice quizzes will prepare you for the certification exam at the end
Overview
What are ? RVWs are simulation environments that run virtual robots programmed in ROBOTC.
Why RVW (Initially)? Many classrooms don’t have enough robots for students Very few students have robots at home to do homework or make up missed classwork The Robot Virtual Worlds Project tackles both of these problems by allowing students to program virtual robots using the same ROBOTC Software VEX and LEGO Versions Available Every version of ROBOTC 3.x comes with a free 60-day trial! Free licenses available on CS2N for individual student use!
Why RVW (Now)? Research between the Carnegie Mellon University Robotics Academy and the Learning Research and Development Center at the University of Pittsburgh shows that learning to program in a simulated environment is actually more effective than with physical robots!
Why RVW (Now)? continued… Programming with a simulated robot greatly reduces wasted class time Very little time spent getting ready for class Robots automatically reset to their start location No broken motors, sensors, gears, etc. No low batteries in the robot or joysticks Debugger information is always readily available Flot, J., Lui, A., Schunn, C., Shoop, R. (November 2012). Learning How to Program via Robot Simulation. Robot Magazine, 68-70.
RVW Solutions Classroom Environments Competition Environments Curriculum Companion Tables Level Builder Competition Environments VEX Skyrise VEX IQ Highrise Themed / Game Environments Ruins of Atlantis Operation Reset Palm Island
Classroom Environments
ROBOTC Curriculum Step-by-step tutorial videos teach students how to program using motors, sensors and remote control Practice challenges allow students to apply what they’ve learned
Curriculum Companion All of the practice tables found in the free ROBOTC Curriculum but in a virtual environment Students follow along with the tutorials and go through the practice challenges, but with virtual robots Every student in a classroom can learn to program, even at home!
Virtual Robots Virtual robots emulate their real-world counterparts Several robots available, based off of models used in curriculum Have working light sensors, encoders, touch sensors, ultrasonic sensors, compass sensors and motors Still communicate with the ROBOTC Debugger!
Achievements / Badges As students complete challenges, they earn badges similar to modern games Designed to motivate them, engage them in CS activities long-term Badges are also displayed on CS2N.org, allowing teachers and parents to track progress
Tracking Progress CS2N.org also allows teachers to create “Groups” with their students RVW Challenge Completion and Quiz scores are all presented in convenient, easy-to-understand format
Using Robot Virtual Wolds Switch Robot > Compiler Target to Virtual Worlds Choose Window > Menu Level > Select Virtual World to Use > Curriculum Companion Compile and Download a Program to Launch the Virtual World
Logging In Log In via CS2N, Local, or use a Guest Session (progress will not be saved)
Robot Selection Choose from multiple robots. View robot dimensions and configurations.
Challenge Selection Choose between challenges. Open the challenge PDF. View available Achievements. Press START ACTIVITY to launch challenge.