From 2186fdf96161ebf857cc48425d782331f4f9c53e Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 17 Feb 2008 21:54:53 +0000 Subject: [PATCH] Lee ELLIOT: documentation for autopilot PID & PI controllers --- docs-mini/README.digitalfilters | 116 +++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 8 deletions(-) diff --git a/docs-mini/README.digitalfilters b/docs-mini/README.digitalfilters index c45ed1ccb..96d7defc5 100644 --- a/docs-mini/README.digitalfilters +++ b/docs-mini/README.digitalfilters @@ -1,34 +1,119 @@ -Four different types of digital low-pass filters can be configured inside the -autopilot configuration file. The types of filter are: +Six different types of digital filter can be configured inside the autopilot +configuration file. There are four low-pass filter types and two gain filter +types. + +The low-pass filter types are: * Exponential * Double exponential * Moving average * Noise spike filter -Example: +The gain filter types are: + +* gain +* reciprocal + +Example 1: pressure-rate-filter false double-exponential + + /autopilot/locks/pressure-rate-filter + true + /autopilot/internal/pressure-rate /autopilot/internal/filtered-pressure-rate 0.1 - + This will filter the pressure-rate property. The output will be to a new property called filtered-pressure-rate. You can select any numerical property from the property tree. The input property will not be affected by the filter, it will stay the same as it would if no filter was configured. +Example 2: + + + airspeed elevator-trim gain reciprocal filter + false + + /autopilot/locks/airspeed-elevator-trim-gain + true + + reciprocal + + /autopilot/settings/elevator-trim-airspeed-reciprocal-gain + 7 + + /velocities/airspeed-kt + /autopilot/internal/elevator-trim-gain + 0.005 + 0.02 + + +This will use the /velocities/airspeed-kt property to produce a gain factor +that reduces as airspeed increases. At airspeeds up to 350kt the gain will +be clamped to 0.02, at 700kt the gain will be 0.01 and at 1400kt the gain will +be 0.005. The gain will be clamped to 0.005 for airspeeds > 1400kt. + +The output from this filter could then be used to control the gain in a PID +controller: + + + Pitch hold + false + + /autopilot/locks/pitch + true + + + /orientation/pitch-deg + + + /autopilot/settings/target-pitch-deg + + + /autopilot/internal/target-elevator-trim-norm + + + 0.05 + + /autopilot/internal/elevator-trim-gain + 0.02 + + 1.0 + 0.1 + 0.0 + 2.0 + 0.2 + -1.0 + 1.0 + + + +IMPORTANT NOTE: The tag in PID controllers has been revised to operate in +the same way as the elements in filters. However, the original format +of will continue to function as before i.e. 0.02 will specify a +fixed and unalterable gain factor, but a warning message will be output. + +The gain type filter is similar to the reciprocal filter except that the gain +is applied as a simple factor to the input. +------------------------------------------------------------------------------- +Parameters + The name of the filter. Give it a sensible name! If this tag is set to true debugging info will be printed on the console. + Encloses the and tags which are used to enable or +disable the filter. Defaults to enabled if unspecified. + The type of filter. This can be exponential, double-exponential, -moving-average or noise-spike. +moving-average, noise-spike, gain or reciprocal. The input property to be filtered. This should of course be a numerical property, filtering a text string or a boolean value does not make @@ -36,16 +121,31 @@ sense. The filtered value. You can make up any new property. -These are the tags that are applicable to all filter types. The folowing tags + The minimum output value from the filter. Defaults to -infinity. + + The maximum output value from the filter. Defaults to +infinity. + +These are the tags that are applicable to all filter types. The following tags are filter specific. This tag is only applicable for the exponential and double-exponential filter types. It controls the bandwidth of the filter. The -bandwith in Hz of the filter is: 1/filter-time. So a low-pass filter with a -bandwith of 10Hz would have a filter time of 1/10 = 0.1 +bandwidth in Hz of the filter is: 1/filter-time. So a low-pass filter with a +bandwidth of 10Hz would have a filter time of 1/10 = 0.1 This tag only makes sense for the moving-average filter. It says how many past samples to average. This tag is applicable for the noise-spike filter. Is says how much the value is allowed to change per second. + + This, and it's enclosed and tags, are only applicable to +the gain and reciprocal filter types. The tag specifies a property node +to hold the gain value and the tag specifies an initial default value. +The gain defaults to 1.0 if unspecified. + +The output from the gain filter type is: input * gain. +The output from the reciprocal filter type is: gain / input. + +The gain can be changed during run-time by updating the value in the property +node.