Swerve Trajectory looks wrong

Using WPILib’s SwerveControllerCommand with TrajectoryGenerator generated trajectories, I am seeing weird behavior where the chassis will curve around, almost as if it were a tank drive, rather than going straight to the next demanded endpoint. I believe it has to do with TrajectoryGenerator ensuring Continuous curvature, but I do not know how else to generate a trajectory for use with SwerveControllerCommand. Does anyone know how to fix this?
Code: https://github.com/Team4028/2022-Season/blob/CR/shooter/src/main/java/frc/robot/utilities/Trajectories.java
Edit: By curve around I mean at the start of the trajectory it goes back and around before going forward.

Yes, the WPILib trajectory generator does not currently “support” swerve, the heading targets are for a differential drive to follow the path. You need to supply an additional rotation for the swerve to rotate to while path following-- you can write your own implementation to do this but I would recommend simply looking at PathPlanner which handles this for you.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.