JJRobots COMMUNITY
PID stuff - Printable Version

+- JJRobots COMMUNITY (http://forums.jjrobots.com)
+-- Forum: JJrobots (/forum-1.html)
+--- Forum: B-Robot (/forum-2.html)
+--- Thread: PID stuff (/thread-1507.html)



PID stuff - scandermore - 01-12-2018 10:40 AM

Hello!

I have been following balancing robots development for years, and now I decided to make one. Until now, this is the best mechanics/code I've found, with proper explanations, open source community... congratulations Jose and Juan!

I have a doubt/question about the stabilization PID. I have some experience programming PIDs at work so I was wondering why do you use a PD and integrate later... from what I know, integrating a PD is exactly the same as doing a PI, because the D integrated gives a P, and the P integrated results in a I.

I have been setting up my balancing robot with a PI in the stabilization stage, and it works the same, but the adjust and integral limit, etc... is more intuitive.

I have also seen that in your code, when you do the integration, the dt is not considered (in the PI and the PD it is considered), so if for some reason the main dt changed (a change in the IMU refresh timeout, for example) the PD part should be adjusted again.

A dt factor could be added to the integrator (and adjust again PD's) or a PI could be used, in which dt is already considered.

Just my two cents about almost a perfect code, for me. I'll post my updates when I finish my project.

Alex


RE: PID stuff - vanDijk - 01-16-2018 09:01 PM

Hello scandermore,
your posting is interesting for me. I had tried such a change to PIDstableControl() (without this +=) and with an additional integral part, in order to reduce the oscillations while the robot is standing. It seems to be some better, but the driving stability was rather bad. The robot wasn't able to stop immediately when I drive throttle=0 with smartphone.
Which experiences could you make concerning that.

Claus


RE: PID stuff - JJrobots JP - 01-17-2018 07:12 PM

Thanks! Keep us updated with your version of the PID control.
Regarding the dt: actually, the gyro (MPU-6050) providing a continuously updated value periodically, gives us the dt reference. It gives the equivalent of a "hardware clock"
The current version of the PID control is the result of several iterations. This one makes the B-robot behaves nicely in the static position and while moving (it is a well balanced PID control) BUT there are other versions (not published) which make the B-robot extremely stable but (as VanDijk commented) not as smooth to control when the robot wanders around. We have been looking for the best compromise between standing stability and control.

As stated above, please keep us updated with your experience! The current PID configuration does not have to be the optimum one.


RE: PID stuff - vanDijk - 02-08-2018 09:23 PM

(01-17-2018 07:12 PM)JJrobots JP Wrote:  Thanks! Keep us updated with your version of the PID control.
Regarding the dt: actually, the gyro (MPU-6050) providing a continuously updated value periodically, gives us the dt reference. It gives the equivalent of a "hardware clock"
The current version of the PID control is the result of several iterations. This one makes the B-robot behaves nicely in the static position and while moving (it is a well balanced PID control) BUT there are other versions (not published) which make the B-robot extremely stable but (as VanDijk commented) not as smooth to control when the robot wanders around. We have been looking for the best compromise between standing stability and control.

As stated above, please keep us updated with your experience! The current PID configuration does not have to be the optimum one.

Please excuse me for my long delay.
Some little things seem to improve the dynamic behavior: Anybody here in this forum had changed the frequency of the low-pass-filter for "estimated_speed_filtered", Coefficients are now 0.95/0.05. I think this and changing of the factor with "angular_velocity" from 25 to 50 had brought a small success.
The periodical update time dt is with my sketch-version not constant, because I don't use this "if (MPU6050_newData())". Disadvantage: The use of some additional "Serial.print()" e.g. change the periodical update time and the behavior of the robot. But I have the possibility to experiment with this time. My dt is only 3..4ms, with MPU6050-provided it would be 10ms?
I don't know, what is better? But the robot works rather fine, with a simple sonar by now too.
Perhaps some different control parameter settings, selectable with smartphone, would be good,
for instance for running and steering, for driving up a rising plane or for compensation a unsymmetric load. I will try it.
Thank you both once more!
Claus