1516X High Stakes 2.0
Codebase for 1516X High Stakes season
Loading...
Searching...
No Matches
Robot::LadyBrown Class Reference

The Intake class represents a robot intake system. More...

#include <ladybrown.h>

Public Member Functions

void run ()
 Runs the main function of the intake system.
 
void checkStop ()
 Checks whether the intake should stop to skip the ring depending on color. It is the embodiment of vision sensor usage in this codebase.
 
 LadyBrown ()
 
 LadyBrown (double kP, double kI, double kD)
 
double pid_update ()
 
void toggle ()
 Toggles intake elevation.
 

Static Public Member Functions

static void edge_check (void *param)
 

Static Public Attributes

static bool needs_warning = false
 

Private Attributes

double kP
 
double kI
 
double kD
 
bool alliance_color
 blue is false, red is true.
 

Detailed Description

The Intake class represents a robot intake system.

Definition at line 8 of file ladybrown.h.

Constructor & Destructor Documentation

◆ LadyBrown() [1/2]

LadyBrown::LadyBrown ( )

Definition at line 24 of file ladybrown.cpp.

24 {
25 LadyBrownMotor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
26 LadyBrownMotor.set_zero_position(LadyBrownMotor.get_position());
28 LadyBrown::kP = 0;
29 LadyBrown::kI = 0;
30 LadyBrown::kD = 0;
31}
static bool needs_warning
Definition ladybrown.h:20
pros::Motor LadyBrownMotor(3, pros::v5::MotorGears::green, pros::v5::MotorUnits::degrees)

References kD, kI, kP, Robot::Globals::LadyBrownMotor(), and needs_warning.

◆ LadyBrown() [2/2]

LadyBrown::LadyBrown ( double kP,
double kI,
double kD )

Definition at line 15 of file ladybrown.cpp.

15 {
16 LadyBrownMotor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
17 LadyBrownMotor.set_zero_position(LadyBrownMotor.get_position());
19 LadyBrown::kP = kiP;
20 LadyBrown::kI = kiI;
21 LadyBrown::kD = kiD;
22}

References kD, kI, kP, Robot::Globals::LadyBrownMotor(), and needs_warning.

Member Function Documentation

◆ checkStop()

void Robot::LadyBrown::checkStop ( )

Checks whether the intake should stop to skip the ring depending on color. It is the embodiment of vision sensor usage in this codebase.

References kD, kI, and kP.

◆ edge_check()

void LadyBrown::edge_check ( void * param)
static

Definition at line 46 of file ladybrown.cpp.

46 {
47 constexpr int TASK_DELAY_MILLIS = 100;
48 constexpr int CONTROLLER_DELAY_MILLIS = 50;
49 uint32_t time = pros::millis();
51 // Check if the lady brown position is too low
52 while (true) {
53
54 if (LadyBrownMotor.get_position() < -5 || LadyBrownMotor.get_position() >= 800) {
55 while (LadyBrownMotor.get_position() < -5) {
57 controller.rumble(".");
58 }
59 while (LadyBrownMotor.get_position() >= 800) {
61 controller.rumble("-");
62 }
63 }
65 pros::Task::delay_until(&time, TASK_DELAY_MILLIS);
66 }
67}
pros::Controller controller(pros::E_CONTROLLER_MASTER)

References Robot::Globals::controller(), Robot::Globals::LadyBrownMotor(), and needs_warning.

◆ pid_update()

double LadyBrown::pid_update ( )

Definition at line 72 of file ladybrown.cpp.

72{ return 0; }

◆ run()

void LadyBrown::run ( )

Runs the main function of the intake system.

Takes optional user input to control the direction of the intake system in autonomous.

Definition at line 33 of file ladybrown.cpp.

33 {
34
35 if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) {
36 LadyBrownMotor.move_velocity(-SLOWER_VELOCITY);
37 } else if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_L2)) {
38 LadyBrownMotor.move_velocity(SLOWER_VELOCITY);
39 } else {
41 LadyBrownMotor.brake();
42 }
43 }
44}
#define SLOWER_VELOCITY
Definition intake.cpp:5

References Robot::Globals::controller(), Robot::Globals::LadyBrownMotor(), needs_warning, and SLOWER_VELOCITY.

◆ toggle()

void LadyBrown::toggle ( )

Toggles intake elevation.

Definition at line 69 of file ladybrown.cpp.

69{}

Member Data Documentation

◆ alliance_color

bool Robot::LadyBrown::alliance_color
private

blue is false, red is true.

Definition at line 47 of file ladybrown.h.

◆ kD

double Robot::LadyBrown::kD
private

Definition at line 42 of file ladybrown.h.

Referenced by LadyBrown(), LadyBrown(), and checkStop().

◆ kI

double Robot::LadyBrown::kI
private

Definition at line 41 of file ladybrown.h.

Referenced by LadyBrown(), LadyBrown(), and checkStop().

◆ kP

double Robot::LadyBrown::kP
private

Definition at line 40 of file ladybrown.h.

Referenced by LadyBrown(), LadyBrown(), and checkStop().

◆ needs_warning

bool LadyBrown::needs_warning = false
static

Definition at line 20 of file ladybrown.h.

Referenced by LadyBrown(), LadyBrown(), edge_check(), and run().


The documentation for this class was generated from the following files: