Autopilot configuration reference: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (→‎Monostable flip flop <monostable>: corrected position of explanatory text to be before the example code)
No edit summary
Line 747: Line 747:
   <output>autopilot/internal/oscillation</output>
   <output>autopilot/internal/oscillation</output>
</filter>
</filter>
</syntaxhighlight>
=== Coherent-noise filter (random number generator) ===
Generates coherent random numbers. Not ''that'' useful for an autopilot, however handy in some other situations where you usually first think of a [[Nasal_library#rand.28.29|Nasal rand()]] in a loop.
<syntaxhighlight lang="xml">
<filter>
        <name>Ground bumps</name>
        <!-- calculate the ground bump number: The rate and ammount of change simulates bumps in the surface -->
        <type>coherent-noise</type>
        <debug>false</debug>
        <enable>
            <condition>
                <property alias="/params/groundshake/has-ground-contact"/>
                <property alias="/params/groundshake/is-moving"/>
            </condition>
        </enable>
        <input>
            <!-- depending on position: the faster we go, the faster the prop changes, the faster the bumps come in -->
            <expression>
                <product>
                    <sum>
                        <property>/position/latitude-deg</property>
                        <property>/position/longitude-deg</property>
                    </sum>
                    <value>50</value>
                </product>
            </expression>
        </input>
        <output><property alias="/params/groundshake/rng-source"/></output>
        <amplitude>0.5</amplitude>
        <absolute type="bool">false</absolute>
        <discrete-resolution>1024</discrete-resolution> <!-- frequency of the changes/bumps: the smaller, the more wide the bumps are -->
    </filter>
</syntaxhighlight>
</syntaxhighlight>


601

edits

Navigation menu