2025-01-27 18:21:18 -05: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;
|
|
|
|
|
2025-01-30 20:18:15 -05:00
|
|
|
import com.pathplanner.lib.auto.NamedCommands;
|
2025-01-29 19:19:14 -05:00
|
|
|
import edu.wpi.first.math.MathUtil;
|
2025-01-27 18:21:18 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.Command;
|
2025-01-29 19:19:14 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.RunCommand;
|
2025-01-29 19:01:51 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
2025-02-06 17:50:24 -05:00
|
|
|
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;
|
|
|
|
import frc.robot.commands.L2;
|
|
|
|
import frc.robot.commands.L3;
|
|
|
|
import frc.robot.commands.L4;
|
|
|
|
import frc.robot.commands.StationPince;
|
2025-01-29 19:01:51 -05:00
|
|
|
import frc.robot.subsystems.Elevateur;
|
|
|
|
import frc.robot.subsystems.Pince;
|
2025-02-10 19:49:13 -05:00
|
|
|
import frc.robot.subsystems.Bougie;
|
2025-01-27 18:21:18 -05:00
|
|
|
public class RobotContainer {
|
2025-01-30 20:18:15 -05:00
|
|
|
|
2025-01-29 19:37:35 -05:00
|
|
|
CommandXboxController manette1 = new CommandXboxController(0);
|
2025-02-03 17:49:34 -05:00
|
|
|
CommandXboxController manette2 = new CommandXboxController(1);
|
2025-02-10 19:49:13 -05:00
|
|
|
Bougie bougie = new Bougie();
|
2025-01-29 19:01:51 -05:00
|
|
|
Pince pince = new Pince();
|
|
|
|
Elevateur elevateur = new Elevateur();
|
2025-01-29 19:19:14 -05:00
|
|
|
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
|
2025-01-27 18:21:18 -05:00
|
|
|
public RobotContainer() {
|
|
|
|
configureBindings();
|
2025-01-29 19:19:14 -05:00
|
|
|
elevateur.setDefaultCommand(new RunCommand(()->{
|
|
|
|
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.2));
|
|
|
|
}, elevateur));
|
2025-02-10 19:49:13 -05:00
|
|
|
NamedCommands.registerCommand("Station",new StationPince(pince, elevateur));
|
2025-01-30 20:18:15 -05:00
|
|
|
NamedCommands.registerCommand("L4", new L4(elevateur, pince));
|
|
|
|
NamedCommands.registerCommand("L3", new L3(elevateur, pince));
|
2025-02-10 19:49:13 -05:00
|
|
|
NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
|
|
|
|
NamedCommands.registerCommand("CoralInspire", new CoralInspire(pince,bougie));
|
2025-01-30 20:18:15 -05:00
|
|
|
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince));
|
2025-02-10 19:49:13 -05:00
|
|
|
|
2025-01-27 18:21:18 -05:00
|
|
|
}
|
|
|
|
|
2025-01-29 19:01:51 -05:00
|
|
|
private void configureBindings() {
|
2025-01-29 19:29:01 -05:00
|
|
|
// manette1
|
2025-01-29 19:19:14 -05:00
|
|
|
manette1.a().whileTrue(new AlgueExpire(pince));
|
|
|
|
manette1.b().whileTrue(new CoralAlgueInspire(pince));
|
2025-02-10 19:49:13 -05:00
|
|
|
manette1.x().whileTrue(new CoralInspire(pince,bougie));
|
|
|
|
manette1.y().whileTrue(new CoralExpire(pince,bougie));
|
2025-02-03 18:19:29 -05:00
|
|
|
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));
|
2025-01-29 19:29:01 -05:00
|
|
|
//manette2
|
2025-01-29 19:19:14 -05:00
|
|
|
manette2.leftBumper().toggleOnTrue(new DepartPince(pince));
|
2025-01-29 20:13:38 -05:00
|
|
|
manette2.a().whileTrue(new StationPince(pince,elevateur));
|
2025-01-29 19:01:51 -05:00
|
|
|
}
|
2025-02-10 19:49:13 -05:00
|
|
|
|
2025-01-27 18:21:18 -05:00
|
|
|
public Command getAutonomousCommand() {
|
2025-02-10 19:49:13 -05:00
|
|
|
return Command()
|
2025-01-27 18:21:18 -05:00
|
|
|
}
|
|
|
|
}
|