basic antiblock control
This commit is contained in:
parent
7c3b025969
commit
50460a1e30
@ -51,8 +51,9 @@ namespace superstruct {
|
||||
//- Structure methods
|
||||
void intakeControl(pros::controller_digital_e_t intakeButton);
|
||||
void togglePto();
|
||||
void runCata();
|
||||
void cataControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton);
|
||||
void runCata(double inpt);
|
||||
void runAntiBlock(double inpt);
|
||||
void subsysControl(pros::controller_digital_e_t ptoToggleButton, pros::controller_digital_e_t cataRunButton);
|
||||
void wingsControl();
|
||||
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);
|
||||
|
||||
@ -22,7 +22,7 @@ namespace globals {
|
||||
pros::Motor motor_blf(2, MOTOR_GEARSET_06, true);
|
||||
pros::Motor motor_tlb(5, MOTOR_GEARSET_06, false);
|
||||
pros::Motor motor_trf(16, MOTOR_GEARSET_06, true);
|
||||
pros::Motor motor_trb(3, MOTOR_GEARSET_06, true);
|
||||
pros::Motor motor_trb(3, MOTOR_GEARSET_06, true); // cata running
|
||||
pros::Motor motor_brf(1, MOTOR_GEARSET_06, false);
|
||||
pros::Motor motor_brb(4, MOTOR_GEARSET_06, false);
|
||||
|
||||
|
||||
@ -190,12 +190,22 @@ namespace superstruct {
|
||||
|
||||
void runCata(double inpt) {
|
||||
if (!ptoEnabled) return;
|
||||
cata_left = inpt;
|
||||
//cata_left = inpt;
|
||||
cata_right = inpt;
|
||||
}
|
||||
|
||||
void runAntiBlock(double inpt) {
|
||||
if (!ptoEnabled) return;
|
||||
cata_left = inpt;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO:
|
||||
- Make anti block passable button
|
||||
*/
|
||||
|
||||
int lock = 0;
|
||||
void cataControl(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) {
|
||||
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
|
||||
lock = 1;
|
||||
@ -208,6 +218,14 @@ namespace superstruct {
|
||||
} else {
|
||||
runCata(0);
|
||||
}
|
||||
|
||||
if (globals::master.get_digital(DIGITAL_UP)) {
|
||||
runAntiBlock(-12000);
|
||||
} else if (globals::master.get_digital(DIGITAL_UP)) {
|
||||
runAntiBlock(12000);
|
||||
} else {
|
||||
runAntiBlock(0);
|
||||
}
|
||||
}
|
||||
|
||||
void wingsControlSingle(pros::controller_digital_e_t wingControlButton) {
|
||||
@ -234,19 +252,19 @@ namespace superstruct {
|
||||
*/
|
||||
|
||||
void renu_control() {
|
||||
cataControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
||||
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
||||
wingsControlSingle(RENU_WING_CONTROL);
|
||||
intakeControl(RENU_INTAKE_CONTROL);
|
||||
}
|
||||
|
||||
void ria_control() {
|
||||
cataControl(RIA_PTO_TOGGLE, RIA_CATA_CONTROL);
|
||||
subsysControl(RIA_PTO_TOGGLE, RIA_CATA_CONTROL);
|
||||
wingsControlSingle(RIA_WINGS_CONTROL);
|
||||
intakeControl(RIA_INTAKE_CONTROL);
|
||||
}
|
||||
|
||||
void chris_control() {
|
||||
cataControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
||||
subsysControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
|
||||
wingsControlSingle(RENU_WING_CONTROL);
|
||||
intakeControl(RENU_INTAKE_CONTROL);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user