Skip to content

Instantly share code, notes, and snippets.

@theol0403
Last active August 20, 2019 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theol0403/944f6e69ce19835b0a743b00b9ba2e3a to your computer and use it in GitHub Desktop.
Save theol0403/944f6e69ce19835b0a743b00b9ba2e3a to your computer and use it in GitHub Desktop.
7842F Merged Competition Template
#include "main.h"
static bool isCompetition = false; //will be toggled when autonomous is run
/***
* _____ _ _ _ _ _
* |_ _| (_) | (_) | (_)
* | | _ __ _| |_ _ __ _| |_ _______
* | || '_ \| | __| |/ _` | | |_ / _ \
* _| || | | | | |_| | (_| | | |/ / __/
* \___/_| |_|_|\__|_|\__,_|_|_/___\___|
* Runs initialization code. This occurs as soon as the program is started.
*
* All other competition modes are blocked by initialize; it is recommended
* to keep execution time for this mode under a few seconds.
*/
void initialize() {
pros::delay(500); //Give the legacy ports time to start up
initializeBase();
initializeDevices();
}
/***
* _____ _____ _ _
* / __ \ |_ _| (_) |
* | / \/ ___ _ __ ___ _ __ ______| | _ __ _| |_
* | | / _ \| '_ ` _ \| '_ \______| || '_ \| | __|
* | \__/\ (_) | | | | | | |_) | _| || | | | | |_
* \____/\___/|_| |_| |_| .__/ \___/_| |_|_|\__|
* |_|
* Runs after initialize(), and before autonomous when connected to the Field
* Management System or the VEX Competition Switch. This is intended for
* competition-specific initialization routines, such as an autonomous selector
* on the LCD.
*
* This task will exit when the robot is enabled and autonomous or opcontrol
* starts.
*/
void competition_initialize() {
isCompetition = true;
}
/***
* ______ _ _ _ _
* | _ (_) | | | | | |
* | | | |_ ___ __ _| |__ | | ___ __| |
* | | | | / __|/ _` | '_ \| |/ _ \/ _` |
* | |/ /| \__ \ (_| | |_) | | __/ (_| |
* |___/ |_|___/\__,_|_.__/|_|\___|\__,_|
* Runs while the robot is in the disabled state of Field Management System or
* the VEX Competition Switch, following either autonomous or opcontrol. When
* the robot is enabled, this task will exit.
*/
void disabled() {}
/***
* _ _ _ _
* | | | | | | | |
* | | | |___ ___ _ __ ___ ___ _ __ | |_ _ __ ___ | |
* | | | / __|/ _ \ '__/ __/ _ \| '_ \| __| '__/ _ \| |
* | |_| \__ \ __/ | | (_| (_) | | | | |_| | | (_) | |
* \___/|___/\___|_| \___\___/|_| |_|\__|_| \___/|_|
* Runs the operator control code. This function will be started in its own task
* with the default priority and stack size whenever the robot is enabled via
* the Field Management System or the VEX Competition Switch in the operator
* control mode.
*
* If no competition control is connected, this function will run immediately
* following initialize().
*
* If the robot is disabled or communications is lost, the
* operator control task will be stopped. Re-enabling the robot will restart the
* task, not resume it from where it left off.
*/
void opcontrol() {
while(true) {
driverControl();
pros::delay(10);
}
}
/***
* ___ _
* / _ \ | |
* / /_\ \_ _| |_ ___
* | _ | | | | __/ _ \
* | | | | |_| | || (_) |
* \_| |_/\__,_|\__\___/
* Runs the user autonomous code. This function will be started in its own task
* with the default priority and stack size whenever the robot is enabled via
* the Field Management System or the VEX Competition Switch in the autonomous
* mode. Alternatively, this function may be called in initialize or opcontrol
* for non-competition testing purposes.
*
* If the robot is disabled or communications is lost, the autonomous task
* will be stopped. Re-enabling the robot will restart the task, not re-start it
* from where it left off.
*/
void autonomous() {
isCompetition = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment