Skip to content

Commit

Permalink
Set arm angle command (#68)
Browse files Browse the repository at this point in the history
* update SetArmAngleCommand

* update SetArmAngleCommand, add UsefulArmPosition
  • Loading branch information
j0ndough authored Feb 3, 2024
1 parent f425a70 commit e062cfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/competition/subsystems/arm/ArmSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public enum UsefulArmPosition {
STARTING_POSITION,
COLLECTING_FROM_GROUND,
FIRING_FROM_SPEAKER_FRONT,
FIRING_IN_AMP
FIRING_IN_AMP,
SCOOCH_NOTE
}

public enum ArmNearLimitState {
Expand Down Expand Up @@ -234,6 +235,7 @@ public double getUsefulArmPositionAngle(UsefulArmPosition usefulArmPosition) {
case COLLECTING_FROM_GROUND -> angle = 0;
case FIRING_FROM_SPEAKER_FRONT -> angle = 30;
case FIRING_IN_AMP -> angle = 80;
case SCOOCH_NOTE -> angle = 60; // placeholder value, safe angle to let note through while still low
default -> angle = 40;
}
return angle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ public class SetArmAngleCommand extends BaseSetpointCommand {

@Inject
public SetArmAngleCommand(ArmSubsystem armSubsystem) {
addRequirements(armSubsystem);
this.armSubsystem = armSubsystem;
}

public void setTargetAngle(double targetAngle) {
this.targetAngle = targetAngle;
}

public void setArmPosition(ArmSubsystem.UsefulArmPosition armPosition) {
this.targetAngle = armSubsystem.getUsefulArmPositionAngle(armPosition);
}

@Override
public void initialize() {
armSubsystem.setTargetValue(targetAngle);
Expand Down

0 comments on commit e062cfc

Please sign in to comment.