Hi, 

I have just commited a new feature for the XMLAutopilot.
Each filter supports periodical values at it's inputs and the output.

This is best described by an example:
Image you want to compute your heading offset as a delta between your magnetic 
heading and your autpilot's target heading with the following simple-pid-
controller:

  <pi-simple-controller>
    <name>AP:Heading Offset Computer</name>
    <debug>false</debug>
    <input>
      <property>orientation/heading-magnetic-deg</property>
    </input>
    <reference>
      <property>autopilot/settings/target-heading-deg</property>
    </reference>
    <output>autopilot/internal/heading-offset-deg</output>
    <config> <!-- just build the delta, no integration -->
      <Kp>1.0</Kp>
      <Ki>0.0</Ki>
    </config>
    <period> <!-- this is funky new stuff -->
      <min>-180</min>
      <max>180</max>
    </period>
  </pi-simple-controller>
which computes 
  output = reference - input 
or 
  heading-offset-deg = target-heading-deg - heading-magnetic-deg
with possible results of -359..+359 which is more or less useless.

For the following stages of the autopilot it would be best to have the output 
in the range of -180..+180, telling you to steer left or right (on the 
shortest path) to your new heading. 
This can now be achieved by using the <period> tag. It tells the digital 
filter to shift either the input or output value into the given period by 
adding/substracting multiples of one period (360 in the given example).

The above examples writes 10 to heading-offset-deg if target-heading-deg is 
zero and heading-magnetic-deg is 350 (-350 without the <period> element).

You may choose to normalize the value at the input, so all internal 
computations use the normalized value or process the unaltered input value and 
than normalize the output value (like in the given example).

This should make several Nasal based helper functions for autopilots obsolete. 

I tried my best to document everything in README.digitalfilters.

BTW: the <min>/<max> elements are complex types like any other input element. 
You may use properties, scaling, offsetting and conditions if you really want 
something complicated like:
<period>
  <min>
    <condition>
      <equals>
        <property>/settings/angular-unit</property>
        <value>radians</value>
      <equals>
    </condition>
    <property>/constants/a-property-containing-the-value-of-pi</property>
    <condition>
      <equals>
        <property>/settings/angular-unit</property>
        <value>degrees</value>
      <equals>
    </condition>
    <value>-90</value>
    <factor>2.0</factor>
  </min>
  <max>
[..]skipped due to laziness[..]
  </max>
  
No intentional changes for existing autopilot implementations come with this 
patch, the <period> tag is optional.

Torsten

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to