VEX2 Competition
(→Set Up Competition Control and Timing) |
|||
| Line 72: | Line 72: | ||
<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 /> | <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. | + | *<span class="keywordI">OFF</span> – Standard setting. No competition controls. |
| − | *Competition – Competition mode. The VEX will respond to Field Controller commands and switch between Autonomous and User Control modes at the competition-specified times. Use this mode for competitions. | + | *<span class="keywordI">Competition</span> – Competition mode. The VEX will respond to Field Controller commands and switch between Autonomous and User Control modes at the competition-specified times. Use this mode for competitions. |
<span class="keywordBI">#pragma </span><span class="keywordI">autonomousDuration</span><span class="codePunc">(</span><span class="keywordI">time_in_seconds</span><span class="codePunc">)</span> - Defines the duration of the autonomous phase of a VEX competition. Poor performance may result if this setting does not match the Field Controller settings.<br /> | <span class="keywordBI">#pragma </span><span class="keywordI">autonomousDuration</span><span class="codePunc">(</span><span class="keywordI">time_in_seconds</span><span class="codePunc">)</span> - Defines the duration of the autonomous phase of a VEX competition. Poor performance may result if this setting does not match the Field Controller settings.<br /> | ||
Revision as of 12:06, 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
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:
#pragma autonomousDuration(time_in_seconds) - Defines the duration of the autonomous phase of a VEX competition. Poor performance may result if this setting does not match the Field Controller settings. #pragma userControlDuration(time_in_seconds) - Defines the duration of the user control phase of a VEX competition. Poor performance may result if this setting does not match the Field Controller settings.
|
