Go Down

Topic: Balancing robot PID tuning trouble (Read 15720 times) previous topic - next topic

Southpark

#15
Jul 17, 2017, 08:21 am Last Edit: Jul 17, 2017, 08:41 am by Southpark
Hi Sancho. It's possible that your Kp value may be too large. At the moment, you have a value of 700 for Kp.

I guess it all depends on the relative scaling factors for your error signal...... but I think values of Kp are typically in the range of 10 to 20 or so. Having very large values of Kp can make the bot become unstable.

For testing..... just set Ki to zero for now. And leave Kd as it is. And, if possible.....make Kp much smaller than 700..... such as 15. But then again, it all depends on the what sort of error voltages you have. Although, 700 appears way too large.

Also, the code that you posted....... this code doesn't run within your robot, right? If it does.... then avoid using delay() functions. Delay() functions will slow the loop iteration time, and can make a control system sluggish and maybe glitchy.

Sancho

Hi Sancho. It's possible that your Kp value may be too large. At the moment, you have a value of 700 for Kp.

Thanks Southpark.
For my robot, only kp around 500 and 700 can keep it balance(even without kd), the value of kp from 0 to 100 makes it slow-responding and from 200 to 500 makes it swings back and forward (with my hand-holding), but that case it's just when I use the Kalman filter, I have tried the Complementary Filter before but I can't get it balance as easy as the Kalman filter, meanwhile the data from the Kalman seems like not really accurate than the Complementary filter.
And until now, I am sill not having a right way to tune my robot.

Go Up