mode auto

This commit is contained in:
Antoine PerreaultE
2025-03-04 17:37:15 -05:00
parent 004890fd7b
commit c0e7985ab7
6 changed files with 54 additions and 54 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.
@@ -100,7 +100,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
if (Utils.isSimulation()) {
startSimThread();
}
configureAutoBuilder();
//configureAutoBuilder();
}
/**
@@ -125,7 +125,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
if (Utils.isSimulation()) {
startSimThread();
}
configureAutoBuilder();
// configureAutoBuilder();
}
/**
@@ -158,7 +158,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
if (Utils.isSimulation()) {
startSimThread();
}
configureAutoBuilder();
//configureAutoBuilder();
}