auto I MARCHE(pas)

This commit is contained in:
Antoine PerreaultE
2025-12-10 18:31:12 -05:00
parent 5e9f2f5244
commit fa30757990
2 changed files with 25 additions and 43 deletions

View File

@@ -47,49 +47,31 @@ Translation2d backLeftLocation = new Translation2d(-0.3, +0.3);
Translation2d backRightLocation = new Translation2d(-0.3, -0.3);
/* SysId routine for characterizing translation. This is used to find PID gains for the drive motors. */
private void configureAutoBuilder() {
RobotConfig config;
System.out.println("avant le mode auto est genere");
try {
config = RobotConfig.fromGUISettings();
// Configure AutoBuilder last
var config = RobotConfig.fromGUISettings();
AutoBuilder.configure(
() -> getState().Pose, // Robot pose supplier
(pose) -> {
System.out.println("reset Pose " + pose.getX() + " " + pose.getY());
this.resetPose(pose);
this.resetPose(pose);
}, // Method to reset odometry (will be called if your auto has a starting pose)
() -> getState().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(ChassisSpeeds.discretize(speeds, 0.020))
.withWheelForceFeedforwardsX(feedforwards.robotRelativeForcesXNewtons())
.withWheelForceFeedforwardsY(feedforwards.robotRelativeForcesYNewtons())
), // ChassisSpeeds supplier. MUST BE ROBOT RELATIVE
//(speeds, feedforwards) -> this.applyRequest(()-> driveAuto.withSpeeds(speeds)), // Method that will drive the robot given ROBOT RELATIVE ChassisSpeeds. Also optionally outputs individual module feedforwards
new PPHolonomicDriveController( // PPHolonomicController is the built in path following controller for holonomic drive trains
new PIDConstants(5.0, 0.0, 0.0), // Translation PID constants
new PIDConstants(5.0, 0.0, 0.0) // Rotation PID constants
),
config, // The robot configuration
() -> {
// Boolean supplier that controls when the path will be mirrored for the red alliance
// This will flip the path being followed to the red side of the field.
// THE ORIGIN WILL REMAIN ON THE BLUE SIDE
var alliance = DriverStation.getAlliance();
if (alliance.isPresent()) {
return alliance.get() == DriverStation.Alliance.Red;
}
return false;
},
this // Reference to this subsystem to set requirements
new PPHolonomicDriveController(
// PID constants for translation
new PIDConstants(10, 0, 0),
// PID constants for rotation
new PIDConstants(7, 0, 0)
),
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
);
System.out.println("le mode auto est genere");
}
catch (Exception e) {
// Handle exception as needed
e.printStackTrace();
System.out.println("le mode auto ne marche pas");
} catch (Exception ex) {
DriverStation.reportError("Failed to load PathPlanner config and configure AutoBuilder", ex.getStackTrace());
}
// try {
// var config = RobotConfig.fromGUISettings();

View File

@@ -1,7 +1,7 @@
{
"fileName": "PathplannerLib-2025.2.7.json",
"fileName": "PathplannerLib-2025.2.6.json",
"name": "PathplannerLib",
"version": "2025.2.7",
"version": "2025.2.6",
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
"frcYear": "2025",
"mavenUrls": [
@@ -12,7 +12,7 @@
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-java",
"version": "2025.2.7"
"version": "2025.2.6"
}
],
"jniDependencies": [],
@@ -20,7 +20,7 @@
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-cpp",
"version": "2025.2.7",
"version": "2025.2.6",
"libName": "PathplannerLib",
"headerClassifier": "headers",
"sharedLibrary": false,