-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
909cf4c
commit 69069b1
Showing
1 changed file
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
// Credit to Team 5338 for any changes to the base command XRP template. | ||
package frc.robot.commands; | ||
|
||
import frc.robot.Constants; | ||
import frc.robot.RobotContainer; | ||
import frc.robot.subsystems.Servo; | ||
import frc.robot.subsystems.XRPDrivetrain; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import edu.wpi.first.wpilibj.xrp.XRPServo; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.FunctionalCommand; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
|
||
public class ServoCommands { | ||
//private XRPServo test; | ||
private static Servo hiIhopeThisWorks = new Servo(); | ||
private static Constants constants = new Constants(); | ||
|
||
//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 Command servoAdjustAngleCommand(double adjustAmount) { | ||
return new InstantCommand( | ||
() -> hiIhopeThisWorks.adjustAngleBy(adjustAmount) | ||
); | ||
} | ||
|
||
public static Command servoSetAngleCommand(double angle) { | ||
return new InstantCommand( | ||
() -> hiIhopeThisWorks.setAngle(angle) | ||
); | ||
} | ||
|
||
public static Command servoPresetCommand(int index) { | ||
return new InstantCommand( | ||
() -> hiIhopeThisWorks.setAngle(constants.servoPresets[index]) | ||
); | ||
} | ||
} |