2024-10-23 17:56:32 -04:00
|
|
|
// 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.Command;
|
2024-10-23 18:10:59 -04:00
|
|
|
import frc.robot.Subsystems.Lanceur;
|
2024-10-23 17:56:32 -04:00
|
|
|
|
|
|
|
public class Lancer extends Command {
|
2024-10-23 18:10:59 -04:00
|
|
|
private Lanceur lanceur;
|
2024-10-23 17:56:32 -04:00
|
|
|
/** Creates a new Lancer. */
|
2024-10-23 18:10:59 -04:00
|
|
|
public Lancer(Lanceur lanceur) {
|
|
|
|
this.lanceur = lanceur;
|
|
|
|
addRequirements(lanceur);
|
2024-10-23 17:56:32 -04:00
|
|
|
// Use addRequirements() here to declare subsystem dependencies.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called when the command is initially scheduled.
|
|
|
|
@Override
|
2024-10-23 18:10:59 -04:00
|
|
|
public void initialize() {
|
|
|
|
lanceur.setPID(0, 0, 0);
|
|
|
|
}
|
2024-10-23 17:56:32 -04:00
|
|
|
|
|
|
|
// Called every time the scheduler runs while the command is scheduled.
|
|
|
|
@Override
|
2024-10-23 18:10:59 -04:00
|
|
|
public void execute() {
|
|
|
|
lanceur.lance(0.5);
|
|
|
|
}
|
2024-10-23 17:56:32 -04:00
|
|
|
|
|
|
|
// Called once the command ends or is interrupted.
|
|
|
|
@Override
|
2024-10-23 18:10:59 -04:00
|
|
|
public void end(boolean interrupted) {
|
|
|
|
lanceur.lance(0);
|
|
|
|
}
|
2024-10-23 17:56:32 -04:00
|
|
|
|
|
|
|
// Returns true when the command should end.
|
|
|
|
@Override
|
|
|
|
public boolean isFinished() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|