VEX2 Competition
| Line 12: | Line 12: | ||
|In normal ROBOTC programming, every program is based around a “task main” function, as shown below:<br /> | |In normal ROBOTC programming, every program is based around a “task main” function, as shown below:<br /> | ||
| − | <syntaxhighlight lang="ROBOTC"> | + | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="33%" cellpadding="5%" cellspacing="0" border="0" |
| + | |- | ||
| + | |<syntaxhighlight lang="ROBOTC"> | ||
task main() | task main() | ||
{ | { | ||
} | } | ||
| − | </syntaxhighlight><br /> | + | </syntaxhighlight> |
| + | |- | ||
| + | |} | ||
| + | <br /> | ||
In a competition program, things are a little different. To keep things simple, however, a Competition Template program is built into ROBOTC for use in VEX Competitions. The template provides a common starting point for teams when competing in an event. Rather than a single “main” task, the template has three sections, each matched to a specific section of the competition:<br /> | In a competition program, things are a little different. To keep things simple, however, a Competition Template program is built into ROBOTC for use in VEX Competitions. The template provides a common starting point for teams when competing in an event. Rather than a single “main” task, the template has three sections, each matched to a specific section of the competition:<br /> | ||
| Line 54: | Line 59: | ||
|- | |- | ||
|<syntaxhighlight lang="ROBOTC"> | |<syntaxhighlight lang="ROBOTC"> | ||
| − | #pragma competitionControl(Competition ) | + | #pragma competitionControl(Competition) |
| − | #pragma autonomousDuration(20 ) | + | #pragma autonomousDuration(20) |
#pragma userControlDuration(120) | #pragma userControlDuration(120) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 64: | Line 69: | ||
With ROBOTC, the competition control is completely user defined and controlled via software, so there are no jumpers required for testing. By changing these settings, the template can be adapted to work with any competition. The three lines above set the VEX controller into the “competition” mode and specify the timing for the match.<br /> | With ROBOTC, the competition control is completely user defined and controlled via software, so there are no jumpers required for testing. By changing these settings, the template can be adapted to work with any competition. The three lines above set the VEX controller into the “competition” mode and specify the timing for the match.<br /> | ||
| − | <span class="keywordBI">#pragma </span><span class="keywordI">competitionControl(competition_mode)</span> – Controls the Competition mode that the Vex robot will function in. There are two different competition modes that you can pass to this statement:<br /> | + | <span class="keywordBI">#pragma </span><span class="keywordI">competitionControl</span><span class="codePunc">(</span><span class="keywordI">competition_mode</span><span class="codePunc">)</span> – Controls the Competition mode that the Vex robot will function in. There are two different competition modes that you can pass to this statement:<br /> |
*OFF – Standard setting. No competition controls. | *OFF – Standard setting. No competition controls. | ||
Revision as of 11:58, 6 March 2012
In normal ROBOTC programming, every program is based around a “task main” function, as shown below:
In a competition program, things are a little different. To keep things simple, however, a Competition Template program is built into ROBOTC for use in VEX Competitions. The template provides a common starting point for teams when competing in an event. Rather than a single “main” task, the template has three sections, each matched to a specific section of the competition:
The template and its accompanying “include” file handle the background work for the competition, such as monitoring the duration of each phase during a match, and communicating with the Vex Field Controller. All you need to do is tell the robot what to do in each phase. |
|
Open a Competition Template
| To open a competition template:
|
Set Up Competition Control and Timing
With ROBOTC, the competition control is completely user defined and controlled via software, so there are no jumpers required for testing. By changing these settings, the template can be adapted to work with any competition. The three lines above set the VEX controller into the “competition” mode and specify the timing for the match. #pragma competitionControl(competition_mode) – Controls the Competition mode that the Vex robot will function in. There are two different competition modes that you can pass to this statement:
|
