1516X Push Back 1.0
1516X's robot code for the 2025-2026 VEX Robotics Competition
Loading...
Searching...
No Matches
globals.cpp File Reference
#include "globals.h"
#include "pros/distance.hpp"
#include "lemlib/chassis/chassis.hpp"
#include "pros/adi.hpp"
#include "pros/optical.hpp"
#include "pros/vision.hpp"
#include "colorSort.h"
#include "IntakeAntiJam.h"
#include "Chassis.h"

Go to the source code of this file.

Functions

pros::Controller controller (pros::E_CONTROLLER_MASTER)
pros::MotorGroup rightMotors ({17, 19, -18}, pros::MotorGears::blue)
pros::MotorGroup leftMotors ({-12, 13, -14}, pros::MotorGears::blue)
pros::Imu imu (16)
pros::Rotation horizontal_tracking_sensor (-15)
pros::Rotation vertical_tracking_sensor (9)
lemlib::ControllerSettings lateral_controller (lateralKP, lateralKI, lateralKD, 3, 1, 50, 3, 200, 0)
lemlib::ControllerSettings angular_controller (angularKP, angularKI, angularKD, 3, 1, 50, 3, 100, 0)
lemlib::ExpoDriveCurve throttle_curve (10, 20, 1.012)
lemlib::ExpoDriveCurve steer_curve (10, 20, 1)
Chassis chassis (drivebase, lateral_controller, angular_controller, sensors, &throttle_curve, &steer_curve)
pros::Motor intakeMotor (-1, pros::v5::MotorGears::blue)
pros::Motor storageMotor (2, pros::v5::MotorGears::blue)
pros::Motor outtakeMotor (3, pros::MotorGears::blue)
pros::Distance rightDistance (6)
pros::Distance leftDistance (5)
pros::Distance frontDistance (8)
pros::Distance backDistance (7)
pros::adi::Pneumatics intake_lift ('A', false)
pros::adi::Pneumatics hood ('B', false)
pros::adi::Pneumatics matchloader ('C', false)
pros::adi::Pneumatics descore ('D', true)
pros::adi::Pneumatics mid_descore ('E', false)
pros::Optical color_sensor (10)
pros::Vision vision_sensor (18)
IntakeAntiJam jamManager (intakeMotor, outtakeMotor, storageMotor, 55)

Variables

lemlib::Drivetrain drivebase & leftMotors
const float horizontal_offset = (-1.18588887482 -1.2351177609)/2
const float vertical_offset = (-0.414862637269 + 0.0661399466844)/2
lemlib::TrackingWheel horizontal_tracking_wheel & horizontal_tracking_sensor
lemlib::TrackingWheel vertical_tracking_wheelvertical_tracking_sensor
lemlib::OdomSensors sensors & vertical_tracking_wheel
const float lateralKP = 9
const float lateralKI = 0.001
const float lateralKD = 72
const float angularKP = 3.07
const float angularKI = 0.0015
const float angularKD = 26.5
Color allianceColor = Color::RED
bool color_sort_enable = false
bool midgoal_first = false
int ramp_up_time = 0
int low_ramp_down_time = 0
bool antiJamEnabled = false
bool liveReplay = false

Function Documentation

◆ angular_controller()

lemlib::ControllerSettings angular_controller ( angularKP ,
angularKI ,
angularKD ,
3 ,
1 ,
50 ,
3 ,
100 ,
0  )

References angularKD, angularKI, and angularKP.

Referenced by chassis().

◆ backDistance()

◆ chassis()

◆ color_sensor()

pros::Optical color_sensor ( 10 )

Referenced by get_color().

◆ controller()

pros::Controller controller ( pros::E_CONTROLLER_MASTER )

◆ descore()

pros::adi::Pneumatics descore ( 'D' ,
true  )

◆ frontDistance()

◆ hood()

pros::adi::Pneumatics hood ( 'B' ,
false  )

◆ horizontal_tracking_sensor()

pros::Rotation horizontal_tracking_sensor ( - 15)

◆ imu()

pros::Imu imu ( 16 )

Referenced by crossBarrier(), and opcontrol().

◆ intake_lift()

pros::adi::Pneumatics intake_lift ( 'A' ,
false  )

◆ intakeMotor()

pros::Motor intakeMotor ( - 1,
pros::v5::MotorGears::blue  )

