pince + main

This commit is contained in:
Antoine PerreaultE
2025-02-25 16:38:35 -05:00
parent a11f31a2a8
commit f60f129410
3 changed files with 47 additions and 24 deletions

View File

@@ -21,18 +21,26 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
import frc.robot.TunerConstants.TunerConstants;
import frc.robot.commands.AprilTag3;
import frc.robot.commands.AprilTag3G;
import frc.robot.commands.ElevateurManuel;
import frc.robot.commands.Forme3;
import frc.robot.commands.L2;
import frc.robot.commands.PinceManuel;
import frc.robot.commands.PinceManuel2;
import frc.robot.commands.RainBow;
import frc.robot.commands.reset;
import frc.robot.subsystems.Bougie;
import frc.robot.subsystems.CommandSwerveDrivetrain;
import frc.robot.subsystems.Elevateur;
import frc.robot.subsystems.Limelight3;
import frc.robot.subsystems.Limelight3G;
import frc.robot.subsystems.Pince;
public class RobotContainer {
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
@@ -49,7 +57,11 @@ public class RobotContainer {
private final CommandXboxController manette2 = new CommandXboxController(1);
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
Elevateur elevateur = new Elevateur();
Pince pince = new Pince();
ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY);
PinceManuel pinceManuel = new PinceManuel(pince);
PinceManuel2 pinceManuel2 = new PinceManuel2(pince);
private final SendableChooser<Command> autoChooser;
Bougie bougie = new Bougie();
Limelight3G limelight3g = new Limelight3G();
@@ -65,8 +77,13 @@ public class RobotContainer {
configureBindings();
NamedCommands.registerCommand("AprilTag", new AprilTag3G(limelight3g, drivetrain, null, null));
}
private void configureBindings() {
elevateur.setDefaultCommand(new RunCommand(()->{
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.2));
}, elevateur));
pince.setDefaultCommand(new RunCommand(()->{
pince.pivote(MathUtil.applyDeadband(manette2.getRightY()/5, 0.2));
}, pince));
// Note that X is defined as forward according to WPILib convention,
// and Y is defined as to the left according to WPILib convention.
drivetrain.setDefaultCommand(
@@ -78,15 +95,19 @@ public class RobotContainer {
)
);
// reset the field-centric heading on left bumper press
manette1.y().whileTrue(drivetrain.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
manette1.a().whileTrue(drivetrain.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
manette1.b().whileTrue(drivetrain.sysIdDynamic(SysIdRoutine.Direction.kForward));
manette1.x().whileTrue(drivetrain.sysIdDynamic(SysIdRoutine.Direction.kReverse));
manette1.start().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric()));
manette1.leftTrigger().whileTrue(new AprilTag3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
manette1.rightTrigger().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
manette1.a().whileTrue(new reset(elevateur));
manette1.b().whileTrue(new L2(elevateur, pince));
manette2.leftTrigger().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY));
drivetrain.registerTelemetry(logger::telemeterize);
}