Neo Auto recording system.

This commit is contained in:
Abhishrek05
2024-03-07 19:22:41 -07:00
parent d0b5c15c2d
commit ffcbbf39ad
4 changed files with 84 additions and 74 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ public final class Constants {
public static final class PIDConstants { public static final class PIDConstants {
public static final int SWERVE_SLOT_IDX = 0; public static final int SWERVE_SLOT_IDX = 0;
public static final int SWERVE_PID_LOOP_IDX = 1; public static final int SWERVE_PID_LOOP_IDX = 1;
public static final Gains SWERVE_GAINS = new Gains(1.2, 0.0, 0.0, 0.0, 0, 1.0); public static final Gains SWERVE_GAINS = new Gains(1.2, 0.0, 0.4, 0.0, 0, 1.0);
} }
public static final class AutoConstants { public static final class AutoConstants {
+67 -57
View File
@@ -70,12 +70,12 @@ public class RobotContainer {
/* Controllers */ /* Controllers */
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID); private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
private final DeadbandedXboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID); private final DeadbandedXboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
// private final DeadbandedXboxController m_autoRecorderXbox = new DeadbandedXboxController(2); private final DeadbandedXboxController m_autoRecorderXbox = new DeadbandedXboxController(2);
/* Virtual Controllers */ /* Virtual Controllers */
// private final VirtualController m_virtualDriver = new VirtualController(0); private final VirtualController m_virtualDriver = new VirtualController(0);
// private final VirtualController m_virtualOperator = new VirtualController(1); private final VirtualController m_virtualOperator = new VirtualController(1);
private Command intakeToShootStuff = new ArmIntakeIn(m_robotIntake, m_robotShooter); private Command intakeToShootStuff = new ArmIntakeIn(m_robotIntake, m_robotShooter);
private Command interrupt = new InstantCommand(() -> {}, m_robotIntake, m_robotShooter); private Command interrupt = new InstantCommand(() -> {}, m_robotIntake, m_robotShooter);
@@ -274,7 +274,7 @@ public class RobotContainer {
*/ */
public RobotContainer() { public RobotContainer() {
configureButtonBindings(); configureButtonBindings();
// configureVirtualButtonBindings(); configureVirtualButtonBindings();
new DeferredBlock(() -> m_robotSwerveDrive.resetGyroFlip()); new DeferredBlock(() -> m_robotSwerveDrive.resetGyroFlip());
@@ -331,32 +331,32 @@ public class RobotContainer {
// .onTrue(new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt")) // .onTrue(new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt"))
// .onFalse(new InstantCommand()); // .onFalse(new InstantCommand());
// new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON) new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON)
// .whileTrue(new neoJoystickRecorder(m_robotSwerveDrive, .whileTrue(new neoJoystickRecorder(m_robotSwerveDrive,
// new DeadbandedXboxController[]{getDeadbandedDriverController(), getDeadbandedOperatorController()}, new DeadbandedXboxController[]{getDeadbandedDriverController(), getDeadbandedOperatorController()},
// "2note.auto")) "blue_center_1Note.auto"))
// .onFalse(new InstantCommand()); .onFalse(new InstantCommand());
// new JoystickButton(m_autoRecorderXbox, XboxController.RIGHT_BUMPER_BUTTON) new JoystickButton(m_autoRecorderXbox, XboxController.RIGHT_BUMPER_BUTTON)
// .onTrue(new neoJoystickPlayback(m_robotSwerveDrive, .onTrue(new neoJoystickPlayback(m_robotSwerveDrive,
// "2note.auto", "blue_center_1Note.auto",
// new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()}, new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
// true, false)) true, false))
// .onFalse(new InstantCommand()); .onFalse(new InstantCommand());
// ! /* Speed */ // ! /* Speed */
new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON) // final // new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON) // final
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUp())); // .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUp()));
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.setToFast())); // // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.setToFast()));
new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON) // final // new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON) // final
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDown())); // .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDown()));
new JoystickButton(getDeadbandedDriverController(), XboxController.Y_BUTTON) // new JoystickButton(getDeadbandedDriverController(), XboxController.Y_BUTTON)
.whileTrue(new InstantCommand(() -> // .whileTrue(new InstantCommand(() ->
m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1), // m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
new Translation2d(0, 0), // new Translation2d(0, 0),
true), m_robotSwerveDrive)); // true), m_robotSwerveDrive));
//? /* Operator Buttons */ //? /* Operator Buttons */
@@ -427,40 +427,50 @@ public class RobotContainer {
// /* Operator Buttons */ // /* Operator Buttons */
// new JoystickButton(getVirtualOperatorController(), XboxController.Y_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.Y_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotIntake.talonPIDIn())) .onTrue(new InstantCommand(() -> m_robotIntake.talonPIDIn()))
// .onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor())); .onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
// new JoystickButton(getVirtualOperatorController(), XboxController.A_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.X_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotIntake.talonPIDOut())) .onTrue(new InstantCommand(() -> m_robotIntake.talonPIDOut()))
// .onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor())); .onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
new JoystickButton(getVirtualOperatorController(), XboxController.A_BUTTON)
.onTrue(new InstantCommand(() -> m_robotIntake.talonHandoff()))
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors()));
new JoystickButton(getVirtualOperatorController(), XboxController.B_BUTTON)
.onTrue(emergencyRetract.asProxy());
// // Override Intake Position encoder: out // Override Intake Position encoder: out
// new JoystickButton(getVirtualOperatorController(), XboxController.BACK_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.BACK_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(-53), m_robotIntake)); .onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(-59), m_robotIntake));
// // Override Intake Position encoder: in // Override Intake Position encoder: in
// new JoystickButton(getVirtualOperatorController(), XboxController.START_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.START_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(0), m_robotIntake)); .onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(0), m_robotIntake));
// //Spin Shooter Motors
// new JoystickButton(getVirtualOperatorController(), XboxController.X_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter))
// .onFalse(new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter));
// new JoystickButton(getVirtualOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
// .onTrue(ejectToShoot)
// .onFalse(turnOffShoot);
// // new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
// // .onTrue(i) .onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter))
// // .onFalse(new InstantCommand(() -> m_robotIntake.talonPIDIn())); .onFalse(turnOffShoot.asProxy());
// new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_JOYSTICK_BUTTON) new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter)); .onTrue(i.asProxy())
.onFalse(new InstantCommand(() -> m_robotIntake.talonPIDIn()));
//spins up shooter, no wind down
new JoystickButton(getVirtualOperatorController(), XboxController.LEFT_JOYSTICK_BUTTON)
.onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter));
// new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
// .onTrue(new InstantCommand(() -> m_robotIntake.talonSpinIntakeMotor(), m_robotIntake))
// .onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake));
new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
.onTrue(emergencyRetract.asProxy());
} }
/** /**
@@ -488,11 +498,11 @@ public class RobotContainer {
return this.m_operatorXbox; return this.m_operatorXbox;
} }
// public VirtualController getVirtualDriverController() { public VirtualController getVirtualDriverController() {
// return m_virtualDriver; return m_virtualDriver;
// } }
// public VirtualController getVirtualOperatorController() { public VirtualController getVirtualOperatorController() {
// return m_virtualOperator; return m_virtualOperator;
// } }
} }
@@ -34,6 +34,7 @@ import frc4388.robot.Constants;
import frc4388.robot.Constants.IntakeConstants; import frc4388.robot.Constants.IntakeConstants;
import frc4388.robot.commands.PID; import frc4388.robot.commands.PID;
import frc4388.utility.Gains; import frc4388.utility.Gains;
import frc4388.utility.configurable.ConfigurableDouble;
public class Intake extends SubsystemBase { public class Intake extends SubsystemBase {
@@ -57,9 +58,8 @@ public class Intake extends SubsystemBase {
TalonFXConfiguration doodooController = new TalonFXConfiguration(); TalonFXConfiguration doodooController = new TalonFXConfiguration();
public static Gains armGains = IntakeConstants.ArmPID.INTAKE_GAINS; public static Gains armGains = IntakeConstants.ArmPID.INTAKE_GAINS;
private ConfigurableDouble outtakeSpeed = new ConfigurableDouble("Outtake Speed", IntakeConstants.INTAKE_OUT_SPEED_UNPRESSED);
private BooleanSupplier sup = () -> true; private BooleanSupplier sup = () -> true;
private BooleanSupplier dup = () -> false; private BooleanSupplier dup = () -> false;
@@ -138,7 +138,7 @@ public class Intake extends SubsystemBase {
} }
public void talonHandoff() { public void talonHandoff() {
talonIntake.set(-IntakeConstants.INTAKE_OUT_SPEED_UNPRESSED); talonIntake.set(-outtakeSpeed.get());
} }
public void talonSpinIntakeMotor() { public void talonSpinIntakeMotor() {
@@ -49,7 +49,7 @@ public class Shooter extends SubsystemBase {
} }
public void spin() { public void spin() {
spin(ShooterConstants.SHOOTER_SPEED); spin(smartDashboardShooterSpeed);
} }
public void spin(double speed) { public void spin(double speed) {