Referenced by init_motor_dashboard(), and jamManager().

◆ jamManager()

◆ lateral_controller()

lemlib::ControllerSettings lateral_controller ( lateralKP ,
lateralKI ,
lateralKD ,
3 ,
1 ,
50 ,
3 ,
200 ,
0  )

References lateralKD, lateralKI, and lateralKP.

Referenced by chassis().

◆ leftDistance()

◆ leftMotors()

pros::MotorGroup leftMotors ( {-12, 13, -14} ,
pros::MotorGears::blue  )

◆ matchloader()

pros::adi::Pneumatics matchloader ( 'C' ,
false  )

◆ mid_descore()

pros::adi::Pneumatics mid_descore ( 'E' ,
false  )

Referenced by left_auton_split(), and opcontrol().

◆ outtakeMotor()

pros::Motor outtakeMotor ( 3 ,
pros::MotorGears::blue  )

◆ rightDistance()

◆ rightMotors()

pros::MotorGroup rightMotors ( {17, 19, -18} ,
pros::MotorGears::blue  )

◆ steer_curve()

lemlib::ExpoDriveCurve steer_curve ( 10 ,
20 ,
1  )

Referenced by chassis().

◆ storageMotor()

pros::Motor storageMotor ( 2 ,
pros::v5::MotorGears::blue  )

◆ throttle_curve()

lemlib::ExpoDriveCurve throttle_curve ( 10 ,
20 ,
1. 012 )

Referenced by chassis().

◆ vertical_tracking_sensor()

pros::Rotation vertical_tracking_sensor ( 9 )

◆ vision_sensor()

pros::Vision vision_sensor ( 18 )

Referenced by alignToGoal(), and calibrate_vision().

Variable Documentation

◆ allianceColor

◆ angularKD

const float angularKD = 26.5

Definition at line 44 of file globals.cpp.

Referenced by angular_controller().

◆ angularKI

const float angularKI = 0.0015

Definition at line 44 of file globals.cpp.

Referenced by angular_controller().

◆ angularKP

const float angularKP = 3.07

Definition at line 44 of file globals.cpp.

Referenced by angular_controller().

◆ antiJamEnabled

bool antiJamEnabled = false

Definition at line 108 of file globals.cpp.

Referenced by opcontrol().

◆ color_sort_enable

bool color_sort_enable = false

Definition at line 104 of file globals.cpp.

Referenced by skills_auton().

◆ horizontal_offset

const float horizontal_offset = (-1.18588887482 -1.2351177609)/2

Definition at line 31 of file globals.cpp.

◆ horizontal_tracking_sensor

lemlib::TrackingWheel horizontal_tracking_wheel& horizontal_tracking_sensor

Definition at line 38 of file globals.cpp.

◆ lateralKD

const float lateralKD = 72

Definition at line 44 of file globals.cpp.

Referenced by lateral_controller().

◆ lateralKI

const float lateralKI = 0.001

Definition at line 44 of file globals.cpp.

Referenced by lateral_controller().

◆ lateralKP

const float lateralKP = 9

Definition at line 44 of file globals.cpp.

Referenced by lateral_controller().

◆ leftMotors

lemlib::Drivetrain drivebase & leftMotors

Definition at line 17 of file globals.cpp.

Referenced by alignToGoal(), crossBarrier(), init_motor_dashboard(), opcontrol(), and temp_warning().

◆ liveReplay

bool liveReplay = false

Definition at line 109 of file globals.cpp.

Referenced by opcontrol().

◆ low_ramp_down_time

int low_ramp_down_time = 0

Definition at line 107 of file globals.cpp.

◆ midgoal_first

bool midgoal_first = false

Definition at line 105 of file globals.cpp.

Referenced by opcontrol().

◆ ramp_up_time

int ramp_up_time = 0

Definition at line 106 of file globals.cpp.

◆ vertical_offset

const float vertical_offset = (-0.414862637269 + 0.0661399466844)/2

Definition at line 32 of file globals.cpp.

◆ vertical_tracking_sensor

lemlib::TrackingWheel vertical_tracking_wheel& vertical_tracking_sensor

Definition at line 39 of file globals.cpp.

◆ vertical_tracking_wheel

lemlib::OdomSensors sensors& vertical_tracking_wheel

Definition at line 41 of file globals.cpp.