This commit is contained in:
samuel desharnais 2024-02-01 18:09:38 -05:00
commit 834d67d437
4 changed files with 58 additions and 15 deletions

View File

@ -12,14 +12,11 @@ import frc.robot.subsystem.Lanceur;
public class Lancer extends Command { public class Lancer extends Command {
/** Creates a new Lanceur. */ /** Creates a new Lanceur. */
private Lanceur lanceur;
private Lanceur lancer;
private Lanceur lancer2;
private Lanceur lancer3;
private Lanceur lancer4;
public Lancer() { public Lancer() {
this.lanceur = lanceur;
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
addRequirements(lancer,lancer2,lancer3,lancer4); addRequirements(lanceur);
} }
// Called when the command is initially scheduled. // Called when the command is initially scheduled.
@ -29,13 +26,13 @@ public class Lancer extends Command {
// Called every time the scheduler runs while the command is scheduled. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
lancer.lancer(0.3); lanceur.lancer(0.3);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.
@Override @Override
public void end(boolean interrupted) { public void end(boolean interrupted) {
lancer.lancer(0); lanceur.lancer(0);
} }
// Returns true when the command should end. // Returns true when the command should end.

View File

@ -0,0 +1,44 @@
// 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.command;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Accumulateur;
import frc.robot.subsystem.Lanceur;
public class LancerNote extends Command {
private Lanceur lancer;
private Accumulateur accumulateur;
/** Creates a new LancerNote. */
public LancerNote(Lanceur lancer, Accumulateur accumulateur) {
this.lancer = lancer;
this.accumulateur = accumulateur;
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
double vitesse = 100;
lancer.lancer(vitesse);
if(lancer.vitesse(vitesse)>vitesse){
accumulateur.Accumuler(0.6);
}
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -13,13 +13,12 @@ import frc.robot.subsystem.Lanceur;
public class Lancerampli extends Command { public class Lancerampli extends Command {
/** Creates a new Lanceur. */ /** Creates a new Lanceur. */
private Lanceur lancer; private Lanceur lanceur;
private Lanceur lancer2;
private Lanceur lancer3;
private Lanceur lancer4;
public Lancerampli() { public Lancerampli() {
// Use addRequirements() here to declare subsystem dependencies. // Use addRequirements() here to declare subsystem dependencies.
addRequirements(lancer,lancer2,lancer3,lancer4); addRequirements(lanceur);
this.lanceur = lanceur;
} }
// Called when the command is initially scheduled. // Called when the command is initially scheduled.
@ -29,13 +28,13 @@ public class Lancerampli extends Command {
// Called every time the scheduler runs while the command is scheduled. // Called every time the scheduler runs while the command is scheduled.
@Override @Override
public void execute() { public void execute() {
lancer.lancer(0.1); lanceur.lancer(0.1);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.
@Override @Override
public void end(boolean interrupted) { public void end(boolean interrupted) {
lancer.lancer(0); lanceur.lancer(0);
} }
// Returns true when the command should end. // Returns true when the command should end.

View File

@ -25,6 +25,9 @@ public class Lanceur extends SubsystemBase {
} }
public void lancer(double vitesse){ public void lancer(double vitesse){
lancer.set(vitesse); lancer.set(vitesse);
}
public double vitesse(double vitesse){
return lancer.getEncoder().getVelocity();
} }
public void lanceur(){ public void lanceur(){
lancer2.follow(lancer); lancer2.follow(lancer);