This commit is contained in:
samuel desharnais 2023-10-31 18:51:50 -04:00
commit 4e6b1dc49e
6 changed files with 84 additions and 8 deletions

View File

@ -16,12 +16,12 @@ public class Deaccumuler extends CommandBase {
} }
// Called when the command is initially scheduled. // Called when the command is initially scheduled.
@Override @Override
public void initialize() {} public void initialize() {accumulateur.Reset();}
// 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() {
accumulateur.Deaccumuler(0.5);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.
@ -31,6 +31,6 @@ public class Deaccumuler extends CommandBase {
// Returns true when the command should end. // Returns true when the command should end.
@Override @Override
public boolean isFinished() { public boolean isFinished() {
return false; return (accumulateur.distance()< 1024);
} }
} }

View File

@ -19,15 +19,22 @@ public class Lancer extends CommandBase {
// Called when the command is initially scheduled. // Called when the command is initially scheduled.
@Override @Override
public void initialize() {} public void initialize() {
lanceur.setPID(0, 0, 0);
}
// 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() {
lanceur.lancer(0);
}
// 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) {
lanceur.lancer(0); }
// Returns true when the command should end. // Returns true when the command should end.
@Override @Override

View File

@ -0,0 +1,26 @@
// 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.SequentialCommandGroup;
import frc.robot.subsystems.Accumulateur;
import frc.robot.subsystems.Lanceur;
// 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 Lancez extends SequentialCommandGroup {
public Lancez(Lanceur lanceur, Accumulateur accumulateur) {
// Add your commands in the addCommands() call, e.g.
// addCommands(new FooCommand(), new BarCommand());
addCommands(new Lancer(lanceur), new Deaccumuler(accumulateur), new Reaccumuler(accumulateur));
}
public Lancez(Lancez lancez){}
}

View File

@ -0,0 +1,36 @@
// 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.CommandBase;
import frc.robot.subsystems.Accumulateur;
public class Reaccumuler extends CommandBase {
private Accumulateur accumulateur;
/** Creates a new Lancer. */
public Reaccumuler(Accumulateur accumulateur) {
this.accumulateur = accumulateur;
addRequirements(accumulateur);
}
// Called when the command is initially scheduled.
@Override
public void initialize() {accumulateur.Reset();}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
}
// 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 (accumulateur.distance()< -256);
}
}

View File

@ -18,8 +18,8 @@ public class Accumulateur extends SubsystemBase {
public Accumulateur() { public Accumulateur() {
} }
public void Deaccumuler(double vitesse){ public void Deaccumuler(){
moteuracc.set(vitesse); moteuracc.set(0.5);
} }
public boolean limit(){ public boolean limit(){

View File

@ -29,8 +29,15 @@ public class Lanceur extends SubsystemBase {
} }
public void stop() {
}
@Override @Override
public void periodic() { public void periodic() {
// This method will be called once per scheduler run // This method will be called once per scheduler run
} }
public void setPID(double d, double e, int i) {
}
} }