This commit is contained in:
Antoine PerreaultE 2025-02-22 10:30:20 -05:00
parent 69ef6b6982
commit bb9d5a5550
3 changed files with 11 additions and 61 deletions

View File

@ -13,7 +13,6 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.commands.AlgueExpire;
import frc.robot.commands.CoralAlgueInspire;
import frc.robot.commands.CoralExpire;
import frc.robot.commands.CoralInspire;
import frc.robot.commands.Depart;
import frc.robot.commands.DepartPince;
import frc.robot.commands.ElevateurManuel;
@ -46,24 +45,22 @@ public class RobotContainer {
NamedCommands.registerCommand("L4", new L4(elevateur, pince));
NamedCommands.registerCommand("L3", new L3(elevateur, pince));
NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
NamedCommands.registerCommand("CoralInspire", new CoralInspire(pince,bougie));
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
}
private void configureBindings() {
// manette1
manette1.a().whileTrue(new AlgueExpire(pince,bougie));
manette1.b().whileTrue(new CoralAlgueInspire(pince,bougie));
manette1.x().whileTrue(new CoralInspire(pince,bougie));
manette1.y().whileTrue(new CoralExpire(pince,bougie));
manette1.povUp().whileTrue(new L4(elevateur, pince));
manette1.povRight().whileTrue(new L2(elevateur, pince));
manette1.povLeft().whileTrue(new L3(elevateur, pince));
manette1.povDown().whileTrue(new Depart(elevateur, pince));
manette1.a().whileTrue(new Depart(elevateur, pince));
manette1.b().whileTrue(new L2(elevateur,pince));
manette1.x().whileTrue(new L3(elevateur, pince));
manette1.y().whileTrue(new L4(elevateur, pince));
manette1.leftTrigger().whileTrue(new CoralExpire(pince, bougie));
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur));
//manette2
manette2.leftBumper().toggleOnTrue(new DepartPince(pince));
manette2.a().whileTrue(new StationPince(pince,elevateur));
manette2.leftTrigger().toggleOnTrue(new AlgueExpire(pince, bougie));
}
public Command getAutonomousCommand() {

View File

@ -1,49 +0,0 @@
// 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;
import frc.robot.subsystems.Pince;
import frc.robot.subsystems.Bougie;
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class CoralInspire extends Command {
private Pince pince;
Bougie bougie;
/** Creates a new CoralAlgue. */
public CoralInspire(Pince pince, Bougie bougie) {
this.pince = pince;
this.bougie = bougie;
addRequirements(pince,bougie);
// 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() {
if(pince.emperagecoral()>8){
pince.aspirecoral(0);
}
else{
pince.aspirecoral(.5);
bougie.Bleu();
}
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
pince.aspirecoral(0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -28,6 +28,7 @@ public class StationPince extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
pince.aspirecoral(0.5);
if(pince.encodeurpivot()>=900 && pince.encodeurpivot()<=910){
pince.pivote(0);
}
@ -52,6 +53,7 @@ public class StationPince extends Command {
@Override
public void end(boolean interrupted) {
pince.pivote(0);
pince.aspirecoral(0);
}
// Returns true when the command should end.