PLTW CALIFORNIA STATE CONFERENCE FEBRUARY 19, 2015 COLIN SMITH COLIN_SMITH@KHSD.K12.CA.US CENTENNIAL...

Post on 20-Jan-2016

219 views 0 download

Transcript of PLTW CALIFORNIA STATE CONFERENCE FEBRUARY 19, 2015 COLIN SMITH COLIN_SMITH@KHSD.K12.CA.US CENTENNIAL...

PLTW CALIFORNIA STATE CONFERENCEFEBRUARY 19, 2015

COLIN SMITHCOLIN_SMITH@KHSD.K12.CA.US

CENTENNIAL HIGH SCHOOLBAKERSFIELD, CA

Advanced RobotC Programming Topics

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

• 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

Code – traditional motor control

Proportional Lift

Additional Resources

• www.vexforum.com• www.robotc.net/education/training/vex/• www.robotc.net/forums/• www.robotc.net/support/webhelpfiles/• www.youtube.com