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
5
using namespace
Robot
;
6
using namespace
Robot::Globals
;
7
/*
8
____ .____________ ____________ ___
9
/_ || ____/_ |/ _____/\ \/ /
10
| ||____ \ | / __ \ \ /
11
| |/ \| \ |__\ \ / \
12
|___/______ /|___|\_____ //___/\ \
13
\/ \/ \_/
14
15
*/
16
25
struct
RobotSubsystems
{
26
Robot::Autonomous
autonomous
;
27
Robot::Drivetrain
drivetrain
;
28
Robot::Intake
intake
;
29
Robot::Latch
latch
;
30
}
subsystem
;
31
32
struct
RobotScreen
{
33
Robot::selector_screen
selector
;
34
Robot::status_screen
status
;
35
}
screen
;
36
44
void
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
59
void
disabled
() {}
60
70
void
competition_initialize
() {}
71
83
void
autonomous
() {
84
subsystem
.
autonomous
.
AutoDrive
(
subsystem
.
intake
,
subsystem
.
latch
);
85
}
86
100
void
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
111
subsystem
.
drivetrain
.
run
();
112
subsystem
.
latch
.
run
();
113
114
// Intake controller, uses the X button holded down to push the elevation
115
// up.
116
subsystem
.
intake
.
run
();
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
}
Robot::Autonomous
The Autonomous class contains classes and functions related to the robot's autonomous behavior.
Definition
auton.h:14
Robot::Autonomous::AutoDrive
void AutoDrive(Intake &intake, Latch &latch)
Drives the robot autonomously.
Definition
auton.cpp:108
Robot::Drivetrain
Represents the drivetrain of the robot.
Definition
drivetrain.h:27
Robot::Drivetrain::toggleDrive
static std::string toggleDrive()
Cycles through each drivetrain control mode.
Definition
drivetrain.cpp:64
Robot::Drivetrain::run
void run()
Runs the drivetrain.
Definition
drivetrain.cpp:48
Robot::Intake
The Intake class represents a robot intake system.
Definition
intake.h:9
Robot::Intake::run
void run()
Runs the main function of the intake system.
Definition
intake.cpp:15
Robot::Latch
The Latch class represents a latching mechanism.
Definition
latch.h:8
Robot::Latch::run
void run()
Runs latching mechanism.
Definition
latch.cpp:8
initialize
void initialize()
Definition
main.cpp:44
subsystem
struct RobotSubsystems subsystem
autonomous
void autonomous()
Definition
main.cpp:83
disabled
void disabled()
Definition
main.cpp:59
competition_initialize
void competition_initialize()
Definition
main.cpp:70
screen
struct RobotScreen screen
opcontrol
void opcontrol()
Definition
main.cpp:100
Robot::Globals
Definition
globals.cpp:17
Robot::Globals::chassis
lemlib::Chassis chassis(drivetrain, lateral_controller, angular_controller, sensors, &throttle_curve, &steer_curve)
Robot::Globals::controller
pros::Controller controller(pros::E_CONTROLLER_MASTER)
Robot
Definition
auton.h:8
RobotScreen
Definition
main.cpp:32
RobotScreen::status
Robot::status_screen status
Definition
main.cpp:34
RobotScreen::selector
Robot::selector_screen selector
Definition
main.cpp:33
RobotSubsystems
Structure that holds instances of all robot subsystems.
Definition
main.cpp:25
RobotSubsystems::intake
Robot::Intake intake
Definition
main.cpp:28
RobotSubsystems::autonomous
Robot::Autonomous autonomous
Definition
main.cpp:26
RobotSubsystems::drivetrain
Robot::Drivetrain drivetrain
Definition
main.cpp:27
RobotSubsystems::latch
Robot::Latch latch
Definition
main.cpp:29
src
main.cpp
Generated on Fri Sep 13 2024 21:52:12 for 1516X High Stakes by
1.12.0