Skip to content

Commit

Permalink
Merge pull request #601 from HHS81/Issue-599_magneticCompassTilt
Browse files Browse the repository at this point in the history
Magnetic Compass: Switched to exposed magnetic compass props for simulating roll and pitch axis
  • Loading branch information
hbeni authored Sep 9, 2024
2 parents 4eb3555 + 07b0ec4 commit 4aa61ef
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 75 deletions.
10 changes: 5 additions & 5 deletions Models/Instruments/Compass.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<clip>
<clipMin>-25</clipMin>
<clipMax>25</clipMax>
<property>instrumentation/magnetic-compass/roll-deg-final</property>
<property>instrumentation/magnetic-compass/roll-deg</property>
</clip>
</expression>
<factor>0.5</factor>
<factor>1.0</factor>
<axis>
<x> 1.0 </x>
<y> 0.0 </y>
Expand All @@ -48,13 +48,13 @@
<clip>
<clipMin>-9</clipMin>
<clipMax>9</clipMax>
<property>instrumentation/magnetic-compass/pitch-deg-final</property>
<property>instrumentation/magnetic-compass/pitch-deg</property>
</clip>
</expression>
<factor>0.5</factor>
<factor>1.0</factor>
<axis>
<x> 0.0 </x>
<y> -1.0 </y>
<y> 1.0 </y>
<z> 0.0 </z>
</axis>
</animation>
Expand Down
119 changes: 49 additions & 70 deletions Systems/instruments.xml
Original file line number Diff line number Diff line change
Expand Up @@ -686,47 +686,60 @@
<property>/instrumentation/magnetic-compass/deviation-deg</property>
</output>
</filter>
<filter>
<name>Magnetic compass pivot mounting</name>
<type>exponential</type>
<filter-time>5.0</filter-time>
<input>
<expression>
<product>
<property>/orientation/pitch-deg</property>
<value>-1</value>
</product>
</expression>
</input>
<output>
<property>/instrumentation/magnetic-compass/pitch-offset-deg</property>
</output>
<min> <property>instrumentation/magnetic-compass/pitch-limit-down</property> </min>
<max> <property>instrumentation/magnetic-compass/pitch-limit-up</property> </max>
</filter>
<filter>
<name>Magnetic compass stuck</name>
<type>gain</type>
<input>
<condition>
<or>
<less-than>
<property>/orientation/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-down</property>
</less-than>
<greater-than>
<property>/orientation/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-up</property>
</greater-than>
<less-than>
<property>/orientation/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-left</property>
</less-than>
<greater-than>
<property>/orientation/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-right</property>
</greater-than>
</or>
<!-- not stuck: look at current animation props -->
<and>
<not><property>instrumentation/magnetic-compass/stuck</property></not>
<or>
<less-than>
<property>/instrumentation/magnetic-compass/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-down</property>
</less-than>
<greater-than>
<property>/instrumentation/magnetic-compass/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-up</property>
</greater-than>
<less-than>
<property>/instrumentation/magnetic-compass/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-left</property>
</less-than>
<greater-than>
<property>/instrumentation/magnetic-compass/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-right</property>
</greater-than>
</or>
</and>
</condition>
<value>1</value>
</input>
<input>
<condition>
<!-- stuck: look if normal props are not above limits anymore -->
<and>
<property>instrumentation/magnetic-compass/stuck</property>
<or>
<less-than>
<property>/instrumentation/magnetic-compass/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-down</property>
</less-than>
<greater-than>
<property>/instrumentation/magnetic-compass/pitch-deg</property>
<property>instrumentation/magnetic-compass/pitch-limit-up</property>
</greater-than>
<less-than>
<property>/instrumentation/magnetic-compass/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-left</property>
</less-than>
<greater-than>
<property>/instrumentation/magnetic-compass/roll-deg</property>
<property>instrumentation/magnetic-compass/roll-limit-right</property>
</greater-than>
</or>
</and>
</condition>
<value>1</value>
</input>
Expand Down Expand Up @@ -771,40 +784,6 @@
<property>instrumentation/magnetic-compass/indicated-heading-deg-final</property>
</output>
</filter>
<filter>
<name>Magnetic compass pitch</name>
<type>exponential</type>
<filter-time>0.25</filter-time> <!-- simulate damping fluid -->
<input>
<condition>
<property>instrumentation/magnetic-compass/stuck</property>
</condition>
<property>instrumentation/magnetic-compass/pitch-deg-final</property>
</input>
<input>
<property>orientation/pitch-deg</property>
</input>
<output>
<property>instrumentation/magnetic-compass/pitch-deg-final</property>
</output>
</filter>
<filter>
<name>Magnetic compass roll</name>
<type>exponential</type>
<filter-time>0.25</filter-time> <!-- simulate damping fluid -->
<input>
<condition>
<property>instrumentation/magnetic-compass/stuck</property>
</condition>
<property>instrumentation/magnetic-compass/roll-deg-final</property>
</input>
<input>
<property>orientation/roll-deg</property>
</input>
<output>
<property>instrumentation/magnetic-compass/roll-deg-final</property>
</output>
</filter>

<!-- VSI damper -->
<!-- To dampen the needle a bit more, especially at very tiny changes (like parking) -->
Expand Down

0 comments on commit 4aa61ef

Please sign in to comment.