-
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.
moved repositionGamePiece to its own command (#250)
-called in whileFalse after intakeGamePiece
- Loading branch information
1 parent
f044d95
commit 4049093
Showing
6 changed files
with
50 additions
and
27 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import frc.robot.RobotPreferences.prefShooter; | ||
import frc.robot.RobotPreferences.prefTransfer; | ||
import frc.robot.subsystems.Shooter; | ||
import frc.robot.subsystems.Transfer; | ||
|
||
// NOTE: Consider using this command inline, rather than writing a subclass. For more | ||
// information, see: | ||
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html | ||
public class RepositionGamePiece extends SequentialCommandGroup { | ||
Transfer subTransfer; | ||
Shooter subShooter; | ||
|
||
/** Creates a new RepositionGamePiece. */ | ||
public RepositionGamePiece(Transfer subTransfer, Shooter subShooter) { | ||
this.subTransfer = subTransfer; | ||
this.subShooter = subShooter; | ||
|
||
addRequirements(subTransfer, subShooter); | ||
|
||
addCommands( | ||
Commands.runOnce(() -> subTransfer.setTransferMotorSpeed(prefTransfer.transferRepositionSpeed.getValue())), | ||
Commands.waitSeconds(prefTransfer.transferRepositionTime.getValue()), | ||
Commands.runOnce(() -> subTransfer.setTransferMotorSpeed(-prefTransfer.transferRepositionSpeed.getValue())), | ||
Commands.waitSeconds(prefTransfer.transferRepositionTime.getValue() / 2), | ||
Commands.runOnce(() -> subTransfer.setTransferNeutralOutput()), | ||
Commands.runOnce(() -> subShooter.setDesiredVelocities(prefShooter.leftShooterSubVelocity.getValue(), | ||
prefShooter.rightShooterSubVelocity.getValue())), | ||
Commands.runOnce(() -> subShooter.getUpToSpeed())); | ||
|
||
} | ||
} |
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