-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PID Controller #35
Comments
Hi @PaddyCube anti-windup is to preventing the integral error from growing too much. Put in a simple python example this is how the integral error is clamped (in this example between -2 and 2):
F is the feedforward term and used to reach the set point faster. Which hardware and "version" of
Recently, I made a major code change regarding where to put the PID controller. Option 2 is currently my preferred method and implemented in the latest commits of With option 1 you have the comfort of dynamic reconfigure to tune the (F)PID controller but for me definetely the second option feels more stable. To tune the PID values with the second option you need to change the values in code. I am planning to use dynamic reconfigure however, and send topics to the low level firmware running on the Teensy mcu. In general I cannot recommend which option to choose but for me definitely option 2 worked better so far. To tune the PID controller, this youtube video might help. It gives some insights what the PID parameters influence. Regarding the F term, I would start setting it to zero. |
Is possible to disable the PID, so the robot wouldn't oscillate during the teleops? |
@darld disabling the PID is not directly possible, since you would create an open loop without feedback from the velocity error. Therefore, I would first suggest to tune the PID correctly to avoid the oscillations. This way you can leverage all the features from ROS Controls diff_drive_controller. However, in case you don't want to use this controller, you could also try to update the diffbot/diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h Lines 501 to 510 in ece43cb
This is where the PID is used to compute the PWM motor signals from the velocity error. Instead of calling the PID you would have to translate the commanded velocity (from the |
Not sure whether I can just set the diffbot/diffbot_base/src/pid.cpp Lines 35 to 39 in ece43cb
|
Please note that this is the "old" PID controller that was running in the high level hardware interface, as I mentioned in my comment previously. If you flashed the However, I would suggest you try to use the diffbot/diffbot_base/scripts/base_controller/lib/config/diffbot_base_config.h Lines 18 to 20 in ece43cb
The drawback of this method is that you currently have to re-flash the microcontroller every time you change the PID values. However, I am planning to add a topic to change these values for a better tuning experience. |
Regarding the tuning process. You mentioned oscillations, which might happen because of a too high proportional gain. So I would start the tuning by setting these values: P = something small until no oscillations are observable Only increase the I and D gains once you see stable results with a P value not equal to zero. Setting the |
Hello,
could you please explain the values of PID controller? What is f, antiwindup, i_clampmin and i_clampmax good for?
I tried different values with no luck so far. Acceleration seems to work but when I stop the robot with a velocity of 0m/s, it starts to oscillate back and forth endless
The text was updated successfully, but these errors were encountered: