swerve qui fonctionne

This commit is contained in:
samuel desharnais
2025-02-10 18:33:37 -05:00
parent 029bba7bb6
commit 9f017968e1
4 changed files with 33 additions and 30 deletions

View File

@@ -14,6 +14,7 @@ import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -59,9 +60,9 @@ public class RobotContainer {
drivetrain.setDefaultCommand(
// Drivetrain will execute this command periodically
drivetrain.applyRequest(() ->
drive.withVelocityX(-manette1.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward)
.withVelocityY(-manette1.getLeftX() * MaxSpeed) // Drive left with negative X (left)
.withRotationalRate(-manette1.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left)
drive.withVelocityX(MathUtil.applyDeadband(-manette1.getLeftY(), 0.5)) // Drive forward with negative Y (forward)
.withVelocityY(MathUtil.applyDeadband(-manette1.getLeftX(), 0.5)) // Drive left with negative X (left)
.withRotationalRate(MathUtil.applyDeadband(-manette1.getRightX()*MaxAngularRate, 0.5)) // Drive counterclockwise with negative X (left)
)
);