Skip to content

Commit d54dd4c

Browse files
committed
stuff to make sotm data collection easier
1 parent f2c4d06 commit d54dd4c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/main/java/frc/robot/Subsystems/Shooter/ShooterIO.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ class ShooterIOOutputs {
2222
public abstract boolean atWheelVelocitySetpoint();
2323

2424
public abstract boolean atHoodAngleSetpoint();
25+
26+
public abstract void zeroHood();
2527
}

src/main/java/frc/robot/Subsystems/Shooter/ShooterIOReal.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)