I have been facing some problems which I was not able to solve for a few days. The problem of high rise time of the P controller and the problem of P controller over the heading control. In brief, the heading error could not be compensated using P controller for small errors because say a response of 1RPM is a very slow wheel speed. And if I gain it would oscillate till eternity.
I met a M.Tech senior (because he was facing some problem in MATLAB) yesterday and he showed me a PID video of MIT. So when I sat today in lab I thought to tinker with my controller instead of parameters or logic or frequencies. I added a derivative term and this how my system evolved,
P = 0.02, D = 0.0 This was my earlier P response. Efficient but slow.
P = 0.08
System oscillations apparently visible
P = 0.08, D = 0.1
Derivative starts nullifying oscillations
P = 0.08, D = 0.2
P = 0.08, D = 0.3
P = 0.08, D = 0.4
Almost no oscillations
P = 0.08, D = 0.5
P = 0.08, D = 0.6
Oscillations start to increase back. Guess this is D limit
P = 0.06, D = 0.5
Decreasing P gain now to damp the overshoot
Almost perfect
P = 0.06, D = 0.4
Derivative decreased a little more because it would bring some over response when motor stopped
This is the video of the robot with all wheels tuned with PD controller and the heading feedback going through a PD controller. The Heading PD controller needs further tuning.
So this was the evolution of my P controller to PD controller.
In the control system applied on RPi3 (upper control loop) which sends the set variable to the Tiva boards, a P regulator was implemented to keep the heading constant on the basis of readings of the IMU. The conclusions after the tuning can be seen in the video. There is a bit of drift in the heading even though.
Next step would be to give it a finesse touch and add positioning encoders to have x and y coordinate feedbacl. The loaded hysteresis curve will also need to be looked at,