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-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;
|
|
|
|
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;
|
|
|
|
import frc.robot.command.AlgueExpire;
|
|
|
|
import frc.robot.command.CoralAlgueInspire;
|
|
|
|
import frc.robot.command.CoralExpire;
|
2025-01-29 19:29:01 -05:00
|
|
|
import frc.robot.command.CoralInspire;
|
2025-01-29 19:19:14 -05:00
|
|
|
import frc.robot.command.Depart;
|
|
|
|
import frc.robot.command.DepartPince;
|
|
|
|
import frc.robot.command.ElevateurManuel;
|
|
|
|
import frc.robot.command.L2;
|
|
|
|
import frc.robot.command.L3;
|
|
|
|
import frc.robot.command.L4;
|
|
|
|
import frc.robot.command.StationPince;
|
2025-01-29 19:01:51 -05:00
|
|
|
import frc.robot.subsystems.Elevateur;
|
|
|
|
import frc.robot.subsystems.Pince;
|
2025-01-27 18:21:18 -05:00
|
|
|
|
|
|
|
public class RobotContainer {
|
2025-01-29 19:37:35 -05:00
|
|
|
CommandXboxController manette1 = new CommandXboxController(0);
|
|
|
|
CommandXboxController manette2 = new CommandXboxController(0);
|
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-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-01-29 19:29:01 -05:00
|
|
|
manette1.x().whileTrue(new CoralInspire(pince));
|
2025-01-29 19:19:14 -05:00
|
|
|
manette1.y().whileTrue(new CoralExpire(pince));
|
|
|
|
manette1.povUp().toggleOnTrue(new L4(elevateur, pince));
|
|
|
|
manette1.povRight().toggleOnTrue(new L2(elevateur, pince));
|
|
|
|
manette1.povLeft().toggleOnTrue(new L3(elevateur, pince));
|
|
|
|
manette1.povDown().toggleOnTrue(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-01-27 18:21:18 -05:00
|
|
|
|
|
|
|
public Command getAutonomousCommand() {
|
|
|
|
return Commands.print("No autonomous command configured");
|
|
|
|
}
|
|
|
|
}
|