-
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.
feat: button bindings, wrote manual shooter command
- Loading branch information
1 parent
b71fd9c
commit 464c6f1
Showing
4 changed files
with
63 additions
and
15 deletions.
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
30 changes: 30 additions & 0 deletions
30
src/main/java/org/team1540/robot2024/commands/shooter/ManualShooterCommand.java
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.team1540.robot2024.commands.shooter; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; | ||
import org.team1540.robot2024.subsystems.shooter.Shooter; | ||
|
||
public class ManualShooterCommand extends Command{ | ||
private final Shooter shooter; | ||
private final CommandXboxController controller; | ||
|
||
public ManualShooterCommand(Shooter shooter, CommandXboxController controller) { | ||
this.shooter = shooter; | ||
addRequirements(shooter); | ||
this.controller = controller; | ||
} | ||
@Override | ||
public void execute() { | ||
Rotation2d angleRotation2d = shooter.getPivotPosition(); | ||
shooter.setPivotPosition(angleRotation2d.plus(Rotation2d.fromRotations(0.01*(controller.getLeftY())))); | ||
// controller values range from -1 to 1 | ||
// pivot position will be within 90 degrees | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return shooter.isPivotAtSetpoint(); | ||
} | ||
} | ||
|
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
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