Pathplanner trajectory causing robot to do extra spins

This offseason my team has switched to a swerve drive instead of a tank drive, so I had to switch from using pathweaver with RAMSETE to using pathplanner. It works pretty well for the most part save for one strange bug that I can’t figure out. during certain paths (attached to this post) the robot will follow the path correctly then, it will rotate in the opposite direction ~360 degrees while continuing to follow the path, and then it will keep going like nothing happened. My current thought process is that the feedback controller that handles heading doesn’t expect the angle to rap around (or does and its not rapping around properly) but I’m really not sure and I was wondering if anyone had encountered anything similar.

Thanks in advance.

1 Like

You didn’t share your code. If you’re using a PIDController for the heading, did you call enableContinuousInput?


I’m using the ProfiledPIDController class from wpilib to control the heading. enableContiniousinput was not being called, so this very well may be it. I will definitely test this ASAP thank you very much!


Alright, so you said you were using Ramsete before, but you have Pathplanner in holonomic mode. I assume since you were using ramsete you have a differential drive, but you’re following paths like you expect it to be holonomic

Read the first sentence again. They’re doing an off-season swerve.

Yeah someone responded to me and I responded, but the response has disappeared into the void idk

Sorry, to clarify we are using Pathplanners PPSwerveControllerCommand which is a slightly modified version of WPIs SwerveControllerCommand. We are not using RAMSETE.

Make sure that you enabled continuous input on your rotation controller between -PI and PI (this must be radians). I would also check to see if the gyro angle you are creating your robot pose with is 0 to 360 or -180 to 180. I don’t remember if this causes problems or not but a good thing to check anyways. Pathplanner expects -180 to 180 (or -pi to pi if you use radians).

There’s also the possibility that something is wrong with pathplanner. It looks like you’re using the last release version and there have been a lot of changes/fixes since then, including commands that handle the continuous input stuff for you. If none of the suggestions above work, you could try copying the source for pathplannerlib into your project to use the most recent version to see if that helps.

The continuous input was the issue. Thank you so much for the response.

1 Like

This was it, thanks!

1 Like