PLTW CALIFORNIA STATE CONFERENCE CENTENNIAL HIGH SCHOOL Taking RobotC Programming to the Next Level PLTW CALIFORNIA STATE CONFERENCE January 26, 2016 COLIN SMITH COLIN_SMITH@KHSD.K12.CA.US CENTENNIAL HIGH SCHOOL BAKERSFIELD, CA
Motivation Allow more advanced programmers to explore further options Differentiated Instruction for Machine Control unit in Principles of Engineering More variety in Project 3.3.1 Increase 'pool' of potential VRC students Allow increased training for VRC students
Outline vexNet and VEX remote Multitasking Motor Speed calculation PID Control Loops
vexNET Requires pairing of cortex with a remote Can use a usb or the vexNET wireless keys Adds 8 channels with 12 digital buttons and 4 'analog' inputs Includes a built in accelerometer Allows additional user input to control robot function Can be used just like any other inputs
Pairing
Sensor vs. Remote
Example: ClawBot
Multi-Tasking Limitations of Linear programming Users must be careful with what control structures are being used. Adding tasks to control different motors/sensors Sensors can be shared, motors shouldn't
Implementing Multitasking Works like function declaration Task can be started or stopped within main() using the StartTask or StopTask functions.
continued Finally, the task must be defined
Use of Multi-tasking Materials sorter Emergency shutoff Allows multiple actions to occur ‘simultaneously’ Materials sorter Emergency shutoff StopAllTasks function
Proportional Control Use variables for iterative control of motor speeds Sensors are required for continuous input A target value is set and is used to control the speed of the motor(s)
Error Inside a loop, the ‘distance’ to the target is used to determine the speed of the motor. This distance to target is often referred to as the error
Proportionality Instead of a 1:1 ratio between the error and the motor speed, there is often a proportionality constant used to ‘tune’ the response of the motor.
Tuning the Proportionality constant
Integral Sometimes tuning the Proportional term makes it so you do not reach your target, but have an offset. The integral term allows you to adjust the value to reach the specified target. The error is summed (integrated).
Proportional Integrated Control The motorspeed is determined by the proportional and integrated terms. Because the error is generally large at first, the integrated constant is much smaller.
Derivative To control how quickly the control loop reacts to change, you can look at how much the error is changing (derivative).
PID Control The three terms can all be added together to create a responsive standard of motor control
Velocity Calculation
PID Velocity Control
Putting it Together
Additional Resources www.vexforum.com www.robotc.net/education/training/vex/ www.robotc.net/forums/ www.robotc.net/support/webhelpfiles/ www.team7983.com www.youtube.com
PLTW CALIFORNIA STATE CONFERENCE CENTENNIAL HIGH SCHOOL Taking RobotC Programming to the Next Level PLTW CALIFORNIA STATE CONFERENCE January 26, 2016 COLIN SMITH COLIN_SMITH@KHSD.K12.CA.US CENTENNIAL HIGH SCHOOL BAKERSFIELD, CA