Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/main/java/frc/robot/subsystems/drive/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public class Drive extends SubsystemBase {
};
private ChassisSpeeds chassisSpeeds;

// PathPlanner trajectory logging (stored each loop for AKit compatibility)
private Pose2d[] lastTrajectory = new Pose2d[0];

// PID controllers for following Choreo trajectories
private final PIDController xController = new PIDController(8.01, 0.0, 0.0);
private final PIDController yController = new PIDController(8.01, 0.0, 0.0);
Expand Down Expand Up @@ -129,12 +132,7 @@ public Drive(
Pathfinding.setPathfinder(new LocalADStarAK());
PathPlannerLogging.setLogActivePathCallback(
(activePath) -> {
Logger.recordOutput(
"Odometry/Trajectory", activePath.toArray(new Pose2d[activePath.size()]));
});
PathPlannerLogging.setLogTargetPoseCallback(
(targetPose) -> {
Logger.recordOutput("Odometry/TrajectorySetpoint", targetPose);
if (!activePath.isEmpty()) lastTrajectory = activePath.toArray(new Pose2d[0]);
});

// Configure SysId
Expand Down Expand Up @@ -220,6 +218,9 @@ public void periodic() {
gyroDisconnectedAlert.set(gyroDisconnected);
Logger.recordOutput("Faults/Drive/GyroDisconnected", gyroDisconnected);

// Log PathPlanner trajectory (stored by callback, recorded here for AKit compatibility)
Logger.recordOutput("Odometry/Trajectory", lastTrajectory);

// Profiling output
if (FeatureFlags.PROFILING_ENABLED) {
long totalMs = (t6 - startNanos) / 1_000_000;
Expand Down
Loading