Added Nas function that calculates distance and bearing to target.

This commit is contained in:
Meir Michanie 2016-07-08 18:13:15 +03:00
parent 5e6942fb36
commit 3e39eaedfa
12 changed files with 48 additions and 10 deletions

15
HUD.xml
View File

@ -305,12 +305,11 @@
<width>1</width> <width>1</width>
<height>1</height> <height>1</height>
<input> <input>
<property>/orientation/heading-deg</property> <property>/tracking/bearing</property>
<factor>1.0</factor> <factor>1.0</factor>
</input> </input>
<format>%3.2f</format> <format>BRG %3.2f</format>
<halign>left</halign> <halign>left</halign>
<prefix>BRG </prefix>
</label> </label>
<label> <label>
@ -320,12 +319,11 @@
<width>1</width> <width>1</width>
<height>1</height> <height>1</height>
<input> <input>
<property>/position/altitude-agl-ft</property> <property>/tracking/rng-km</property>
<factor>1.0</factor> <factor>1.0</factor>
</input> </input>
<format>%3.4f</format> <format>RNG %3.2f</format>
<halign>left</halign> <halign>left</halign>
<prefix>RNG </prefix>
</label> </label>
<label> <label>
@ -335,12 +333,11 @@
<width>1</width> <width>1</width>
<height>1</height> <height>1</height>
<input> <input>
<property>/position/altitude-agl-ft</property> <property>/tracking/rng-nml</property>
<factor>1.0</factor> <factor>1.0</factor>
</input> </input>
<format>%3.4f</format> <format>RNG %3.2f</format>
<halign>left</halign> <halign>left</halign>
<prefix>RNG </prefix>
</label> </label>
<label> <label>

View File

@ -463,6 +463,10 @@
<file>Aircraft/MQ-9/Nasal/Crash.nas</file> <file>Aircraft/MQ-9/Nasal/Crash.nas</file>
</Crash> </Crash>
<Tracking>
<file>Aircraft/MQ-9/Nasal/Tracking.nas</file>
</Tracking>
<Turret> <Turret>
<file>Aircraft/MQ-9/Nasal/Turret.nas</file> <file>Aircraft/MQ-9/Nasal/Turret.nas</file>
</Turret> </Turret>

View File

@ -85,7 +85,7 @@
<z> -10.82 </z> <z> -10.82 </z>
</location> </location>
<pointmass name="Payload"> <pointmass name="Payload">
<description> 4039.89 LBS should bring model up to entered max weight</description> <description> 4039.89 LBS + full (1280 LBS) fuel should bring model up to entered max weight</description>
<weight unit="LBS"> 2019.94 </weight> <weight unit="LBS"> 2019.94 </weight>
<location name="POINTMASS" unit="IN"> <location name="POINTMASS" unit="IN">
<x> 207.84 </x> <x> 207.84 </x>

0
Nasal/Crash.nas Executable file → Normal file
View File

0
Nasal/ENAV.nas Executable file → Normal file
View File

0
Nasal/Engine.nas Executable file → Normal file
View File

0
Nasal/HUD.nas Executable file → Normal file
View File

0
Nasal/Lights.nas Executable file → Normal file
View File

0
Nasal/Liveries.nas Executable file → Normal file
View File

0
Nasal/Radar.nas Executable file → Normal file
View File

37
Nasal/Tracking.nas Normal file
View File

@ -0,0 +1,37 @@
#Place holder
var getTrackData = func {
# me.ac = geo.aircraft_position();
# me.distance = me.ac.distance_to(me.coord);
# me.bearing = me.ac.course_to(me.coord);
# var dalt = alt - me.ac.alt();
# var ac_hdg = getprop("/orientation/heading-deg");
# var ac_pitch = getprop("/orientation/pitch-deg");
# var ac_contact_dist = getprop("/systems/refuel/contact-radius-m");
# var elev = math.atan2(dalt, me.distance) * R2D;
#
# print("My test module got loaded!");
#var broken = func {
var rngM=110000.0;
var brg=0.0;
#
var tgt=geo.click_position();
if (tgt != nil){
var ac=geo.aircraft_position();
var distance = ac.distance_to(tgt);
var bearing =ac.course_to(tgt);
#setprop("/tracking/test",tgt.lat());
rngM=distance;
brg=bearing;
}
#
# # finally, write the result to the property tree using the setprop() call
#setprop("tracking/engine[0]/egt-degc", degC);
setprop("/tracking/rng-km", rngM * 0.001);
setprop("/tracking/rng-nml", rngM * 0.000539957);
setprop("/tracking/bearing",brg);
}
setlistener("sim/signals/click", getTrackData,1);
#settimer(getTrackData, 0.1);

0
Nasal/Tyresmoke.nas Executable file → Normal file
View File