2015 Andrew Dahlen andrew.dahlen@northlandcollege.edu VEX Robotics A Primer 2015 HI-TEC Conference Workshop July 27 th 2015 Portland Oregon
Background VEX Robotics Overview 360 VEX Robotics Competition in Minnesota
VEX Robotics Competition Largest and Fastest Growing Robotics Competition in the world More than 12,000 teams from 32 countries playing in over 1000 tournaments
VEX Robotics websites http://www.robotevents.com/ Search for and sign up for events in your area http://www.vexrobotics.com/ Purchase VEX Robotics Equipment. http://www.roboticseducation.org/ Tons of information about running events, scholarships, and grants.
VEX robotics team details Description: 5 to 10 student members meet before or after school with a coach. Students work to design and build a single robot to compete in the VEX Robotics Competition. Dates: The competition is released in April and teams may start work right away. Most teams begin their season at the start of the next school year, and continue through December and January. A few teams advance to the National or World Championship in April. Weekly time Commitment: 2-6 Hours per week. Computer Requirements: One PC or MAC needed to program the robot. A laptop is recommended for portable programming at events.
VRC Team Budget Recommendations Budgets will vary greatly on the number of events attended. Teams are encouraged to fundraise or seek sponsorships to offset expenses. Coach Stipends are encouraged for the sustainability of the program Amount Description $100 Team Registration (VEX Robotics) $200 Tournament Registration Fee ($100 per tournament) $1500 Coach Stipend $1500 VEX Robotics Equipment (Much of this will be re-used annually), Teams build an inventory of equipment and select components which complement the current season challenge. $1000 Transportation to tournaments and scrimmages $4300 Total
http://www.360mn.org/ 360 is a consortium of 15 institutions led by Bemidji State University and includes 14 technical and community colleges. The center is a member of the Minnesota State Colleges and Universities system and received a National Science Foundation grant in 2012 to become an Advanced Technological Education Regional Center.
360 wants to: Interest students in manufacturing careers Show the youth & influencers career opportunities available in today s manufacturing Improve youth s confidence in STEM skills
Why VEX Robotics? There are several great robotics programs available. 360 has worked with VEX Robotics because: Teams can work on their robots year-round Robotics kits are cost-effective (a starter kit is around $1,200) and can be used multiple years Project Lead the Way uses VEX Robotics in their curriculum It is designed to be a student-led activity It offers opportunities to participate from elementary school through college
360 VEX Robotics Competitions in Minnesota Season Competition Number of MN Teams Number of MN Tournaments 2010-2011 Roundup 8 1 unofficial 2011-2012 Gateway 30* 2 2012-2013 Sack Attack 45* 4 2013-2014 Toss Up 66* 4 2014-2015 Skyrise 98* 5 2015-2015 Nothing But Net 150** 12** * Estimated numbers ** Projected numbers
STEM Outreach & Recruitment Expose youth to technology concepts Mechanics Programming Motor Control Sensors Troubleshooting Team work
2013-2014 Wilder Research Highlights Survey of Adults and Youth Youth reported greater knowledge, skills, and confidence in STEM and manufacturing content, and particularly in problem-solving and working by trial and error Youth and adults reported more favorable opinions of STEM and Manufacturing Careers after completing the program
Robot C Basics Initial Setup Firmware Motors and Sensor Setup New Programs
About this workshop This workshop is designed to showcase Robot C software, VEX Robotics Equipment, and the VEX Robotics Competition. It is not practical to teach c programming in a four hour workshop. To learn more about Robot C : Reference the built-in help guide in robot C. Evaluate the sample programs provided in robot C Reference the Robot C forums
Check Robot C For Updates Robot C has frequent software updates. Use most recent version.
Change Platform Type Robot C for VEX Robotics Supports VEX IQ and VEX 2.0 Cortex VEX IQ is designed for a younger audience - grade school VEX 2.0 Cortex is designed for middle school to college age students
Cortex and Joystick Firmware Using the Orange USB programming cable, connect the Cortex to the PC The PC may take a few moments to install drivers. Watch the windows taskbar to see if the drivers installed successfully.
Download Firmware Firmware for the Cortex and Joystick need to be updated with new versions of Robot C
Firmware up to date
Radio Firmware Occasionally the VEXnet Keys also need Firmware updates http://www.vexrobotics.com/wiki/software_downloads
Update the VEXnet Radio Firmware Open the VEXnet Key 2.0 Update Utility Insert the VEXnet Radio into the USB Port
Tethering Cortex with Joystick Connect Joystick and Cortex with orange USB Cable Power up both the Joystick and Cortex This pairs the Cortex and Joystick like connecting a Bluetooth device to a phone
VEXnet Keys After tethering (pairing), install the VEXnet keys into the Cortex and Joystick Power up both the Joystick and Cortex The VEXnet Radio keys allow wireless communication between the Joystick and Cortex
Programming options USB Cable: Programs can be downloaded from the PC to Cortex directly with the USB Programming Cable. This involves disconnecting the VEXnet Keys Inserting the USB Cable Downloading the program Re-installing the VEXnet Keys Programming Hardware Kit Eliminate Constant VEXnet Key removal and insertion Supports live, wireless debugging
Rename the Robot Rename the robot to Stop the error messages after downloading a program
Creating a New Program Recommend using the Competition Template for all new programs Competition template used to execute the autonomous and driver control for VEX Robotics Competition Matches
Parts of the Competition Template pre_aton() Pre autonomous This section is seldom modified by VRC Teams
Autonomous Task The first 15 seconds of a VRC match is autonomous. The Robots drive themselves. Preprogrammed instructions Heavy use of sensors for navigation feedback
Motors and Sensors Setup Configure what is plugged into the motor, analog, digital, and I2C Ports
Clawbot Motors and Sensors Setup This code is automatically generated with the motors and sensors setup
Programming Example Basic Joystick Control
User Control Insert user control program between the curly brackets following the while (true) structure
Joystick Control: Analog Thumb Sticks The two thumb sticks are known as analogs They generate a -127 to 127 value for each channel. In the central or neutral position the value will be zero.
Motor Commands Motor speeds are also set by a -127 to 127 values. Examples: Caution: Never program a motor speed outside the - 127 to 127 range. Doing so results errors in motor speed values: 128 is 0 129 is -127-128 is 128-129 is 128
Joystick Control of motors The range of motor and joystick values is the same: -127 to 127 Programming the motor for thumb stick control is as easy as:
Joystick Buttons Joystick buttons are discrete: on or off The VEX Joystick has four groups of buttons. Buttons are programmed using if or while structures. Example:
Debugging windows Debugger Windows: Test Motor operation See sensor values Watch variables in real time
Test Motors with the Motors Debugger Window Program must be stopped Enter a power value between 127 and -127
Debug Sensor Window Provides live sensor values Useful in writing code involving sensor feedback
Programming Example Navigation with encoders
Navigation with encoders Quadrature encoders Encoders measure rotations As the wheels rotate forward the encoder value increments If the encoder value direction can be easily changed by swapping the two encoder wire ports.
Encoder: User Defined Functions Functions are used when a section of code repeats multiple times. In the encoders example program, functions make it easier to program the robot to a reach a specific destination.
Example User Defined Function
Encoders and the debug window While driving the robot, Programmers can watch the sensor debug window. As the robot is driven with the joystick in simple maneuvers (straight, pivot, left and right) programmers can manually write down the encoder values. Clear the encoder values after each simple move. Create a program which repeats each move
Programming Example Line Following
Line Following Introduction Line Following Sensor Infrared LED and receiver in one unit. Position 1/8 above floor / line for best results Sensor values range between 0 and 4096 Many variables including: Sensor distance from floor Floor and tape reflectivity
Line Following: Watching the line Left line sensor > right then: Right wheels full speed ahead Slow down left wheels Right line senor > left then: Left wheels full speed ahead Slow down right wheels Right line Sensor = left then Left and right wheels full speed ahead
Line Following: Record Line values Record the line following sensor values on and off the line. Store these values into program variables.
Line Following: Proportional Control Motor control values are -127 to 127 Scale line following sensor values to motor speed range 0 to 127 Base motor control speeds on line follower sensor values
Example: Scaling line following values: On the line sensor value = 2500 Off the line sensor value = 150 Motor range is 0 to 127 (forward motion only) Scaling math: (2500-150)/127 = 18.5
Example: Adjusting motor speeds Left Sensor is fully on-the-line = 2500 Slow down the left motor Left motor speed = 127 ((2500 150) / 18.5) Where 127 = max motor speed 2500 = left line follower sensor value 150 = off the line value 18.5 = scale factor
Code for line following
Ultrasonic Sensor Emits a high pitch chirp (inaudible) Measures time for chirp to be heard by the receiver Calculates distance based on this time. Robot C ultrasonic values can be set to inches, centimeters, millimeters, or raw values in the motors and sensors setup.
Ultrasonic Sensor Code:
Programming Example Proportional Arm Control
Potentiometer Feedback Potentiometer is a variable resistor Used on Light dimmer switches and volume control knobs Also useful for position feedback in robots Up to 250 of rotation
Multitasking Tasks can be used to split the processors attention Reference Robot C help for more info. starttask command given inside the usercontrol task. Program will split its time between these two tasks
The pidarmcontrol task Runs parallel to usercontrol task Includes different ways to set the arm position Preset buttons on channel 7 of joystick Variable position based on channel 6 of joystick
Preset arm position Press buttons on channel 7 to move arm specific location Arm will stay in that position.
Variable Position Buttons 5U and 5D move arm to any position. When buttons are released arm stays in position
Proportional Control Programming method for reaching and maintaining the position of an arm or lifting mechanism. Everyday example : Cruise control in an automobile maintains speed. Requires sensor feedback. Motors power is adjusted in the code to maintain the arms location.
Proportional Code: Arm Motor power is a function of how far the potentiometer sensor value is from the target variable Watch the motor debugger window while manually moving the arm. Motor power values adjust to maintain target position.
Andrew Dahlen VEX Robotics Coordinator Electronics Technology Automated Systems Instructor Northland Community and Technical College 1101 Hwy One East Thief River Falls MN 56701 218-683-8673 andrew.dahlen@northlandcollege.edu 218-683-8673 Thank you. Aaron Barker VEX Robotics Coordinator Director of Business and Industry Alignment St Cloud Technical & Community College 1540 Northway Drive St Cloud, MN 56303-1240 320.308.6518 abarker@sctcc.edu