-
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.
Co-Authored-By: ScootKampfer <[email protected]> Co-Authored-By: Nahuelpoet <[email protected]>
- Loading branch information
1 parent
fe83af4
commit 042b63d
Showing
3 changed files
with
82 additions
and
9 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
38 changes: 38 additions & 0 deletions
38
src/main/java/frc/robot/commands/GetShooterToSpeedCommand.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,38 @@ | ||
// 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.math.controller.PIDController; | ||
import edu.wpi.first.wpilibj2.command.PIDCommand; | ||
import frc.robot.subsystems.Shooter; | ||
|
||
// 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 GetShooterToSpeedCommand extends PIDCommand { | ||
/** Creates a new GetShooterToSpeedCommand. */ | ||
public Shooter shooter; | ||
public GetShooterToSpeedCommand(Shooter shooter, double targetRPM) { | ||
super( | ||
// The controller that the command will use | ||
new PIDController(0, 0, 0), | ||
// This should return the measurement | ||
() -> shooter.getRPM(), | ||
// This should return the setpoint (can also be a constant) | ||
() -> targetRPM, | ||
// This uses the output | ||
output -> { | ||
shooter.shoot(output);// Use the output here | ||
}); | ||
this.shooter = shooter; | ||
addRequirements(shooter); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
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