private double goalVelocityRadPerSec = 0.0;
private double lastGoalRad = 0.0;
private State setpoint = new State();
+ private double lastFilteredRad = 0.0;
+ private double lastRawSetpoint = 0.0;
// private final MotionMagicVelocityVoltage velocityRequest = new MotionMagicVelocityVoltage(0.0).withUpdateFreqHz(0);
// }
motorGoalRotations = MathUtil.clamp(motorGoalRotations, Units.degreesToRotations(-180) * GEAR_RATIO, Units.degreesToRotations(180) * GEAR_RATIO);
-
- // Add the feedforward for the target velocity (SOTM) here as well
- double feedforwardVoltage = feedForward.calculate((goalVelocityRadPerSec) * GEAR_RATIO);
-
+
double robotTurnCompensation = goalVelocityRadPerSec * 0.185;
motor.setControl(mmVoltageRequest
.withFeedForward(robotTurnCompensation));
Logger.recordOutput("Turret/Voltage", motor.getMotorVoltage().getValue());
- Logger.recordOutput("Turret/velocitySetpoint", targetVelocity / GEAR_RATIO);
Logger.recordOutput("Turret/setpointDeg", Units.radiansToDegrees(setpoint.position));
// --- Visualization ---