When flying any aerial vehicle make sure to check local regulations before flying. Always check battery levels, frame stability, and the strength of any connections before flying to prevent catastrophic failure. Most areas now require a permit or written consent of landowners to fly in an area and have height requirements. For US users check http://knowbeforeyoufly.org for information.
PID refers to a large set of algorithms. In the case of drones it refers more specifically to a set which a flight controller uses to adjust motor speed for movement based off instructions and sensor data. The calibration of the PID settings on a drone can greatly reduce the amount of wobble that occurs after a quick maneuver and improve stability.
What is PID?PID stands for Proportional Integral Derivative and is a form of calculation widely used in devices that involve movement. In drones the goal of PID is to both move in a direction when told to and also compensate for momentum when executing an action.
What do bad PID settings look like?Bad PID settings have noticeable affects on flight. The main thing you will notice is the drone failing to come to a position quickly. If the PID settings are off they will cause it to over or under correct causing it to oscillate between positions before coming to a rest.
The video below shows the effects of different bad PID settings. The video remains steady as they seemingly had a gimbal, but viewing the overlaid data shows the effects it is having on the drone and how the drone tries to deal with movement.
A search on YouTube will yield more results showing how bad PID can even lead to crashes.
Implementing a PIDThe sections below describe the basics of each part of a PID and provide pseudo code for how it can be implemented. Note that desired and current refer to an x, y, or z value and are executed for each axis. Also, the settings refer to the values that you end up changing for your drone. They determine how dramatic the individual controller's response is.
P (Proportional)Basic purpose:
Deal with current error (fixes difference between desired and actual position).
Calculation:
(current - desired) * P_setting
I (Integral)Basic purpose:
Deal with past error (fixes error uncorrected in previous cycle).
Calculation:
last_I_result + ((current - desired) * I_setting)
D (Derivative)Basic purpose:
Deal with future error (accounts for error that may result from operation based on current rate of change).
Calculation:
((current - desired) - (last_current_value - last_desired_value)) * P_setting
Calibrating the PID on your droneNone of this information is useful unless you can use it to improve the flight of your drone. Doing so requires that your drone has the ability to change these settings. It is important to know that there is no one perfect setting, even with two drones of the same model. Depending on how you like to fly and any additional weight on your drone the right settings for you may vary from someone with an identical model.
To calibrate the PID on your drone you need to have some considerable time and probably and extra charged battery. This is because you have to check the settings for each controller (P, I and D) and some flight controllers even have them isolated by further (is case the drone frame is not balanced).
For each test you have to do the same thing, which is to execute swift maneuvers, such as full throttle and then coming to an abrupt stop. Then observe the drone, if it wobbles back and forth more than 1-2 times or the wobbles are very large you need to change your settings. Start by increasing or decreasing the settings and repeat the maneuver. If the wobbling becomes worse move in the opposite direction. If it improves continue the adjustment in the same way. Stop repeating this process when your changes no longer can make it better, this means it is time to check another controller.
All the controllers work together and need to be tested together. When all the settings are as good as you can get them execute turns, stops and forward flight and high speeds. If you notice any of the following problems further adjustment could benefit you:
- Oscillations on any axis after stopping
- In forward flight the drone consistently drifts in one direction
- When flying in a circle it becomes wider and wider as you continue
Changing your PID settings will improve flight if they were not set correctly before, but in no way will fix all your problems or guarantee perfect flight. It is important to perform other tune ups such as prop balancing before flying.
Comments