From 92c1c59599dd97ecf5e2cd1f87c5205a5df8154b Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Wed, 3 Dec 2025 17:57:22 -0500 Subject: [PATCH] --- .../deploy/pathplanner/paths/New Path.path | 10 +++++----- .../subsystems/CommandSwerveDrivetrain.java | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/deploy/pathplanner/paths/New Path.path b/src/main/deploy/pathplanner/paths/New Path.path index 601f47e..d23e318 100644 --- a/src/main/deploy/pathplanner/paths/New Path.path +++ b/src/main/deploy/pathplanner/paths/New Path.path @@ -3,13 +3,13 @@ "waypoints": [ { "anchor": { - "x": 16.243499999999997, + "x": 16.243, "y": 6.55025 }, "prevControl": null, "nextControl": { - "x": 15.18625440479427, - "y": 6.55025 + "x": 15.354412756981612, + "y": 6.548572497113415 }, "isLocked": false, "linkedName": null @@ -20,8 +20,8 @@ "y": 6.55025 }, "prevControl": { - "x": 2.34525, - "y": 6.55025 + "x": 2.306674365666888, + "y": 6.526815183428469 }, "nextControl": null, "isLocked": false, diff --git a/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java b/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java index 373a09e..0e8cf01 100644 --- a/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java +++ b/src/main/java/frc/robot/subsystems/CommandSwerveDrivetrain.java @@ -10,6 +10,7 @@ import com.pathplanner.lib.config.PIDConstants; import com.pathplanner.lib.config.RobotConfig; import com.pathplanner.lib.controllers.PPHolonomicDriveController; import edu.wpi.first.math.Matrix; +import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.numbers.N1; import edu.wpi.first.math.numbers.N3; @@ -44,12 +45,13 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su private final SwerveRequest.SysIdSwerveTranslation m_translationCharacterization = new SwerveRequest.SysIdSwerveTranslation(); private final SwerveRequest.SysIdSwerveSteerGains m_steerCharacterization = new SwerveRequest.SysIdSwerveSteerGains(); private final SwerveRequest.SysIdSwerveRotation m_rotationCharacterization = new SwerveRequest.SysIdSwerveRotation(); - + public void resetPose(Pose2d newPose) { + getState().Pose = newPose; // ou appelle setPose(newPose) selon ton code + }//ca marche pas private void configureAutoBuilder() { try { var config = RobotConfig.fromGUISettings(); - AutoBuilder.configure( - + AutoBuilder.configure( () -> getState().Pose, // Supplier of current robot pose this::resetPose, // Consumer for seeding pose against auto () -> getState().Speeds, // Supplier of current robot speeds @@ -77,10 +79,11 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su } catch (Exception ex) { DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace()); } - PPHolonomicDriveController.overrideRotationFeedback(()->{ - return 0; - }); + PPHolonomicDriveController.overrideRotationFeedback(()->{ + return 0; + }); } + /** * Constructs a CTRE SwerveDrivetrain using the specified constants. @@ -125,7 +128,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su if (Utils.isSimulation()) { startSimThread(); } - // configureAutoBuilder(); + configureAutoBuilder(); } /** @@ -158,7 +161,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su if (Utils.isSimulation()) { startSimThread(); } - //configureAutoBuilder(); + configureAutoBuilder(); }