touche, amperage, distance

This commit is contained in:
Antoine PerreaultE
2025-03-03 09:22:48 -05:00
parent 37452f0b05
commit 264bbd003f
17 changed files with 227 additions and 102 deletions

View File

@@ -44,9 +44,7 @@ import frc.robot.commands.Pince.PinceManuel;
import frc.robot.commands.grimpeur.GrimperHaut;
import frc.robot.commands.grimpeur.GrimpeurBas;
import frc.robot.commands.grimpeur.GrimpeurManuelhaut;
import frc.robot.commands.grimpeur.ResetGrimpeur;
import frc.robot.commands.requin.BalayeuseAlgue;
import frc.robot.commands.requin.BalayeuseBas;
import frc.robot.commands.requin.BalayeuseCoral;
import frc.robot.commands.requin.BalayeuseHaut;
import frc.robot.commands.requin.ExpireCorail;
@@ -60,13 +58,16 @@ import frc.robot.subsystems.Limelight3G;
import frc.robot.subsystems.Pince;
import frc.robot.subsystems.Requin;
import frc.robot.commands.requin.exspire;
import frc.robot.commands.Pince.DepartPince;
import frc.robot.commands.Elevateur.balonL2;
import frc.robot.commands.Elevateur.balonL3;
public class RobotContainer {
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
/* Setting up bindings for necessary control of the swerve drive platform */
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1) // Add a 10% deadband
.withDriveRequestType(DriveRequestType.OpenLoopVoltage
); // Use open-loop control for drive motors
@@ -106,34 +107,31 @@ public class RobotContainer {
private void configureBindings() {
drivetrain.registerTelemetry(logger::telemeterize);
drivetrain.setDefaultCommand(
// Drivetrain will execute this command periodically
// Drivetrain will execute this command periodically
drivetrain.applyRequest(() ->
drive.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftX()*manette1.getLeftX()*manette1.getLeftX()*MaxSpeed, 0.05)) // Drive forward with negative Y (forward)
.withVelocityY(MathUtil.applyDeadband(manette1.getLeftY()*manette1.getLeftY()*manette1.getLeftY()*MaxSpeed, 0.05)) // Drive left with negative X (left)
.withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*manette1.getRightX()*manette1.getRightX()*MaxAngularRate, 0.05)) // Drive counterclockwise with negative X (left)
drive.withVelocityY(MathUtil.applyDeadband(-manette1.getLeftX()*-manette1.getLeftX()*-manette1.getLeftX()*MaxSpeed, 0.05)) // Drive forward with negative Y (forward)
.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftY()*-manette1.getLeftY()*-manette1.getLeftY()*MaxSpeed, 0.05)) // Drive left with negative X (left)
.withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*-manette1.getRightX()*-manette1.getRightX()*MaxAngularRate, 0.05)) // Drive counterclockwise with negative X (left)
)
);
/* Manette 1 */
// reset the field-centric heading on start press
manette1.start().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric()));
//pince
manette1.rightTrigger().whileTrue(new CoralAlgueInspire(pince, bougie));
manette1.rightBumper().whileTrue(new StationPince(pince, elevateur,bougie));
manette1.leftTrigger().whileTrue(new AlgueExpire(pince, bougie));
manette1.povLeft().whileTrue(new AlgueExpire(pince, bougie));
manette1.leftBumper().whileTrue(new AprilTag3G(limelight3g,drivetrain,manette1::getLeftX,manette1::getLeftY));
manette1.povRight().whileTrue(new CoralExpire(pince, bougie));
//elevateur
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 DepartPince(pince));
manette1.povDown().whileTrue(new Algue_inspire(pince,bougie));
//elevateur
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.povUp().whileTrue(new balonL2(elevateur));
manette1.start().whileTrue(new balonL3(elevateur));
/* Manette 2 */
manette2.a().whileTrue(new CorailAspir(pince,bougie));
manette2.b().whileTrue(new Algue_inspire(pince,bougie));
//requin
manette2.rightBumper().whileTrue(new BalayeuseAlgue(requin,bougie));
manette2.leftBumper().whileTrue(new L1Requin(requin, bougie));
@@ -141,12 +139,15 @@ public class RobotContainer {
manette2.leftTrigger().whileTrue(new BalayeuseCoral(requin, bougie));
manette2.y().whileTrue(new exspire(requin, bougie));
manette2.x().whileTrue(new ExpireCorail(requin, bougie));
//limelight
manette2.a().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
//grimpeur
manette2.povDown().whileTrue(new GrimpeurManuelhaut(Grimpeur, bougie));
manette2.povLeft().whileTrue(new GrimperHaut(Grimpeur, bougie));
manette2.povRight().whileTrue(new GrimpeurBas(Grimpeur));
//Pince manuel
pince.setDefaultCommand(new RunCommand(()->{
pince.pivote(MathUtil.applyDeadband((manette2.getRightY()*manette2.getRightY()*manette2.getRightY())/3, 0.05));
@@ -157,8 +158,6 @@ public class RobotContainer {
elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY()*manette2.getLeftY()*manette2.getLeftY(), 0.05));
}, elevateur));
//limelight
manette2.povUp().whileTrue(new Forme3(limelight3,drivetrain,manette1::getLeftX,manette1::getLeftY));
//Reset encodeur
manette2.start().whileTrue(new reset(elevateur, pince));
}