@@ -25,6 +25,9 @@ public class ShooterIOReal implements ShooterIO {
2525 protected PIDController wheelPID ;
2626 protected SimpleMotorFeedforward wheelFeedforward ;
2727
28+ private double targetHoodAngle = 0 ;
29+ private double targetWheelSpeed = 0 ;
30+
2831 public ShooterIOReal () {
2932 wheelSetpoint = RotationsPerSecond .zero ();
3033 hoodSetpoint = Degrees .zero ();
@@ -35,7 +38,7 @@ public ShooterIOReal() {
3538 hoodPID = HOOD_PID .get ();
3639 wheelPID = WHEEL_PID .get ();
3740 wheelFeedforward = WHEEL_FEEDFORWARD .get ();
38- hoodMotor .setPosition (0 );
41+ hoodMotor .setPosition (HOOD_MIN_ANGLE );
3942 }
4043
4144 @ Override
@@ -53,19 +56,24 @@ public void logOutputs(ShooterIOOutputs outputs) {
5356 SmartDashboard .putData (hoodPID );
5457 SmartDashboard .putNumber ("CURRENT L" , leftMotor .getStatorCurrent ().getValueAsDouble ());
5558 SmartDashboard .putNumber ("CURRENT R" , rightMotor .getStatorCurrent ().getValueAsDouble ());
59+
60+ SmartDashboard .putNumber ("Shooter/TargetHoodAngle" , targetHoodAngle );
61+ SmartDashboard .putNumber ("Shooter/TargetWheelSpeed" , targetHoodAngle );
5662 }
5763
5864 @ Override
5965 public void setWheelVelocity (AngularVelocity velocity ) {
6066 wheelSetpoint = velocity ;
6167 //leftMotor.set(-1);
62- leftMotor .set (wheelPID .calculate (leftMotor .getVelocity ().getValue ().in (RotationsPerSecond ), wheelSetpoint .in (RotationsPerSecond )) + wheelFeedforward .calculate (wheelSetpoint .in (RotationsPerSecond )));
68+ // leftMotor.set(wheelPID.calculate(leftMotor.getVelocity().getValue().in(RotationsPerSecond), wheelSetpoint.in(RotationsPerSecond)) + wheelFeedforward.calculate(wheelSetpoint.in(RotationsPerSecond)));
69+ leftMotor .set (wheelPID .calculate (leftMotor .getVelocity ().getValue ().in (RotationsPerSecond ), targetWheelSpeed ) + wheelFeedforward .calculate (wheelSetpoint .in (RotationsPerSecond )));
6370 }
6471
6572 @ Override
6673 public void setHoodAngle (Angle angle ) {
6774 hoodSetpoint = angle ;
68- hoodMotor .set (hoodPID .calculate (hoodMotor .getPosition ().getValue ().div (HOOD_GEARING ).in (Degrees ), -hoodSetpoint .in (Degrees )));
75+ // hoodMotor.set(hoodPID.calculate(hoodMotor.getPosition().getValue().div(HOOD_GEARING).in(Degrees), -hoodSetpoint.in(Degrees)));
76+ hoodMotor .set (hoodPID .calculate (hoodMotor .getPosition ().getValue ().div (HOOD_GEARING ).in (Degrees ), -targetHoodAngle ));
6977 }
7078
7179 @ Override
@@ -77,4 +85,9 @@ public boolean atWheelVelocitySetpoint() {
7785 public boolean atHoodAngleSetpoint () {
7886 return (Math .abs (hoodMotor .getPosition ().getValue ().div (HOOD_GEARING ).in (Degrees ) - hoodSetpoint .in (Degrees )) < HOOD_ANGLE_TOLERANCE_DEGREES );
7987 }
88+
89+ @ Override
90+ public void zeroHood () {
91+ hoodMotor .setPosition (HOOD_MIN_ANGLE );
92+ }
8093}
0 commit comments