|In the navigation PIDs, we control the vertical movement (altitude) and horizontal movement (location)of your AutoQuad. Both PIDs work independent from each other and they’re run at 200Hz.|
There are two horizontal navigation PIDs connected to each other. One controls AQ’s horizontal speed (navigation speed rate) and the other controls its distance to target (navigation distance rate). You won’t find any D terms here because we deal with relatively slow changing signals, thus these are actually PI controllers.
WARNING! There have been reports of certain PID values over saturating the motor outputs possibly causing a crash if not adjusted properly. Read our forum thread here.
The navigation distance rate accepts distance commands (in meters) and calculates the error depending on current position. This PI outputs a horizontal speed command (m/s), which enters the navigation speed rate PI. Here the speed is compared with current speed from sensors and the error is regulated and outputted as a tilt angle (in degrees).
In this example (actually the defaults), every one meter error in distance will result in a 0.5 m/s velocity. This velocity is entered into the speed PI, which gives 6 degs of tilt for each m/s input. Another 0.005 degs is added to the output every 1/200′s of a second it takes to reach the target, i.e., each one second away from the target will add 1 degree to the output. The maximum allowed tilt change, is 20 degs for P term and 20 degs for I term. However, the maximum allowed tilt change from the whole PI is only 30 degs.
|So if we are 100m away from the target, the first controller will try to set it on 0.5m/s x 100m = 50m/s.
The second controller will try to get that 50m/s x 6 degrees = 300 degs. But, it is limited to 20 degrees and 1 x 100 = 100 degs are added each second.
However, the whole output is limited to a combined 30 degs. With these values, when the target is 100m away, the copter will tilt a maximum of 30 degs.
|The navigation Speed PM,IM,OM values are in degrees. They behave as standard PID controls.
The PM is used to navigate in gusting wind condition, the IM in steady wind, the OM limits the total
The same concepts applied early are utilized here. In the above settings (screen), every one meter error in altitude will result in a 0.25 m/s vertical velocity. The maximum speed is 2 m/s.
The vertical velocity is entered into the navigation altitude speed PI, which gives 200 microseconds of throttle PWM for each m/s input.
Another 1.2 microseconds is added to the output every 1/200′s of a second it takes to reach the target, i.e., each one second away from the target will add 240 microseconds to the output.
The maximum allowed PWM width, is 150 microseconds for P term and 600 microseconds for I term.
The maximum allowed PWM width from the whole PI, however, is 600 microseconds of throttle response.
|By now you sure to be bored to death from all this reading! OK, let’s get into what’s important. Let’s see how PIDs can save your (and your copter) life, and what kind of problems they can solve for you.
Move over to the practical tuning and troubleshooting.