ITS ALIIIIIIIIIIIIIIIIIIIVE

This commit is contained in:
ary 2023-10-20 12:09:40 -05:00
parent 71e4836e62
commit a51bef34b5
6 changed files with 55 additions and 18 deletions

View File

@ -3,7 +3,7 @@
#define DRIVE_SPEED 110
#define TURN_SPEED 90
#define SWING_SPEED 90
// R1 -> WINGS, L1 -> CATA, L2 -> PTO, R2 -> INTAKE
// Renu's control preferences
#define RENU_PTO_TOGGLE DIGITAL_R2
#define RENU_CATA_CONTROL DIGITAL_R1
@ -56,7 +56,12 @@ namespace superstruct {
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);
//More methods
void toggleIntake(bool val);
void toggleRemovalMech(bool val);
void renu_control();
void ria_control();
void chris_control();
}

View File

@ -201,8 +201,8 @@ void Drive::arcade_standard(e_type stick_type, e_curve_type curve_type) {
} else if (stick_type == SINGLE) {
// Put the joysticks through the curve function
if (curve_type == DEFAULT) {
fwd_stick = left_curve_function(master.get_analog(ANALOG_LEFT_Y));
turn_stick = right_curve_function(master.get_analog(ANALOG_LEFT_X));
fwd_stick = left_curve_function(master.get_analog(ANALOG_RIGHT_Y));
turn_stick = right_curve_function(master.get_analog(ANALOG_RIGHT_X));
} else if (curve_type == LOGARITHMIC) {
//fwd_stick = (master.get_analog(ANALOG_LEFT_Y) >= 1) ? 10
} else if (curve_type == SQRT) {

View File

@ -20,7 +20,8 @@ using namespace superstruct;
void near_side() {
// Score the triball preload
driveSync(107, true); // Go forward
driveSync(107, true);
// Go forward
// Get the furthest triball
driveSync(-38, true); // Move away from the goal
@ -39,10 +40,25 @@ void near_side() {
turnSync(-90); // Turn to the triball and intake
driveSync(12, true);
// chassis.set_drive_pid(2, DRIVE_SPEED, false, true);
// chassis.wait_drive();
}
void far_side() {
toggleIntake(true);
driveSync(60, true);
turnSync(-90);
toggleIntake(false);
driveSync(30, true);
driveSync(-30, true);
turnSync(-45);
driveSync(100, true);
toggleRemovalMech(true);
driveSync(-35, true);
toggleRemovalMech(false);
turnSync(55);
driveSync(70, true);
}

View File

@ -41,7 +41,7 @@ namespace globals {
Drive chassis(
{-2, -6, 12, 5},
{-16, 1, 4, -3},
16,
18,
WHEEL_SIZE,
600,
DRIVE_RATIO

View File

@ -71,12 +71,12 @@ void opcontrol() {
if (currentuser == RENU) {
chassis.tank_control();
renu_control();
} else if (currentuser = RIA) {
} else if (currentuser == RIA) {
chassis.tank_control(); //
ria_control();
} else if (currentuser == CHRIS) {
chassis.arcade_standard(ary::SPLIT, ary::DEFAULT);
renu_control();
chassis.arcade_standard(ary::SINGLE, ary::DEFAULT);
chris_control();
} else {
renu_control();
}

View File

@ -45,20 +45,20 @@ namespace superstruct {
// Adjust exit conditions to allow for quick movements
void configureExitConditions() {
chassis.set_exit_condition(chassis.turn_exit, 100, 3, 500, 7, 500, 500);
chassis.set_exit_condition(chassis.turn_exit, 50, 2, 220, 3, 500, 500);
chassis.set_exit_condition(chassis.swing_exit, 100, 3, 500, 7, 500, 500);
chassis.set_exit_condition(chassis.drive_exit, 80, 50, 300, 150, 500, 500);
chassis.set_exit_condition(chassis.drive_exit, 40, 80, 300, 150, 500, 500);
}
// Adjust PID constants for accurate movements
void configureConstants() {
chassis.set_slew_min_power(80, 80);
chassis.set_slew_distance(7, 7);
chassis.set_pid_constants(&chassis.headingPID, 11, 0, 20, 0);
chassis.set_pid_constants(&chassis.forward_drivePID, 0.45, 0, 5, 0);
chassis.set_pid_constants(&chassis.backward_drivePID, 0.45, 0, 5, 0);
chassis.set_pid_constants(&chassis.turnPID, 4, 0.003, 35, 15);
chassis.set_pid_constants(&chassis.swingPID, 6, 0, 40, 0);
chassis.set_pid_constants(&chassis.headingPID, 16, 0, 32, 0);
chassis.set_pid_constants(&chassis.forward_drivePID, 0.55, 0, 5, 0);
chassis.set_pid_constants(&chassis.backward_drivePID, 0.55, 0, 5, 0);
chassis.set_pid_constants(&chassis.turnPID, 6.5, 0.003, 35, 15);
chassis.set_pid_constants(&chassis.swingPID, 8.5, 0, 50, 0);
}
// Prepare the bot for the autonomous period of a match
@ -206,6 +206,16 @@ namespace superstruct {
}
}
void toggleIntake(bool val) {
int valTo = (val == true) ? 1 : 0;
intake_piston.set_value(valTo);
}
void toggleRemovalMech(bool val) {
int valTo = (val == true) ? 1 : 0;
doinker_piston.set_value(valTo);
}
/*
Handle respective controls
*/
@ -221,4 +231,10 @@ namespace superstruct {
wingsControlSingle(RIA_WINGS_CONTROL);
intakeControl(RIA_INTAKE_CONTROL);
}
void chris_control() {
cataControl(RENU_PTO_TOGGLE, RENU_CATA_CONTROL);
wingsControlSingle(RENU_WING_CONTROL);
intakeControl(RENU_INTAKE_CONTROL);
}
}