Added Nas function that calculates distance and bearing to target.
This commit is contained in:
parent
5e6942fb36
commit
3e39eaedfa
15
HUD.xml
15
HUD.xml
@ -305,12 +305,11 @@
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
<input>
|
||||
<property>/orientation/heading-deg</property>
|
||||
<property>/tracking/bearing</property>
|
||||
<factor>1.0</factor>
|
||||
</input>
|
||||
<format>%3.2f</format>
|
||||
<format>BRG %3.2f</format>
|
||||
<halign>left</halign>
|
||||
<prefix>BRG </prefix>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
@ -320,12 +319,11 @@
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
<input>
|
||||
<property>/position/altitude-agl-ft</property>
|
||||
<property>/tracking/rng-km</property>
|
||||
<factor>1.0</factor>
|
||||
</input>
|
||||
<format>%3.4f</format>
|
||||
<format>RNG %3.2f</format>
|
||||
<halign>left</halign>
|
||||
<prefix>RNG </prefix>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
@ -335,12 +333,11 @@
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
<input>
|
||||
<property>/position/altitude-agl-ft</property>
|
||||
<property>/tracking/rng-nml</property>
|
||||
<factor>1.0</factor>
|
||||
</input>
|
||||
<format>%3.4f</format>
|
||||
<format>RNG %3.2f</format>
|
||||
<halign>left</halign>
|
||||
<prefix>RNG </prefix>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
@ -463,6 +463,10 @@
|
||||
<file>Aircraft/MQ-9/Nasal/Crash.nas</file>
|
||||
</Crash>
|
||||
|
||||
<Tracking>
|
||||
<file>Aircraft/MQ-9/Nasal/Tracking.nas</file>
|
||||
</Tracking>
|
||||
|
||||
<Turret>
|
||||
<file>Aircraft/MQ-9/Nasal/Turret.nas</file>
|
||||
</Turret>
|
||||
|
@ -85,7 +85,7 @@
|
||||
<z> -10.82 </z>
|
||||
</location>
|
||||
<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>
|
||||
<location name="POINTMASS" unit="IN">
|
||||
<x> 207.84 </x>
|
||||
|
0
Nasal/Crash.nas
Executable file → Normal file
0
Nasal/Crash.nas
Executable file → Normal file
0
Nasal/ENAV.nas
Executable file → Normal file
0
Nasal/ENAV.nas
Executable file → Normal file
0
Nasal/Engine.nas
Executable file → Normal file
0
Nasal/Engine.nas
Executable file → Normal file
0
Nasal/HUD.nas
Executable file → Normal file
0
Nasal/HUD.nas
Executable file → Normal file
0
Nasal/Lights.nas
Executable file → Normal file
0
Nasal/Lights.nas
Executable file → Normal file
0
Nasal/Liveries.nas
Executable file → Normal file
0
Nasal/Liveries.nas
Executable file → Normal file
0
Nasal/Radar.nas
Executable file → Normal file
0
Nasal/Radar.nas
Executable file → Normal file
37
Nasal/Tracking.nas
Normal file
37
Nasal/Tracking.nas
Normal 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
0
Nasal/Tyresmoke.nas
Executable file → Normal file
Loading…
Reference in New Issue
Block a user