SmartDashboard.putBoolean("Intake Calibrated", !calibrating);
SmartDashboard.putBoolean("Intake At Setpoint", Math.abs(inchExtension - setpointInches) < 0.5);
+ SmartDashboard.putData("Extend Intake", new InstantCommand(() -> extend()));
+ SmartDashboard.putData("Retract Intake", new InstantCommand(() -> retract()));
}
public void simulationPeriodic(){
SmartDashboard.putData("Turret Mech", mech);
SmartDashboard.putData("Start turret calibration", new InstantCommand(()-> calibrate()));
SmartDashboard.putData("Stop turret calibration", new InstantCommand(()-> stopCalibrating()));
+ SmartDashboard.putData("Reset Turret Position to Zero", new InstantCommand(() -> resetTurretPosition()));
SendableChooser<InstantCommand> turretTestChooser = new SendableChooser<>();
turretTestChooser.setDefaultOption("Turn to 0", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(0), 0.0)));
goalVelocityRadPerSec = velocityRadPerSec;
}
+ public void resetTurretPosition() {
+ inputs.positionDeg = 0.0;
+ }
+
/**
* @return If the turret is at setpoint with tolerance of 10 degrees
*/
double robotTurnCompensation = goalVelocityRadPerSec * TurretConstants.FEEDFORWARD_KV;
if(calibrating){
- // motor.set(0.05);
+ motor.set(0.05);
boolean calibrated = Math.abs(motor.getStatorCurrent().getValueAsDouble()) >= TurretConstants.CALIBRATION_CURRENT_THRESHOLD;
if(calibrationDebouncer.calculate(calibrated)){
stopCalibrating();
}
} else {
// Sets motor control with feedforward
- // motor.setControl(mmVoltageRequest
- // .withPosition(motorGoalRotations)
- // .withFeedForward(robotTurnCompensation));
+ motor.setControl(mmVoltageRequest
+ .withPosition(motorGoalRotations)
+ .withFeedForward(robotTurnCompensation));
}
Logger.recordOutput("Turret/Voltage", motor.getMotorVoltage().getValue());
public static final double FEEDFORWARD_KV = 0.185;
- public static final double NORMAL_CURRENT_LIMIT = 40.0; // A
+ public static final double NORMAL_CURRENT_LIMIT = 5.0; // A
public static final double CALIBRATION_CURRENT_LIMIT = 10.0; // A
public static final double CALIBRATION_CURRENT_THRESHOLD = 9.0; // A