diff --git a/EZ-Template-Example-Project/include/main.h b/EZ-Template-Example-Project/include/main.h index a57785d..987e2f2 100644 --- a/EZ-Template-Example-Project/include/main.h +++ b/EZ-Template-Example-Project/include/main.h @@ -45,6 +45,8 @@ // More includes here... #include "autons.hpp" +#include "subsystems.hpp" + /** * If you find doing pros::Motor() to be tedious and you'd prefer just to do diff --git a/EZ-Template-Example-Project/include/subsystems.hpp b/EZ-Template-Example-Project/include/subsystems.hpp new file mode 100644 index 0000000..404e241 --- /dev/null +++ b/EZ-Template-Example-Project/include/subsystems.hpp @@ -0,0 +1,8 @@ +#pragma once + +#include "api.h" + +// Your motors, sensors, etc. should go here. Below are examples + +// inline pros::Motor intake(1); +// inline pros::adi::DigitalIn limit_switch('A'); \ No newline at end of file diff --git a/EZ-Template-Example-Project/src/autons.cpp b/EZ-Template-Example-Project/src/autons.cpp index f2ed242..82a25b0 100644 --- a/EZ-Template-Example-Project/src/autons.cpp +++ b/EZ-Template-Example-Project/src/autons.cpp @@ -1,7 +1,7 @@ #include "main.h" ///// -// For installation, upgrading, documentations and tutorials, check out our website! +// For installation, upgrading, documentations, and tutorials, check out our website! // https://ez-robotics.github.io/EZ-Template/ ///// @@ -144,7 +144,7 @@ void motion_chaining() { // This works by exiting while the robot is still moving a little bit. // To use this, replace pid_wait with pid_wait_quick_chain. chassis.pid_drive_set(24_in, DRIVE_SPEED, true); - chassis.pid_wait_quick_chain(); + chassis.pid_wait(); chassis.pid_turn_set(45_deg, TURN_SPEED); chassis.pid_wait_quick_chain(); diff --git a/EZ-Template-Example-Project/src/main.cpp b/EZ-Template-Example-Project/src/main.cpp index 6500afb..176091e 100644 --- a/EZ-Template-Example-Project/src/main.cpp +++ b/EZ-Template-Example-Project/src/main.cpp @@ -1,7 +1,7 @@ #include "main.h" ///// -// For installation, upgrading, documentations and tutorials, check out our website! +// For installation, upgrading, documentations, and tutorials, check out our website! // https://ez-robotics.github.io/EZ-Template/ ///// @@ -29,15 +29,15 @@ void initialize() { // Configure your chassis controls chassis.opcontrol_curve_buttons_toggle(true); // Enables modifying the controller curve with buttons on the joysticks - chassis.opcontrol_drive_activebrake_set(0); // Sets the active brake kP. We recommend 2. + chassis.opcontrol_drive_activebrake_set(0); // Sets the active brake kP. We recommend ~2. 0 will disable. chassis.opcontrol_curve_default_set(0, 0); // Defaults for curve. If using tank, only the first parameter is used. (Comment this line out if you have an SD card!) // Set the drive to your own constants from autons.cpp! default_constants(); // These are already defaulted to these buttons, but you can change the left/right curve buttons here! - // chassis.opcontrol_curve_buttons_left_set (pros::E_CONTROLLER_DIGITAL_LEFT, pros::E_CONTROLLER_DIGITAL_RIGHT); // If using tank, only the left side is used. - // chassis.opcontrol_curve_buttons_right_set(pros::E_CONTROLLER_DIGITAL_Y, pros::E_CONTROLLER_DIGITAL_A); + // chassis.opcontrol_curve_buttons_left_set(pros::E_CONTROLLER_DIGITAL_LEFT, pros::E_CONTROLLER_DIGITAL_RIGHT); // If using tank, only the left side is used. + // chassis.opcontrol_curve_buttons_right_set(pros::E_CONTROLLER_DIGITAL_Y, pros::E_CONTROLLER_DIGITAL_A); // Autonomous Selector using LLEMU ez::as::auton_selector.autons_add({ @@ -114,7 +114,9 @@ void autonomous() { */ void opcontrol() { // This is preference to what you like to drive on - chassis.drive_brake_set(MOTOR_BRAKE_COAST); + pros::motor_brake_mode_e_t driver_preference_brake = MOTOR_BRAKE_COAST; + + chassis.drive_brake_set(driver_preference_brake); while (true) { // PID Tuner @@ -128,17 +130,19 @@ void opcontrol() { chassis.pid_tuner_toggle(); // Trigger the selected autonomous routine - if (master.get_digital_new_press(DIGITAL_B) && master.get_digital(DIGITAL_DOWN)) + if (master.get_digital(DIGITAL_B) && master.get_digital(DIGITAL_DOWN)) { autonomous(); + chassis.drive_brake_set(driver_preference_brake); + } chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate } chassis.opcontrol_tank(); // Tank control - // chassis.opcontrol_arcade_standard(ez::SPLIT); // Standard split arcade - // chassis.opcontrol_arcade_standard(ez::SINGLE); // Standard single arcade - // chassis.opcontrol_arcade_flipped(ez::SPLIT); // Flipped split arcade - // chassis.opcontrol_arcade_flipped(ez::SINGLE); // Flipped single arcade + // chassis.opcontrol_arcade_standard(ez::SPLIT); // Standard split arcade + // chassis.opcontrol_arcade_standard(ez::SINGLE); // Standard single arcade + // chassis.opcontrol_arcade_flipped(ez::SPLIT); // Flipped split arcade + // chassis.opcontrol_arcade_flipped(ez::SINGLE); // Flipped single arcade // . . . // Put more user control code here! @@ -146,4 +150,4 @@ void opcontrol() { pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME } -} +} \ No newline at end of file