PID with MA3 encoder

Recently I’ve been working on a auto calibration code for our swerve drive robot, that uses a MA3 encoder along with the one in the NEO 550 motor to control the angle of the wheels.

The problem is when I use any kind PID with the MA3 as the input for the process variable, the wheels will keep spinning and wont stop, my guess is that since that the MA3 encoder has a voltage range of 0 to 5V. And to a understanding is that when it passes back to zero the PID will speed up to catch up back to the setpoint that I’ve set, and when that happens it’ll keep passing back to zero.

Do you have your question answered yet? If not, I’ll start by saying the units of an encoder output aren’t important but units have to be consistent with your setpoint, the units of the absolute offset for what is forward on the robot has to be consistent with your setpoint, and you have to set the “continuous” parameter to tell the controller the encoder output is a sawtooth shape for each revolution.

For ease of use by humans we usually work in degrees of angle and pick a range or 0 to 360 or -180 to 180. Radians are also seen often but my team doesn’t like to work in radians. Leaving the units in the range of 0 to 5 volts is even worse and doesn’t lend to ease of use for most people. (What’s forward on the robot? 1.63 volts? PID won’t care but we think it’s icky. That’s not instant recognition and confusion can result in wrong setpoints and offsets!)

That’s not to say you have to convert from volts. A lot of teams are feel “forced” into using, for example, inhuman units for Talons’ internal PIDF and there is a lot of confusion and grumbling about it.

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