|
Re: PID loop speeds up as it gets closer to target?
Yes, I looked over your code, but I am unfamiliar with CPP.
Try printing out your PID error to the console. Knowing where the PID loop thinks it is can be very useful for debugging. If the PID loop is speeding up towards the setpoint, it could be that the PID does not correctly understand where it is, or the PID gain constants could be tuned poorly.
Seeing as you are only using a P term right now, I would suggest looking at the error that your PID loop sees. As I said earlier, the control system still needs to be in-phase. What you are seeing here could very likely be caused by a gyroscope and drive train that are out of phase.
|