TETRIX FTC Templates
From ROBOTC API Guide
(→Autonomous Template) |
(→User Control Template) |
||
| (6 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | <yambe:breadcrumb>TETRIX|TETRIX</yambe:breadcrumb> | + | <yambe:breadcrumb self="FTC Templates">TETRIX|TETRIX</yambe:breadcrumb> |
| + | <br /> | ||
| + | |||
| + | {{tl|1|}} | ||
| + | <br /> | ||
== FTC Templates== | == FTC Templates== | ||
{| | {| | ||
|- | |- | ||
| − | | ROBOTC has built-in FTC templates that can be used to quickly and easily program a robot for both the autonomous and tele-op (remote control) portions of a competition. To open a template through ROBOTC, navigate to the File menu and select "New". There are three options under this menu: | + | | ROBOTC has built-in FTC templates that can be used to quickly and easily program a robot for both the autonomous and tele-op (remote control) portions of a competition. To open a template through ROBOTC, navigate to the File menu and select "New". There are three options under this menu (for FTC competitions we want to focus on the latter two options, Autonomous Template and User Control Template): |
| − | <ul><li>New File - Creates a blank ROBOTC file.</li> | + | <ul><li><em>New File</em> - Creates a blank ROBOTC file.</li> |
| − | <li>Autonomous Template - Creates a FTC Autonomous Template (used for the autonomous portion of the competition.</li> | + | <li><STRONG>Autonomous Template</STRONG> - Creates a FTC Autonomous Template (used for the autonomous portion of the competition).</li> |
| − | <li>User Control Template - Creates a FTC User Control Template (used for the | + | <li><STRONG>User Control Template</STRONG> - Creates a FTC User Control Template (used for the user control (tele-op) portion of the competition).</li></ul> |
|- | |- | ||
| − | |||
|} | |} | ||
| Line 34: | Line 37: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| + | |} | ||
| + | |||
| + | == User Control Template == | ||
| + | {| | ||
| + | |- | ||
| + | |The User Control Template is exactly the same as the Autonomous template with one small (but crucial) difference. Inside of the User Control Template's task main() there is a infinite loop that all the User Control code should go inside of. This loop allows user control code to run until the FCS stops the match. | ||
| + | <syntaxhighlight lang="ROBOTC"> | ||
| + | task main() | ||
| + | { | ||
| + | initializeRobot(); | ||
| + | |||
| + | waitForStart(); | ||
| + | |||
| + | while(true) | ||
| + | { | ||
| + | //User Control code goes here. | ||
| + | } | ||
| + | } | ||
| + | </syntaxhighlight> | ||
|} | |} | ||
<br /> | <br /> | ||
Latest revision as of 12:17, 20 November 2012
TETRIX → FTC Templates
|
FTC Templates
ROBOTC has built-in FTC templates that can be used to quickly and easily program a robot for both the autonomous and tele-op (remote control) portions of a competition. To open a template through ROBOTC, navigate to the File menu and select "New". There are three options under this menu (for FTC competitions we want to focus on the latter two options, Autonomous Template and User Control Template):
|
Autonomous Template
User Control Template
The User Control Template is exactly the same as the Autonomous template with one small (but crucial) difference. Inside of the User Control Template's task main() there is a infinite loop that all the User Control code should go inside of. This loop allows user control code to run until the FCS stops the match.
task main() { initializeRobot(); waitForStart(); while(true) { //User Control code goes here. } } |
