Programming instructions
ROBOTC
ROBOTC Programming - Competition Templates • 3
©
2011 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems
ROBOTC Programming Competition Templates (cont.)
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
Setting up Competition Control and Timing
InROBOTC,competitionprogrammingiscompletelyusercustomizable,sonojumpersare
requiredfortesting.Byadjustingthefollowingcommands,thetemplatescanbeadaptedto
workinanyVEXsupportedcompetition.
#pragma competitionControl(competition_mode)-Controlsthecompetitionmodethat
theVEXisin.Therearetwodifferentcompetitionmodesthatyoucanpass:
OFF-Nocompetitioncontrol.
Competition-TheVEXwillrespondtoeldcontrolcommandsandswitchbetween
AutonomousandUserControlmodesatthecompetition-speciedtimes.Usethismodefor
competitions.
#pragma autonomousDuration(time_in_seconds)-
DenesthedurationoftheautonomousphaseofaVEXcompetitionforVEXPICrobotsusingthe75
MHzcrystals.TousethecompetitiontemplateinaUserControl-onlycompetition,youcansetthe
durationtozero.Thislinecanbedeletedorcommented-outifyouareusingtheVEXCortexoraVEX1.5
(VEXnetUpgradedPIC)basedrobot.
#pragma userControlDuration(time_in_seconds)-
DenesthedurationoftheusercontrolphaseofaVEXcompetitionforrobotsusingthe75MHzcrystals.
TousethecompetitiontemplateinanAutonomous-onlycompetition,youcansetthedurationto
zero.Thislinecanbedeletedorcommented-outifyouareusingtheVEXCortexoraVEX1.5(VEXnet
UpgradedPIC)basedrobot.
Forrobotsusingthe75MHzcrystals,theusercontroldurationcanbeincreasedbeyondtheactual
lengthoftheroundtocompensateforanypossibledelaysinthesystem.Forexample,changing
userControlDuration(120) to userControlDuration(180) wouldensurethattherobot
remainsactiveuntiltheFieldControlsystemendstheusercontrolperiod.
ThedurationsofVEXCortexandVEX1.5basedrobotsaredeterminedsolelybytheFieldControl
system.WhenprogrammingVEXCortexorVEX1.5basedrobots,soyoucancomment-outor
deletetheautonomousDuration()anduserControlDuration()pragmastatements.
Important Information - Timing Tips
VEX ROBOTICS COMPETITION