We are trying to use PID loops through our Jags with speed commands, but the result is jerky, and the jags are alternating between powered and unpowered. All I’m doing is enabling PID control on the drive and then sendng it a constant command of 200 rpm in the autonomous loop. Ideas?
How did you choose your PID gains?
Our mentor helped us with that. But the problem is that the jags aren’t getting a command periodically, resulting in an on and off jerky motion. The connections appear to be fine. We used the getOutputVoltage() method, and it alternated between zero and not zero.
The question still stands. Improper PID gains could cause the system to behave in the way you described.
Pretend you’re in a really sensitive shower trying to get just the right amount of hot water. You move the knob what you think is just a little bit, but then the water is scalding. You turn it back, moving it even less than before, but now the water is cold as ice. No matter what you do, you can’t find any middle ground between “earth’s core” and “ice age.” The problem here isn’t necessarily that your shower is broken, you’re just applying way too much force on a knob that’s too sensitive.
It sounds like the gains of your system are too high - try to set all the constants to zero and apply the Zeigler-Nichold method of tuning. Basically, set everything to 0 and slowly raise P until you see oscillation. Then add I and D based on how you want your system to behave. It’s not the best method of determining constants, but it’s often a good place to start.