Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set arm angle command #68

Merged
merged 4 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading