path planner est de retour

This commit is contained in:
Samuel
2025-11-24 18:33:53 -05:00
parent a998218bd9
commit 6d3b467a86
3 changed files with 72 additions and 64 deletions

View File

@@ -45,42 +45,42 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
private final SwerveRequest.SysIdSwerveSteerGains m_steerCharacterization = new SwerveRequest.SysIdSwerveSteerGains();
private final SwerveRequest.SysIdSwerveRotation m_rotationCharacterization = new SwerveRequest.SysIdSwerveRotation();
// private void configureAutoBuilder() {
// try {
// var config = RobotConfig.fromGUISettings();
// AutoBuilder.configure(
private void configureAutoBuilder() {
try {
var config = RobotConfig.fromGUISettings();
AutoBuilder.configure(
// () -> getState().Pose, // Supplier of current robot pose
// this::resetPose, // Consumer for seeding pose against auto
// () -> getState().Speeds, // Supplier of current robot speeds
() -> getState().Pose, // Supplier of current robot pose
this::resetPose, // Consumer for seeding pose against auto
() -> getState().Speeds, // Supplier of current robot speeds
// // Consumer of ChassisSpeeds and feedforwards to drive the robot
// (speeds, feedforwards) -> setControl(
// m_pathApplyRobotSpeeds.withSpeeds(speeds)
// .withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesXNewtons())
// .withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesYNewtons())
// ),
// new PPHolonomicDriveController(
// // PID constants for translation
// new PIDConstants(63.167, 0, 0.54521),
// // // PID constants for rotation
// // new PIDConstants(7.9735, 0, 0.038499)
// // PID constants for rotation
// new PIDConstants(43.502,0,2.7353)
// ),
// config,
// // Assume the path needs to be flipped for Red vs Blue, this is normally the case
// () -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
// this // Subsystem for requirements
// Consumer of ChassisSpeeds and feedforwards to drive the robot
(speeds, feedforwards) -> setControl(
m_pathApplyRobotSpeeds.withSpeeds(speeds)
.withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesXNewtons())
.withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesYNewtons())
),
new PPHolonomicDriveController(
// PID constants for translation
new PIDConstants(63.167, 0, 0.54521),
// // PID constants for rotation
// new PIDConstants(7.9735, 0, 0.038499)
// PID constants for rotation
new PIDConstants(43.502,0,2.7353)
),
config,
// Assume the path needs to be flipped for Red vs Blue, this is normally the case
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red,
this // Subsystem for requirements
// );
// } catch (Exception ex) {
// DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace());
// }
// PPHolonomicDriveController.overrideRotationFeedback(()->{
// return 0;
// });
// }
);
} catch (Exception ex) {
DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace());
}
PPHolonomicDriveController.overrideRotationFeedback(()->{
return 0;
});
}
/**
* Constructs a CTRE SwerveDrivetrain using the specified constants.