Skip to content

Commit

Permalink
Task 6 Completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Saanvi Korem committed Oct 24, 2024
1 parent e684a32 commit e4e63f3
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main/java/frc/robot/commands/ServoCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,24 @@
public class ServoCommands {
//TODO: Task 6-Write commands to move the arm up, down, and to a specific preset. The latter should be done by taking in an integer input.
//The presets are in the constants file.

public static InstantCommand moveArmUp(integer numberr){
return new InstantCommand()->{
double angleNew = servo.getArmAngle() + numberr;
servo.setArmAngle(angleNew);
}
}
public static InstantCommand moveArmDown(integer numberr){
return new InstantCommand () -> {
double angleNew = servo.getArmAngle() - numberr;
servo.setArmAngle(angleNew);
}
}
public static InstantCommand presetArm(int presetI){
return new InstantCommand () -> {
if(presetI < Constants.servoPresets.length && presetI >=0){
double AngleA = Constants.servoPresets[presetI];
servo.setArmAngle(AngleA);
}
}
}
}

0 comments on commit e4e63f3

Please sign in to comment.