1516X High Stakes 2.0
Codebase for 1516X High Stakes season
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include "main.h"
2
3#include "pros/apix.h"
4
5using namespace Robot;
6using namespace Robot::Globals;
7/*
8 ____ .____________ ____________ ___
9/_ || ____/_ |/ _____/\ \/ /
10 | ||____ \ | / __ \ \ /
11 | |/ \| \ |__\ \ / \
12 |___/______ /|___|\_____ //___/\ \
13 \/ \/ \_/
14
15*/
16
31
33 Robot::selector_screen selector;
34 Robot::status_screen status;
36
44void initialize() {
45 if (pros::c::registry_get_plugged_type(15) == pros::c::E_DEVICE_IMU) {
46 chassis.calibrate();
47 }
48 chassis.setPose(0, 0, 0);
49
50 screen.selector.selector();
51}
52
59void disabled() {}
60
71
86
100void opcontrol() {
101 while (true) {
102 if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_DOWN)) {
103 autonomous();
104 }
105 if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_LEFT)) {
106 std::string name = subsystem.drivetrain.toggleDrive();
107 // Output the current drive mode to the controller screen
108 controller.print(0, 0, name.c_str());
109 }
110
113
114 // Intake controller, uses the X button holded down to push the elevation
115 // up.
117 // Intake controller, moves the left and right intakes and stops them if
118 // nothing is pressed.
119
120 pros::delay(10); // Small delay to reduce CPU usage
121 }
122}
The Autonomous class contains classes and functions related to the robot's autonomous behavior.
Definition auton.h:14
void AutoDrive(Intake &intake, Latch &latch)
Drives the robot autonomously.
Definition auton.cpp:108
Represents the drivetrain of the robot.
Definition drivetrain.h:27
static std::string toggleDrive()
Cycles through each drivetrain control mode.
void run()
Runs the drivetrain.
The Intake class represents a robot intake system.
Definition intake.h:9
void run()
Runs the main function of the intake system.
Definition intake.cpp:15
The Latch class represents a latching mechanism.
Definition latch.h:8
void run()
Runs latching mechanism.
Definition latch.cpp:8
void initialize()
Definition main.cpp:44
struct RobotSubsystems subsystem
void autonomous()
Definition main.cpp:83
void disabled()
Definition main.cpp:59
void competition_initialize()
Definition main.cpp:70
struct RobotScreen screen
void opcontrol()
Definition main.cpp:100
lemlib::Chassis chassis(drivetrain, lateral_controller, angular_controller, sensors, &throttle_curve, &steer_curve)
pros::Controller controller(pros::E_CONTROLLER_MASTER)
Definition auton.h:8
Robot::status_screen status
Definition main.cpp:34
Robot::selector_screen selector
Definition main.cpp:33
Structure that holds instances of all robot subsystems.
Definition main.cpp:25
Robot::Intake intake
Definition main.cpp:28
Robot::Autonomous autonomous
Definition main.cpp:26
Robot::Drivetrain drivetrain
Definition main.cpp:27
Robot::Latch latch
Definition main.cpp:29