update auton and driver controls

This commit is contained in:
ary 2023-09-16 12:35:18 -04:00
parent 40242eba20
commit fa481b9601
3 changed files with 25 additions and 25 deletions

View File

@ -16,8 +16,8 @@ void default_constants() {
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.forward_drivePID, 2, 0, 5, 0);
chassis.set_pid_constants(&chassis.backward_drivePID, 2, 0, 5, 0);
chassis.set_pid_constants(&chassis.turnPID, 4, 0.003, 35, 15);
chassis.set_pid_constants(&chassis.swingPID, 6, 0, 40, 0);
}
@ -33,14 +33,13 @@ void exit_condition_defaults() {
// ** AUTONS ** //
void test_auton() {
chassis.set_drive_pid(5, DRIVE_SPEED, false, true);
chassis.set_swing_pid(e_swing::LEFT_SWING, 50, TURN_SPEED);
chassis.set_drive_pid(36, DRIVE_SPEED, true, true);
chassis.wait_until(24);
/* RUN THE INTAKE */
pros::delay(500);
chassis.set_drive_pid(-2, DRIVE_SPEED, false, false);
chassis.set_turn_pid(130, TURN_SPEED);
//pros::task_t intakeTask(run_intake_for, (void*) malloc(sizeof(double)), TASK_PRIORITY_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "runIntakeFor");
chassis.set_drive_pid(48, DRIVE_SPEED, true, true);
chassis.wait_drive();
chassis.set_turn_pid(-45, TURN_SPEED);
chassis.wait_drive();
chassis.set_drive_pid(48, DRIVE_SPEED, true, true);
chassis.wait_drive();
chassis.set_drive_pid(-10, DRIVE_SPEED, false, true);
chassis.wait_drive();
chassis.set_turn_pid(90, TURN_SPEED);
}

View File

@ -5,16 +5,19 @@ namespace globals {
// Chassis
pros::Controller master(CONTROLLER_MASTER);
pros::Motor motor_fl(4, MOTOR_GEARSET_6, true);
pros::Motor motor_ml(4, MOTOR_GEARSET_6, true);
pros::Motor motor_bl(4, MOTOR_GEARSET_6, true);
pros::Motor motor_fr(4, MOTOR_GEARSET_6, true);
pros::Motor motor_mr(4, MOTOR_GEARSET_6, true);
pros::Motor motor_fl(8, MOTOR_GEARSET_6, true);
pros::Motor motor_ml(17, MOTOR_GEARSET_6, true);
pros::Motor motor_bl(7, MOTOR_GEARSET_6, false);
pros::Motor motor_fr(11, MOTOR_GEARSET_6, false);
pros::Motor motor_mr(20, MOTOR_GEARSET_6, false);
pros::Motor motor_br(4, MOTOR_GEARSET_6, true);
pros::Motor_Group left_drive({ motor_fl, motor_ml, motor_bl });
pros::Motor_Group right_drive({ motor_fr, motor_mr, motor_br });
/*
Two seperate drivetrains, chassis
*/
lemlib::Drivetrain_t chassis_odom {
&left_drive,
&right_drive,
@ -30,7 +33,7 @@ namespace globals {
3.25,
600,
0.6
);
);
// Electronics / Pneumatics / Sensors

View File

@ -51,7 +51,8 @@ void autonomous() {
chassis.reset_pid_targets();
chassis.reset_gyro();
chassis.reset_drive_sensor();
chassis.set_drive_brake(MOTOR_BRAKE_HOLD);
chassis.set_drive_brake(MOTOR_BRAKE_COAST);
default_constants();
ary::autonselector::auton_selector.call_selected_auton();
}
@ -60,11 +61,8 @@ void opcontrol() {
chassis.set_drive_brake(MOTOR_BRAKE_COAST);
while (true) {
chassis.arcade_standard(ary::SINGLE, ary::DEFAULT);
//chassis.tank();
//chassis.arcade_standard(ary::SdPLIT, ary::DEFAULT);
chassis.tank();
pros::delay(ary::util::DELAY_TIME);
}
}