1516X Push Back 1.0
1516X's robot code for the 2025-2026 VEX Robotics Competition
Loading...
Searching...
No Matches
main.cpp File Reference
#include "main.h"
#include "globals.h"
#include "pros/misc.h"
#include "autonRoutines.h"
#include "lemlib/api.hpp"
#include "lemlib/util.hpp"

Go to the source code of this file.

Functions

void auton2 ()
 
void auton3 ()
 
rd::Selector selector ({ {"Red Right", red_right}, {"Test auton 2", auton2}, {"Test auton 3", auton3}, })
 
void initialize ()
 
void disabled ()
 
void competition_initialize ()
 
void autonomous ()
 
void opcontrol ()
 

Variables

rd::Console console
 

Function Documentation

◆ auton2()

void auton2 ( )

Definition at line 10 of file main.cpp.

11{
12 chassis.turnToHeading(90, 1000);
13}
lemlib::Chassis chassis

References chassis.

Referenced by selector().

◆ auton3()

void auton3 ( )

Definition at line 15 of file main.cpp.

16{
17 chassis.moveToPoint(0, -12, 1000);
18}

References chassis.

Referenced by selector().

◆ autonomous()

void autonomous ( )

Definition at line 52 of file main.cpp.

52 {
53 selector.run_auton();
54}
rd::Selector selector({ {"Red Right", red_right}, {"Test auton 2", auton2}, {"Test auton 3", auton3}, })

References selector().

◆ competition_initialize()

void competition_initialize ( )

Definition at line 48 of file main.cpp.

48 {
49
50}

◆ disabled()

void disabled ( )

Definition at line 44 of file main.cpp.

44 {
45 selector.focus();
46}

References selector().

◆ initialize()

void initialize ( )

Definition at line 30 of file main.cpp.

30 {
31 chassis.calibrate();
32 agitator.set_voltage_limit(6500);
33 pros::Task screen_task([&]() {
34 while (true) {
35 lemlib::Pose pose = chassis.getPose();
36 console.printf("X: %f\n", pose.x);
37 console.printf("Y: %f\n", pose.y);
38 console.printf("Theta: %f\n", pose.theta);
39 pros::delay(20);
40 }
41 });
42}
pros::Motor agitator(16, pros::v5::MotorGears::green)
rd::Console console
Definition main.cpp:27

References agitator(), chassis, and console.

◆ opcontrol()

void opcontrol ( )

Definition at line 56 of file main.cpp.

56 {
57 while(true)
58 {
59 double y = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);
60 double x = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X);
61 chassis.curvature(y, x, false);
62
63 /*
64 double right = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);
65 double left = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);
66 chassis.tank(left, right, false);
67 */
68
69 //R1 - outake long goal
70 if(controller.get_digital(pros::E_CONTROLLER_DIGITAL_R1))
71 {
72 midMotor.move_voltage(-12000);
73 agitator.move_voltage(-6500);
74 intakeMotor.move_voltage(12000);
75
76 }
77 else if(controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2))
78 {
79 //R2 - Bottom goal
80 midMotor.move_voltage(12000);
81 agitator.move_voltage(-6500);
82 intakeMotor.move_voltage(-12000);
83
84 }
85 else if(controller.get_digital(pros::E_CONTROLLER_DIGITAL_L1))
86 {
87 //Intake
88 if(midRollerHeight.is_extended())
89 {
90 midRollerHeight.retract();
91 }
92 agitator.brake();
93 intakeMotor.move_voltage(12000);
94 topRoller.retract();
95 midMotor.move_voltage(-12000);
96
97 }
98 else if(controller.get_digital(pros::E_CONTROLLER_DIGITAL_L2))
99 {
100 agitator.move_voltage(-6500);
101 intakeMotor.move_voltage(12000);
102 midMotor.move_voltage(12000);
103 }
104 else if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_LEFT))
105 {
106 aligner.toggle();
107 }
108 else if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_RIGHT))
109 {
110 matchload_mech.toggle();
111 }
112 else if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_X))
113 {
114 topRoller.toggle();
115 }
116 else {
117 intakeMotor.brake();
118 agitator.brake();
119 midMotor.brake();
120 if(!midRollerHeight.is_extended())
121 {
122 midRollerHeight.extend();
123 }
124 }
125 pros::delay(20);
126 }
127}
pros::Motor midMotor(20)
pros::Motor intakeMotor(6)
pros::adi::Pneumatics topRoller('B', false)
pros::adi::Pneumatics matchload_mech('D', false)
pros::adi::Pneumatics aligner('C', true)
pros::adi::Pneumatics midRollerHeight('A', true)
pros::Controller controller

References agitator(), aligner(), chassis, controller, intakeMotor(), matchload_mech(), midMotor(), midRollerHeight(), and topRoller().

◆ selector()

rd::Selector selector ( { {"Red Right", red_right}, {"Test auton 2", auton2}, {"Test auton 3", auton3}, } )

References auton2(), auton3(), and red_right().

Referenced by autonomous(), and disabled().

Variable Documentation

◆ console

rd::Console console

Definition at line 27 of file main.cpp.

Referenced by initialize().