ROBOTC for VEX On-Site Professional Development
Advanced Remote Control
Advanced Remote Control More loop control please? Is remote controlling the robot forever always appropriate? Next Challenge: Mine Removal Challenge Question: Where would the wait statement go if we wanted the robot to be remote controlled for a controlled amount of time? Answer: Nowhere! We need something else. Solution: Timers Can be thought of as internal stopwatches (4 available) Like encoders, timers should be “cleared” anytime before they are used Watch where you clear them!
Timers
Advanced Remote Control Wasting Time? The time it takes to turn on the VEX and get situated could be used to score points, but is wasted. Could we make the robot wait to start it’s timer until we were ready? Any ideas? Wait for a Remote Control Button press The robot won’t start the timer until we say so The robot also can’t move until we says so Program Flow Trace Could this idea also be used to make a “more friendly” start button on a non-radio controlled robot? Other ideas of how to improve remote control? Use the buttons to initiate common actions Turn 90 degrees, move straight forward, ect
Advanced Remote Control Use the buttons to control the arm The VEXnet Remote Control buttons send values of 0 or 1
Sensing
Sensor Information: Touch Sensors
Touch Sensors Touch Sensor Check How they work Setting them up Limit Switch plugged into Digital Port 6 Bumper Switch plugged into Digital Port 11 How they work Digital sensor - Pressed or Released Watch out for “bouncing” Setting them up ROBOTC Motors and Sensors Setup window Using them The SensorValue[] command
Move Forward until Pressed
Touch Sensors Start Button Remember how we used the Remote Control button to start the timer portion of the program. How would we implement the same thing with the bumper switch?
Sensor Information: Potentiometer
Potentiometers Potentiometer Check How they work Setting them up Plugged into Analog Port 3 How they work Analog sensor Measures absolute rotation of a shaft between 0 and ~265 degrees Returns values 0 – ~4095 Internal mechanical stops Setting them up ROBOTC Motors and Sensors Setup window Using Analog and Digital Sensors Using them The SensorValue[] command
Potentiometers
Advanced Arm Control
Sensor Information Ultrasonic Rangefinder
The Ultrasonic Rangefinder Ultrasonic Rangefinder Check Input wire plugged into Digital Port 8 Output wire plugged into Digital Port 9 How they work Similar to how bats and submarines work Digital sensor – but returns distance values in inches, centimeters, or millimeters on the Cortex Setting them up ROBOTC Motors and Sensors Setup window Using them Be careful not to use them immediately as your program starts – they take time to initialize and will return negative values The SensorValue[] command
Ultrasonic Rangefinder Other Properties The Ultrasonic Rangefinder is able to detect objects in a “cone” field of view. As objects get further away, the sensor is able to detect them further away from the center of the sensor. The sensor bases distance calculations off of sound waves, which means that some objects may not be detectable: soft objects that absorb sound, sharp objects that deflect sound, etc. Do not use the ultrasonic sensor as the very first command in your code. Until the first sound echo returns to the sensor, it will have a value of -1. A simple delay at the beginning of your program solves this.
Forward until Near
The Ultrasonic Rangefinder Forward until Near Move forward until the robot is “near” an object, then stop Automatic Pick-up Straight Forward until Near + picking up the mine Optional: Assign to a button on the Remote Control
The Ultrasonic Rangefinder Forward/Straight until Near Move straight forward until the robot is near an object, then stop Follow along with videos in VCVT Automatic Pick-up Straight Forward until Near + picking up the mine Optional: Assign to a button on the Remote Control
VEX Robotics Competition Programming
VEX Robotics Competitions Official VEX Competitions utilize special Field Control Hardware to enable and disable robots
Competition Templates ROBOTC is fully legal in VEX Competitions You must program using the built-in templates Competition Template Driver Skills Template
Competition Template Pre-autonomous code goes here – clear encoders, ect Autonomous code goes here Remote Control code goes here
Testing Competition Code The ROBOTC Competition Control Debug Window simulates the Field Control Hardware, so you can test your code
Additional Sensors
Sensor Activities Finish the Automatic Pickup Behavior Add code to automatically score the ball Quick-Tap Challenge Review Sensing Videos With a Virtual Robot: Sensing > Robocci Sensing > Speed of Sound Sensing > Robo-Dunk 2