Programming instructions

ROBOTC
ROBOTC Programming - Competition Templates 8
©
2011 Carnegie Mellon Robotics Academy / For use with VEX Robotics Systems
ShownbelowarethecontentsoftheDriverSkills.clewithbriefdescriptions,butwiththecomments
removedandadditionalspacingadded.AdditionaldetailscanbefoundinPart Iofthisdocument.
#pragma platform(VEX)
#pragma competitionControl(Competition)
#pragma autonomousDuration(0)
#pragma userControlDuration(60)
#include “Vex_Competition_Includes.c”
void pre_autonomous()
{
//Place pre-autonomous code here
}
task autonomous()
{
//Leave this section alone
AutonomousCodePlaceholderForTesting();
}
task usercontrol()
{
while(true)
{
//Place user control code here
UserControlCodePlaceholderForTesting();
motor[port2] = vexRT[Ch1];
motor[port3] = vexRT[Ch4];
}
}
Thesepragmastatementsspecifythe
durationoftheautonomousandusercontrol
portionsofthecompetition(0and60second
defaults)forVEXPICbasedrobotsusingthe
75MHzCrystals.
Ifyourrobotisusingthe75MHzcrystals,
doNOTremovetheselinesofcode.Ifyou
areusingaVEXCortexorVEX1.5(VEXnet
UpgradedPIC)basedrobot,youcan
commenttheselinesoutordeletethem.
Anyinitializationcode,suchassetting
servopositionsorclearingencoder
valuescanbeplacedwithinthe
pre_autonomous()function.
Theautonomous taskcanbeignoredwhen
programmingforaDriverSkillscompetition,
butdoNOTdeleteit.
Allcodefortheusercontrolportionofthe
competitionshouldbeplacedwithinthewhile()
loopoftheusercontrol task.Thewhile()loop
repeatsallcommandswithinitscurlybrackets
forthedurationoftheusercontrolportionofthe
competition,ensuringthattheremotecontrol
valuessenttotherobotarecontinuallyupdated.
Thepre-existingcodewithintheloopcan
bereplacedwithyourowncode.The
UserControlCodePlaceholderForTesting
functionshouldalsoberemoved.
ROBOTC Programming Competition Templates (cont.)
VEX ROBOTICS COMPETITION