Skip to content

Commit

Permalink
Fix compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kcooney committed Jan 9, 2025
1 parent a864e2d commit 79ffe92
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
25 changes: 14 additions & 11 deletions Robot2024/src/main/java/com/team2813/subsystems/IntakePivot.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import static com.team2813.Constants.INTAKE_PIVOT;

import com.ctre.phoenix6.signals.NeutralModeValue;
import com.team2813.lib2813.control.Encoder;
import com.team2813.lib2813.control.InvertType;
import com.team2813.lib2813.control.Motor;
import com.team2813.lib2813.control.PIDMotor;
import com.team2813.lib2813.control.encoders.CancoderWrapper;
import com.team2813.lib2813.control.motors.TalonFXWrapper;
import com.team2813.lib2813.subsystems.MotorSubsystem;

import edu.wpi.first.units.Angle;
import edu.wpi.first.units.Measure;
import edu.wpi.first.units.Units;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import java.util.function.Supplier;

public class IntakePivot extends MotorSubsystem<IntakePivot.Rotations> {

Motor intakePivotMotor;
Encoder intakePivotEncoder;

public IntakePivot() {

Expand All @@ -27,8 +27,6 @@ public IntakePivot() {
.PID(0.313, 0, 0)
.acceptableError(0.5)
.startingPosition(Rotations.INTAKE_UP));

intakePivotMotor = new TalonFXWrapper(INTAKE_PIVOT, InvertType.COUNTER_CLOCKWISE);
}

public void resetPosition() {
Expand Down Expand Up @@ -56,7 +54,7 @@ public void periodic() {
SmartDashboard.putNumber("Intake Pivot CANCoder Position", encoder.position());
}

public static enum Rotations implements MotorSubsystem.Position {
public enum Rotations implements Supplier<Measure<Angle>> {
INTAKE_DOWN(0.825439),
INTAKE_UP(0);

Expand All @@ -65,12 +63,17 @@ public static enum Rotations implements MotorSubsystem.Position {
}

private final double pos;
@Override

@Deprecated
public double getPos() {
return pos;
}

}

@Override
public Measure<Angle> get() {
return Units.Rotations.of(pos);
}
}

}

Expand Down
16 changes: 13 additions & 3 deletions Robot2024/src/main/java/com/team2813/subsystems/ShooterPivot.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
import com.team2813.lib2813.subsystems.MotorSubsystem;
import com.team2813.lib2813.util.ConfigUtils;

import edu.wpi.first.units.Angle;
import edu.wpi.first.units.Measure;
import edu.wpi.first.units.Units;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import java.util.function.Supplier;

public class ShooterPivot extends MotorSubsystem<ShooterPivot.Position> {

public ShooterPivot() {
Expand Down Expand Up @@ -62,7 +67,7 @@ public void periodic() {
SmartDashboard.putNumber("Shoooter Pivot CANCoder Position", encoder.position());
}

public static enum Position implements MotorSubsystem.Position {
public static enum Position implements Supplier<Measure<Angle>> {
TOP_HARD_STOP(0),
SUBWOOFER_FRONT(0.023926),
SUBWOOFER_SIDE(0.023926),
Expand All @@ -79,10 +84,15 @@ public static enum Position implements MotorSubsystem.Position {
Position(double pos) {
this.pos = pos;
}

@Override
@Deprecated
public double getPos() {
return pos;
}

@Override
public Measure<Angle> get() {
return Units.Rotations.of(pos);
}
}
}

0 comments on commit 79ffe92

Please sign in to comment.