PID Continuous Mode Not wrapping

So let me explain the problem we are currently programming a part of our robot that has unlimited 360 degree rotation. At the moment we have a relative encoder on the mechanism and but it programmed like an absolute. We have it so when it is straight it returns 0 and left 90 degrees is is -pi/2 and full 180 is -pi and pi depending on the rotation direction. We currently have a profiled pid controller from the new wpilib controlling it we also have the pid controller in continuous Mode with min input as -pi and max as pi. When we try to cross the gap it instead take the long way around instead of crossing over from -pi to pi. Does anyone know where I went wrong or if there is any thing else I need to configure besides setting continuous with min and Max encoder values or is there something wrong with the continuous Mode in the PID controller.

Appears to be a bug in ProfiledPIDController. The method call for enabling continuous input simply forwards to the call for the underlying PIDController, so the PIDController will work as expected, but the motion profile is still going to be generated going the long way 'round.

We’ll add a fix to the next release.

Thanks for the information I though I was loosing my mind.

Until we actually do a release with this PR, you could see if this fixes it.

I copied the classes them into my program and I am using them however it does not seem to be working correctly. The mechanism instead seems to be jumping forward twice then going slowly back to the correct target.

I believe I have fixed it never mind it was a problem with my code…

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