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-02-10 19:53:34 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.Commands;
|
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-24 18:15:32 -05:00
|
|
|
import frc.robot.commands.Algue1Test;
|
|
|
|
import frc.robot.commands.Algue2Test;
|
2025-02-06 17:50:24 -05:00
|
|
|
import frc.robot.commands.AlgueExpire;
|
2025-02-24 18:15:32 -05:00
|
|
|
import frc.robot.commands.CorailAspir;
|
|
|
|
import frc.robot.commands.CorailTest;
|
2025-02-06 17:50:24 -05:00
|
|
|
import frc.robot.commands.CoralAlgueInspire;
|
|
|
|
import frc.robot.commands.CoralExpire;
|
|
|
|
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;
|
2025-02-20 20:25:59 -05:00
|
|
|
import frc.robot.commands.PinceManuel;
|
2025-02-22 14:46:41 -05:00
|
|
|
import frc.robot.commands.PinceManuel2;
|
2025-02-06 17:50:24 -05:00
|
|
|
import frc.robot.commands.StationPince;
|
2025-02-24 19:13:12 -05:00
|
|
|
import frc.robot.commands.reset;
|
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-02-22 14:46:41 -05:00
|
|
|
PinceManuel pinceManuel = new PinceManuel(pince);
|
|
|
|
PinceManuel2 pinceManuel2 = new PinceManuel2(pince);
|
2025-01-27 18:21:18 -05:00
|
|
|
public RobotContainer() {
|
|
|
|
configureBindings();
|
2025-01-29 19:19:14 -05:00
|
|
|
elevateur.setDefaultCommand(new RunCommand(()->{
|
2025-02-24 19:13:12 -05:00
|
|
|
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.2));
|
2025-01-29 19:19:14 -05:00
|
|
|
}, elevateur));
|
2025-02-20 20:25:59 -05:00
|
|
|
pince.setDefaultCommand(new RunCommand(()->{
|
2025-02-22 14:46:41 -05:00
|
|
|
pince.pivote(MathUtil.applyDeadband(manette2.getRightY()/5, 0.2));
|
2025-02-20 20:25:59 -05:00
|
|
|
}, pince));
|
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));
|
2025-02-11 19:22:25 -05:00
|
|
|
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
|
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-02-22 10:30:20 -05:00
|
|
|
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.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
|
|
|
|
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur));
|
2025-01-29 19:29:01 -05:00
|
|
|
//manette2
|
2025-02-22 14:46:41 -05:00
|
|
|
manette2.leftTrigger().whileTrue(new AlgueExpire(pince, bougie));
|
|
|
|
manette2.povUp().whileTrue(new PinceManuel(pince));
|
|
|
|
manette2.povDown().whileTrue(new PinceManuel2(pince));
|
2025-02-24 18:15:32 -05:00
|
|
|
manette2.a().whileTrue(new CorailAspir(pince));
|
|
|
|
manette2.b().whileTrue(new CoralExpire(pince, bougie));
|
|
|
|
manette2.povLeft().whileTrue(new Algue1Test(pince));
|
|
|
|
manette2.povRight().whileTrue(new Algue2Test(pince));
|
|
|
|
manette2.x().whileTrue(new CorailTest(pince));
|
2025-02-24 19:13:12 -05:00
|
|
|
manette2.start().whileTrue(new reset(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:53:34 -05:00
|
|
|
return Commands.print("No autonomous command configured");
|
2025-01-27 18:21:18 -05:00
|
|
|
}
|
|
|
|
}
|