Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 56466ff

Browse files
committed
continous state actions
1 parent dd3efa9 commit 56466ff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/java/frc/robot/arm/ArmSubsystem.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,22 @@ protected void afterTransition(ArmState newState) {
195195
public void robotPeriodic() {
196196
super.robotPeriodic();
197197

198+
switch (getState()) {
199+
case SPEAKER_SHOT-> {
200+
var newAngle =
201+
Units.degreesToRotations(clamp(speakerDistanceToAngle.get(distanceToSpeaker)));
202+
leftMotor.setControl(positionRequest.withPosition(newAngle));
203+
rightMotor.setControl(positionRequest.withPosition(newAngle));
204+
}
205+
case FEEDING -> {
206+
double newAngle =
207+
Units.degreesToRotations(clamp(feedSpotDistanceToAngle.get(distanceToFeedSpot)));
208+
leftMotor.setControl(positionRequest.withPosition(newAngle));
209+
rightMotor.setControl(positionRequest.withPosition(newAngle));
210+
}
211+
default -> {}
212+
}
213+
198214
DogLog.log("Arm/Left/StatorCurrent", leftMotor.getStatorCurrent().getValueAsDouble());
199215
DogLog.log("Arm/Left/SupplyCurrent", leftMotor.getSupplyCurrent().getValueAsDouble());
200216
DogLog.log("Arm/Left/ArmAngle", leftMotor.getPosition().getValueAsDouble());

0 commit comments

Comments
 (0)