a motorized intake
This commit is contained in:
parent
2ce727fd40
commit
cc2e38062d
@ -57,8 +57,8 @@ namespace globals {
|
|||||||
|
|
||||||
extern Drive chassis;
|
extern Drive chassis;
|
||||||
|
|
||||||
extern pros::Motor& cata_left;
|
extern pros::Motor& intake_mtr;
|
||||||
extern pros::Motor& cata_right;
|
extern pros::Motor& cata_mtr;
|
||||||
|
|
||||||
enum e_controlsch {
|
enum e_controlsch {
|
||||||
RENU,
|
RENU,
|
||||||
|
|||||||
@ -7,7 +7,8 @@
|
|||||||
// Renu's control preferences
|
// Renu's control preferences
|
||||||
#define RENU_PTO_TOGGLE DIGITAL_R2
|
#define RENU_PTO_TOGGLE DIGITAL_R2
|
||||||
#define RENU_CATA_CONTROL DIGITAL_R1
|
#define RENU_CATA_CONTROL DIGITAL_R1
|
||||||
#define RENU_INTAKE_CONTROL DIGITAL_L1
|
#define RENU_INTAKE_CONTROL_INTAKE DIGITAL_L1
|
||||||
|
#define RENU_INTAKE_CONTROL_OUTTAKE DIGITAL_B
|
||||||
#define RENU_LEFT_WING_CONTROL DIGITAL_LEFT
|
#define RENU_LEFT_WING_CONTROL DIGITAL_LEFT
|
||||||
#define RENU_RIGHT_WING_CONTROL DIGITAL_RIGHT
|
#define RENU_RIGHT_WING_CONTROL DIGITAL_RIGHT
|
||||||
#define RENU_WING_CONTROL DIGITAL_L2
|
#define RENU_WING_CONTROL DIGITAL_L2
|
||||||
@ -50,11 +51,11 @@ namespace superstruct {
|
|||||||
void setSwingScale(double val);
|
void setSwingScale(double val);
|
||||||
|
|
||||||
//- Structure methods
|
//- Structure methods
|
||||||
void intakeControl(pros::controller_digital_e_t intakeButton);
|
//void intakeControl(pros::controller_digital_e_t intakeButton);
|
||||||
void togglePto(bool toggle);
|
void togglePto(bool toggle);
|
||||||
void runCata(double inpt);
|
void runCata(double inpt);
|
||||||
void runAntiBlock(double inpt);
|
void runAntiBlock(double inpt);
|
||||||
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton);
|
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton, pros::controller_digital_e_t intakeButton, pros::controller_digital_e_t outtakeButton);
|
||||||
void wingsControl();
|
void wingsControl();
|
||||||
void wingsControlSingle(pros::controller_digital_e_t wingControlButton);
|
void wingsControlSingle(pros::controller_digital_e_t wingControlButton);
|
||||||
void wingsControlComplex(pros::controller_analog_e_t leftWingButton, pros::controller_analog_e_t rightWingButton, pros::controller_analog_e_t wingButton);
|
void wingsControlComplex(pros::controller_analog_e_t leftWingButton, pros::controller_analog_e_t rightWingButton, pros::controller_analog_e_t wingButton);
|
||||||
|
|||||||
@ -91,6 +91,6 @@ namespace globals {
|
|||||||
|
|
||||||
lemlib::Chassis chassis_odom(dt_odom, latController, angController, chassis_sensors);
|
lemlib::Chassis chassis_odom(dt_odom, latController, angController, chassis_sensors);
|
||||||
|
|
||||||
pros::Motor& cata_left = chassis.left_motors[3];
|
pros::Motor& intake_mtr = chassis.left_motors[3];
|
||||||
pros::Motor& cata_right = chassis.right_motors[3];
|
pros::Motor& cata_mtr = chassis.right_motors[3];
|
||||||
}
|
}
|
||||||
@ -165,38 +165,37 @@ namespace superstruct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Structure methods
|
// Structure methods
|
||||||
void intakeControl(pros::controller_digital_e_t intakeButton) {
|
// void intakeControl(pros::controller_digital_e_t intakeButton) {
|
||||||
if (globals::master.get_digital_new_press(intakeButton)) {
|
// if (globals::master.get_digital_new_press(intakeButton)) {
|
||||||
if (intakeEngaged == false) {
|
// if (intakeEngaged == false) {
|
||||||
intake_piston.set_value(1);
|
// intake_piston.set_value(1);
|
||||||
intakeEngaged = true;
|
// intakeEngaged = true;
|
||||||
} else if (intakeEngaged == true) {
|
// } else if (intakeEngaged == true) {
|
||||||
intake_piston.set_value(0);
|
// intake_piston.set_value(0);
|
||||||
intakeEngaged = false;
|
// intakeEngaged = false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void togglePto(bool toggle) {
|
void togglePto(bool toggle) {
|
||||||
ptoEnabled = toggle;
|
ptoEnabled = toggle;
|
||||||
chassis.pto_toggle({cata_left, cata_right}, toggle); // Configure the listed PTO motors to whatever value toggle is.
|
chassis.pto_toggle({intake_mtr, cata_mtr}, toggle); // Configure the listed PTO motors to whatever value toggle is.
|
||||||
pto_piston.set_value(toggle);
|
pto_piston.set_value(toggle);
|
||||||
|
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
cata_left.set_brake_mode(MOTOR_BRAKE_COAST);
|
intake_mtr.set_brake_mode(MOTOR_BRAKE_COAST);
|
||||||
cata_right.set_brake_mode(MOTOR_BRAKE_COAST);
|
cata_mtr.set_brake_mode(MOTOR_BRAKE_COAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void runCata(double inpt) {
|
void runCata(double inpt) {
|
||||||
if (!ptoEnabled) return;
|
if (!ptoEnabled) return;
|
||||||
//cata_left = inpt;
|
cata_mtr = inpt;
|
||||||
cata_right = inpt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void runAntiBlock(double inpt) {
|
void runIntake(double inpt) {
|
||||||
if (!ptoEnabled) return;
|
if (!ptoEnabled) return;
|
||||||
cata_left = inpt;
|
intake_mtr = inpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -205,7 +204,7 @@ namespace superstruct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int lock = 0;
|
int lock = 0;
|
||||||
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton) {
|
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton, pros::controller_digital_e_t intakeButton, pros::controller_digital_e_t outtakeButton) {
|
||||||
if (globals::master.get_digital(ptoToggleButton) && lock == 0) { // If the PTO button has been pressed and the PTO is not engaged
|
if (globals::master.get_digital(ptoToggleButton) && lock == 0) { // If the PTO button has been pressed and the PTO is not engaged
|
||||||
togglePto(!ptoEnabled); // Toggle the PTO so that cataput is useable
|
togglePto(!ptoEnabled); // Toggle the PTO so that cataput is useable
|
||||||
lock = 1;
|
lock = 1;
|
||||||
@ -219,12 +218,12 @@ namespace superstruct {
|
|||||||
runCata(0);
|
runCata(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globals::master.get_digital(DIGITAL_UP)) {
|
if (globals::master.get_digital(intakeButton)) {
|
||||||
runAntiBlock(-12000);
|
runIntake(-12000);
|
||||||
} else if (globals::master.get_digital(DIGITAL_LEFT)) {
|
} else if (globals::master.get_digital(outtakeButton)) {
|
||||||
runAntiBlock(12000);
|
runIntake(12000);
|
||||||
} else {
|
} else {
|
||||||
runAntiBlock(0);
|
runIntake(-1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,21 +264,21 @@ namespace superstruct {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void renu_control() {
|
void renu_control() {
|
||||||
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL, RENU_INTAKE_CONTROL_INTAKE, RENU_INTAKE_CONTROL_OUTTAKE);
|
||||||
wingsControlSingle(RENU_WING_CONTROL);
|
wingsControlSingle(RENU_WING_CONTROL);
|
||||||
intakeControl(RENU_INTAKE_CONTROL);
|
//intakeControl(RENU_INTAKE_CONTROL);
|
||||||
climbControl(RENU_CLIMB_CONTROL);
|
climbControl(RENU_CLIMB_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ria_control() {
|
void ria_control() {
|
||||||
subsysControl(RIA_PTO_TOGGLE, RIA_CATA_CONTROL);
|
// subsysControl(RIA_PTO_TOGGLE, RIA_CATA_CONTROL);
|
||||||
wingsControlSingle(RIA_WINGS_CONTROL);
|
// wingsControlSingle(RIA_WINGS_CONTROL);
|
||||||
intakeControl(RIA_INTAKE_CONTROL);
|
//intakeControl(RIA_INTAKE_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void chris_control() {
|
void chris_control() {
|
||||||
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL, RENU_INTAKE_CONTROL_INTAKE, RENU_INTAKE_CONTROL_OUTTAKE);
|
||||||
wingsControlSingle(RENU_WING_CONTROL);
|
wingsControlSingle(RENU_WING_CONTROL);
|
||||||
intakeControl(RENU_INTAKE_CONTROL);
|
//intakeControl(RENU_INTAKE_CONTROL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user