As a Team 4501, out of Oklahoma. We have always used another programming format. But I want to move to RobotC (that’s what we use in class, with Virtual Worlds and GTT curriculum). We can program autonomous using RobotC, And we can program Remote Control using RobotC. But we are missing the ever so small code combination to be able to program the autonomous AND then switch to remote control during a VRC competition…
My best suggestion in this case is to open a new competition template (which can be done through the File -> New -> Competition Template menu option in ROBOTC) and copy your existing code into it. There are three main parts to the Competition Template:
void pre_auton():
This is where you want to put all of your pre-match, non-movement code (clearing encoder values, calibrating gyro sensors, etc). This code should not move the robot outside of the legal starting position, and should only contain pre-match code. You can also set the ‘bStopTasksBetweenModes’ flag to false in order to allow user-created tasks to continue running between the different stages (pre-auton, autonomous, and user control) of the match. If you do so, please note that you will be responsible for any tasks that continue to run in the background.
task autonomous():
This is where you want to pot all of your autonomous code. You will want to make sure that you stop the robot manually at the end of your autonomous run, as this will ensure that the robot comes to a complete stop if there is time remaining in the autonomous portion of the match. Once you have code inside of this task, make sure to remove the ‘AutonomousCodePlaceholderForTesting();’ line of code.
task usercontrol():
This is where you want to put your user control code (generally inside of the infinite ‘while(true)’ loop to ensure that the code repeats itself until the end of the Tele-Op portion of the match). You will also want to remove the ‘UserControlCodePlaceholderForTesting();’ line of code once you have custom code to put in its place.
Please let me know if you have any other questions about this, and I will be more than happy to answer them for you.