ART v1.0-alpha
A Robot Template that raises the floor for VRC teams
Loading...
Searching...
No Matches
main.cpp File Reference

Source containing the main function and competition functions such as auton and usercontrol. More...

#include "vex.h"
#include "robotConfig.h"
#include "Art\ART.h"

Go to the source code of this file.

Functions

void pre_auton (void)
 Runs after robot is powered on and before autonomous or usercontrol.
 
void autonomous (void)
 Runs the Autonomous Task.
 
void usercontrol (void)
 Runs the User Control Task.
 
int main ()
 Sets up Competition Tasks and runs pre_auton.
 

Variables

vex::competition Competition
 A global instance of competition.
 

Detailed Description

Source containing the main function and competition functions such as auton and usercontrol.

Author
Jath Alison (Jath..nosp@m.Alis.nosp@m.on@gm.nosp@m.ail..nosp@m.com)
Version
1.0-beta
Date
06-25-2024

This file is where the competition code is really running. All the Code for the autonomous and usercontrol periods should be here as well as the set-up during pre_auton.

Definition in file main.cpp.

Function Documentation

◆ autonomous()

void autonomous ( void )

Runs the Autonomous Task.

This task is used to control your robot during the autonomous phase of a VEX Competition. You must modify the code to add your own robot specific commands here.

Code here will run once and be stopped automatically when autonomous ends. It is not guaranteed that the end of the function will be reached and if the end is reached, the program will wait till the end of the autonomous period without calling the function again.

Definition at line 59 of file main.cpp.

◆ main()

int main ( )

Sets up Competition Tasks and runs pre_auton.

All code is run from here, but you rarely need to add any code here. Main sets up the competition tasks and calls pre_auton before allowing them to run. Other than that, main just waits for either autonomous or usercontrol to start by running an infinite loop.

If you really want, code that needs to run once can be placed at the start of main, but it is recommended you do that in pre_auton instead.

Returns
int (doesn't actually return anything)

Definition at line 103 of file main.cpp.

◆ pre_auton()

void pre_auton ( void )

Runs after robot is powered on and before autonomous or usercontrol.

You may want to perform some actions before the competition starts. Do them in the following function. You must return from this function or the autonomous and usercontrol tasks will not be started. This function is only called once after the V5 has been powered on and not every time that the robot is disabled.

Here, perform All activities that occur before the competition starts Example: clearing encoders, setting servo positions, ...

Definition at line 42 of file main.cpp.

◆ usercontrol()

void usercontrol ( void )

Runs the User Control Task.

This task is used to control your robot during the user control phase of a VEX Competition. You must modify the code to add your own robot specific commands here.

Code outside the loop will run once and can be used to configure the robot to a starting state. Things like setting pneumatics to specific positions or setting default values.

Code inside the loop will run continuously until the usercontrol period ends. Here, you should use values from the controller(s) to update the robot.

A 20 millisecond sleep is included to prevent wasted resources while repeating the loop.

Definition at line 81 of file main.cpp.

Variable Documentation

◆ Competition

vex::competition Competition

A global instance of competition.

This object takes care of running the different Competition Tasks when commands are recived from the field control.

Definition at line 27 of file main.cpp.