This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
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
ca0907c
commit 2eaa1ef
Showing
11 changed files
with
205 additions
and
39 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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/org/team1540/bunnybotTank2023/commands/indexer/IndexerIdleCommand.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,19 @@ | ||
package org.team1540.bunnybotTank2023.commands.indexer; | ||
|
||
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
|
||
public class IndexerIdleCommand extends CommandBase { | ||
private final Indexer indexer; | ||
|
||
public IndexerIdleCommand(Indexer indexer) { | ||
this.indexer = indexer; | ||
addRequirements(indexer); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
indexer.setBottomSpeed(0.4); | ||
indexer.setTopSpeed(-0.2); | ||
} | ||
} | ||
|
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
27 changes: 27 additions & 0 deletions
27
src/main/java/org/team1540/bunnybotTank2023/commands/turret/TurretManualCommand.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,27 @@ | ||
package org.team1540.bunnybotTank2023.commands.turret; | ||
|
||
import edu.wpi.first.math.MathUtil; | ||
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; | ||
import org.team1540.bunnybotTank2023.Constants; | ||
|
||
public class TurretManualCommand extends CommandBase { | ||
private final Turret turret; | ||
private final CommandXboxController controller; | ||
|
||
public TurretManualCommand(Turret turret, CommandXboxController controller) { | ||
this.turret = turret; | ||
this.controller = controller; | ||
addRequirements(turret); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
turret.setVoltage(MathUtil.applyDeadband(controller.getRightX(), Constants.DEADZONE_RADIUS) * 12.0); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
turret.stop(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/org/team1540/bunnybotTank2023/commands/turret/TurretSetpointCommand.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,25 @@ | ||
package org.team1540.bunnybotTank2023.commands.turret; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
|
||
public class TurretSetpointCommand extends CommandBase { | ||
private final Turret turret; | ||
private final Rotation2d setpoint; | ||
|
||
public TurretSetpointCommand(Turret turret, Rotation2d setpoint) { | ||
this.turret = turret; | ||
this.setpoint = setpoint; | ||
addRequirements(turret); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
turret.autoSetPosition(setpoint); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return turret.isAtSetpoint(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/org/team1540/bunnybotTank2023/commands/turret/TurretZeroSequenceCommand.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,20 @@ | ||
package org.team1540.bunnybotTank2023.commands.turret; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.WaitUntilCommand; | ||
|
||
import static org.team1540.bunnybotTank2023.Constants.*; | ||
|
||
public class TurretZeroSequenceCommand extends SequentialCommandGroup { | ||
public TurretZeroSequenceCommand(Turret turret) { | ||
addCommands( | ||
new InstantCommand(() -> turret.setVoltage(2)), | ||
new WaitUntilCommand(turret::getForwardLimitSwitch), | ||
new InstantCommand(() -> turret.resetToEncoder(TurretConstants.FORWARD_LIMIT_POSITION)), | ||
new TurretSetpointCommand(turret, Rotation2d.fromDegrees(0)).asProxy() | ||
); | ||
addRequirements(turret); | ||
} | ||
} |
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
Oops, something went wrong.