|
All-Time PID Drive with Hall-effects: Coming along very nicely
Hello, everyone.
For the past few weeks, I've been working feverishly to get PID drive (Joystick-commanded velocity) to work with our given hall-effect sensors. I'm proud to say that we've got our first working prototype.
It required a complete rewrite of the algorithm... I expanded the generic PID algorithm, and got an expression for delta-output based on the current error and the last error (Proportional+Integral only). I did get another equation for the derivative band, but it required too many multiplications -- saturating processor time for no good reason.
I also got rid of the whole structure's / OOP'ness of the NASA code (sorry guys!)... At one point, I seemed to get a bit of memory corruption (printf started spitting out RANDOM garbage, then code error). As a result, the code is much lighter now!
To stabilize the system, I added PWM sloping protection. This forces the controller to only change the PWM output from cycle-to-cycle by +/- 1. Sort of like a dampener, but with much less calculation. The hall-effect sensors that we mounted could only get ~ 35 ticks/loop, so the resolution was quite low, causing major overshooting/undershooting from loop to loop. The PWM sloping seemed to have corrected this.
Problems:
1. Still need to test. Haven't tested under all conditions yet.
2. Direction. Assuming direction based on commanded PWM direction seems quite effective, but I'm still seeing if there's a weakness.
After I send this through some internal testing, I plan to GPL and release our Default_Routine() function.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
|