diff --git a/CLOUDS/src/main.cpp b/CLOUDS/src/main.cpp index c2fbbf5..a97076d 100644 --- a/CLOUDS/src/main.cpp +++ b/CLOUDS/src/main.cpp @@ -1,93 +1,70 @@ #include "main.h" -/** - * A callback function for LLEMU's center button. - * - * When this callback is fired, it will toggle line 2 of the LCD text between - * "I was pressed!" and nothing. - */ -void on_center_button() { - static bool pressed = false; - pressed = !pressed; - if (pressed) { - pros::lcd::set_text(2, "I was pressed!"); - } else { - pros::lcd::clear_line(2); - } -} +using namespace globals; +using namespace superstruct; + +e_controlsch currentuser = RENU; -/** - * 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::lcd::initialize(); - pros::lcd::set_text(1, "Hello PROS User!"); + ary::printScr(); + pros::delay(500); // Ports config - pros::lcd::register_btn1_cb(on_center_button); + /* + Construct the chassis and it's constants + chassisInit() -> Adjusts drive curves, active brake constants, among other things + configureConstants() -> Sets PID constants on the chassis + configureExitConditions() -> Sets default values for PID Exit conditions + */ + chassisInit(); + configureConstants(); + configureExitConditions(); + + /* + Add autonomous paths to the auto selection + */ + ary::autonselector::auton_selector.add_autons({ + Auton("Far side \n\nFar from alliance goal", near_side), + Auton("Far side (far from alliance goal) \n\nTo run when far from alliance GOAL", far_side), + Auton("Skills \n\ncloudabunga ", skills) + }); + + motorsCoast(); + + chassis.initialize(); + ary::autonselector::initialize(); } -/** - * 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 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() {} -/** - * 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() {} +void autonomous() { + autonomousResets(); + ary::autonselector::auton_selector.call_selected_auton(); +} -/** - * 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() { - pros::Controller master(pros::E_CONTROLLER_MASTER); - pros::Motor left_mtr(1); - pros::Motor right_mtr(2); + disableActiveBrake(); + opControlInit(); // Configure the chassis for driver control - while (true) { - pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2, - (pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1, - (pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0); - int left = master.get_analog(ANALOG_LEFT_Y); - int right = master.get_analog(ANALOG_RIGHT_Y); + while (true) { + /* + Handle controls for whoever is driving the bot at the moment, each available user a respective set of controls + Available Options: + RENU, RIA, CHRIS + */ + if (currentuser == RENU) { + chassis.tank_control(); + renu_control(); + } else if (currentuser == RIA) { + chassis.tank_control(); + renu_control(); + } else if (currentuser == CHRIS) { + chassis.arcade_standard(ary::SINGLE, ary::DEFAULT); + chris_control(); + } else { + renu_control(); + } - left_mtr = left; - right_mtr = right; - - pros::delay(20); + pros::delay(ary::util::DELAY_TIME); } }