Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b12e139b2c | ||
|
|
b1403b3066 | ||
|
|
3376a6f35d | ||
|
|
1d22597d3f | ||
|
|
467336590b |
@@ -1,8 +1,12 @@
|
||||
# CHANGELOG
|
||||
|
||||
## v.1.5.0
|
||||
|
||||
- Add Towrope Configuration dialog
|
||||
|
||||
## v.1.4.1
|
||||
|
||||
- Fix carsh by missing parameter
|
||||
- Fix crash by missing parameter
|
||||
|
||||
## v.1.4.0
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ var main = func(addon) {
|
||||
#
|
||||
var loadExtraNasalFiles = func (addon) {
|
||||
var modules = [
|
||||
"nasal/timer",
|
||||
"nasal/aircraft",
|
||||
"nasal/message",
|
||||
"nasal/dialogs/route",
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
<dialog-name>route-aerotow</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Towrope Configuration</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>towrope-config</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Call for Piper J3 Cub aircraft</label>
|
||||
<binding>
|
||||
@@ -79,11 +86,9 @@
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
# Run stopAerotow() with a delay to ensure that the engine sound turns off
|
||||
var timer = maketimer(1, func () {
|
||||
aerotow.Timer.new().singleShot(1, aerotow.g_Aerotow, func () {
|
||||
aerotow.g_Aerotow.stopAerotow();
|
||||
});
|
||||
timer.singleShot = 1;
|
||||
timer.start();
|
||||
]]></script>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<addon>
|
||||
<identifier type="string">org.flightgear.addons.Aerotow</identifier>
|
||||
<name type="string">Aerotow Everywhere</name>
|
||||
<version type="string">1.4.1</version>
|
||||
<version type="string">1.5.0</version>
|
||||
|
||||
<authors>
|
||||
<author>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<hrule/>
|
||||
|
||||
<text>
|
||||
<label>Aerotow Everywhere version 1.4.1 - 20th August 2022</label>
|
||||
<label>Aerotow Everywhere version 1.5.0 - 22nd August 2022</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
|
||||
342
gui/dialogs/towrope-configuration.xml
Normal file
342
gui/dialogs/towrope-configuration.xml
Normal file
@@ -0,0 +1,342 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<PropertyList>
|
||||
<name>towrope-config</name>
|
||||
<layout>vbox</layout>
|
||||
<default-padding>5</default-padding>
|
||||
<modal>false</modal>
|
||||
<width>680</width>
|
||||
|
||||
<!-- title bar -->
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
<text>
|
||||
<label>Towrope Configuration</label>
|
||||
</text>
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
<button>
|
||||
<legend/>
|
||||
<key>Esc</key>
|
||||
<pref-width>16</pref-width>
|
||||
<pref-height>16</pref-height>
|
||||
<border>2</border>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<!-- aerotow parameters -->
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
||||
<group>
|
||||
<layout>table</layout>
|
||||
|
||||
<!-- tow length -->
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Towrope Length</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label></label>
|
||||
<live>true</live>
|
||||
<format>%.0f m </format>
|
||||
<property>/sim/hitches/aerotow/tow/length</property>
|
||||
<color>
|
||||
<red>0.2</red>
|
||||
<green>0.9</green>
|
||||
<blue>0.2</blue>
|
||||
</color>
|
||||
</text>
|
||||
|
||||
<!-- break force -->
|
||||
<text>
|
||||
<row>1</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Weak Link Break Force</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>1</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label></label>
|
||||
<live>true</live>
|
||||
<format>%.0f N </format>
|
||||
<property>/sim/hitches/aerotow/tow/brake-force</property>
|
||||
<color>
|
||||
<red>0.2</red>
|
||||
<green>0.9</green>
|
||||
<blue>0.2</blue>
|
||||
</color>
|
||||
</text>
|
||||
|
||||
<!-- tow characteristic -->
|
||||
<text>
|
||||
<row>2</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Towrope Elastic Constant</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>2</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label></label>
|
||||
<live>true</live>
|
||||
<format>%.0f N</format>
|
||||
<property>/sim/hitches/aerotow/tow/elastic-constant</property>
|
||||
<color>
|
||||
<red>0.2</red>
|
||||
<green>0.9</green>
|
||||
<blue>0.2</blue>
|
||||
</color>
|
||||
</text>
|
||||
|
||||
<!-- tow thickness -->
|
||||
<text>
|
||||
<row>3</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Towrope Diameter</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>3</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label></label>
|
||||
<live>true</live>
|
||||
<format>%.0f mm</format>
|
||||
<property>/sim/hitches/aerotow/rope/rope-diameter-mm</property>
|
||||
<color>
|
||||
<red>0.2</red>
|
||||
<green>0.9</green>
|
||||
<blue>0.2</blue>
|
||||
</color>
|
||||
</text>
|
||||
|
||||
<!-- tow weight -->
|
||||
<text>
|
||||
<row>4</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Towrope Weight per Meter</label>
|
||||
</text>
|
||||
<text>
|
||||
<row>4</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label></label>
|
||||
<live>true</live>
|
||||
<format>%.3f kg/m</format>
|
||||
<property>/sim/hitches/aerotow/tow/weight-per-m-kg-m</property>
|
||||
<color>
|
||||
<red>0.2</red>
|
||||
<green>0.9</green>
|
||||
<blue>0.2</blue>
|
||||
</color>
|
||||
</text>
|
||||
</group>
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
|
||||
<vrule/>
|
||||
|
||||
<group>
|
||||
<layout>table</layout>
|
||||
|
||||
<!-- tow length -->
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>20 m</label>
|
||||
</text>
|
||||
<slider>
|
||||
<row>0</row>
|
||||
<col>2</col>
|
||||
<live>true</live>
|
||||
<halign>fill</halign>
|
||||
<pref-width>300</pref-width>
|
||||
<name>tow_length</name>
|
||||
<property>/sim/hitches/aerotow/tow/length</property>
|
||||
<min>20</min>
|
||||
<max>200</max>
|
||||
<step>5</step>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>200 m</label>
|
||||
</text>
|
||||
|
||||
<!-- break force -->
|
||||
<text>
|
||||
<row>1</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>100 N</label>
|
||||
</text>
|
||||
<slider>
|
||||
<row>1</row>
|
||||
<col>2</col>
|
||||
<live>true</live>
|
||||
<halign>fill</halign>
|
||||
<pref-width>300</pref-width>
|
||||
<name>break_force</name>
|
||||
<property>/sim/hitches/aerotow/tow/brake-force</property>
|
||||
<min>100</min>
|
||||
<max>100000</max>
|
||||
<step>100</step>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
<text>
|
||||
<row>1</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>100,000 N</label>
|
||||
</text>
|
||||
|
||||
<!-- tow characteristic -->
|
||||
<text>
|
||||
<row>2</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>0 N</label>
|
||||
</text>
|
||||
<slider>
|
||||
<row>2</row>
|
||||
<col>2</col>
|
||||
<live>true</live>
|
||||
<halign>fill</halign>
|
||||
<pref-width>300</pref-width>
|
||||
<name>elastic_constant</name>
|
||||
<property>/sim/hitches/aerotow/tow/elastic-constant</property>
|
||||
<min>0</min>
|
||||
<max>1500000</max>
|
||||
<step>200</step>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
<text>
|
||||
<row>2</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>1,500,000 N</label>
|
||||
</text>
|
||||
|
||||
<!-- tow thickness -->
|
||||
<text>
|
||||
<row>3</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>0 mm</label>
|
||||
</text>
|
||||
<slider>
|
||||
<row>3</row>
|
||||
<col>2</col>
|
||||
<live>true</live>
|
||||
<halign>fill</halign>
|
||||
<pref-width>300</pref-width>
|
||||
<name>rope_diameter</name>
|
||||
<property>/sim/hitches/aerotow/rope/rope-diameter-mm</property>
|
||||
<min>0</min>
|
||||
<max>50</max>
|
||||
<step>1</step>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
<text>
|
||||
<row>3</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>50 mm</label>
|
||||
</text>
|
||||
|
||||
<!-- tow weight -->
|
||||
<text>
|
||||
<row>4</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>0 kg/m</label>
|
||||
</text>
|
||||
<slider>
|
||||
<row>4</row>
|
||||
<col>2</col>
|
||||
<live>true</live>
|
||||
<halign>fill</halign>
|
||||
<pref-width>300</pref-width>
|
||||
<name>weight_per_m</name>
|
||||
<property>/sim/hitches/aerotow/tow/weight-per-m-kg-m</property>
|
||||
<min>0</min>
|
||||
<max>1</max>
|
||||
<step>0.001</step>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</slider>
|
||||
<text>
|
||||
<row>4</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>1 kg/m</label>
|
||||
</text>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<!-- bottom line -->
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
<button>
|
||||
<legend>Close</legend>
|
||||
<equal>true</equal>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
<legend>Default</legend>
|
||||
<equal>true</equal>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
setprop("/sim/hitches/aerotow/tow/length", 60.0);
|
||||
setprop("/sim/hitches/aerotow/tow/brake-force", 100000.0);
|
||||
setprop("/sim/hitches/aerotow/tow/elastic-constant", 10000.0);
|
||||
setprop("/sim/hitches/aerotow/rope/rope-diameter-mm", 20);
|
||||
setprop("/sim/hitches/aerotow/tow/weight-per-m-kg-m", 1.0);
|
||||
]]></script>
|
||||
</binding>
|
||||
</button>
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
</group>
|
||||
</PropertyList>
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Aerotow object
|
||||
# Class Aerotow for enable and disable scenario with aerotow aircraft.
|
||||
#
|
||||
var Aerotow = {
|
||||
#
|
||||
@@ -51,8 +51,6 @@ var Aerotow = {
|
||||
#
|
||||
# Function for restart AI scenario with delay when the sound has to stop.
|
||||
#
|
||||
# Return 1 on successful, otherwise 0.
|
||||
#
|
||||
restartAerotow: func () {
|
||||
me.message.success("Aerotow on the way");
|
||||
|
||||
@@ -60,11 +58,9 @@ var Aerotow = {
|
||||
setprop(me.addonNodePath ~ "/addon-devel/sound/enable", 0);
|
||||
|
||||
# Wait a second for the engine sound to turn off
|
||||
var timer = maketimer(1, func () {
|
||||
Timer.new().singleShot(1, me, func () {
|
||||
me.unloadScenario();
|
||||
});
|
||||
timer.singleShot = 1;
|
||||
timer.start();
|
||||
},
|
||||
|
||||
#
|
||||
@@ -76,11 +72,9 @@ var Aerotow = {
|
||||
}
|
||||
|
||||
# Start aerotow with delay to avoid duplicate engine sound playing
|
||||
var timer = maketimer(1, func () {
|
||||
Timer.new().singleShot(1, me, func () {
|
||||
me.startAerotow();
|
||||
});
|
||||
timer.singleShot = 1;
|
||||
timer.start();
|
||||
},
|
||||
|
||||
#
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Parent object of Aircraft
|
||||
# Parent class of Aircraft
|
||||
#
|
||||
var Aircraft = {
|
||||
#
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Object for hande Route Dialog
|
||||
# Class for hande Route Dialog
|
||||
#
|
||||
var RouteDialog = {
|
||||
#
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
# under the GNU Public License v3 (GPLv3)
|
||||
#
|
||||
|
||||
#
|
||||
# Class Thermal for handle add new thermal.
|
||||
#
|
||||
var Thermal = {
|
||||
#
|
||||
# Constructor
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Flight Plan object
|
||||
# Class FlightPlan for crate and save as XML file the flight plan for AI scenario.
|
||||
#
|
||||
var FlightPlan = {
|
||||
#
|
||||
@@ -93,7 +93,7 @@ var FlightPlan = {
|
||||
"lat" : rwyResult.runway.lat,
|
||||
"lon" : rwyResult.runway.lon,
|
||||
"heading" : rwyResult.runway.heading,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
#
|
||||
@@ -224,7 +224,7 @@ var FlightPlan = {
|
||||
var gliderOffsetM = me.getGliderOffsetFromRunwayThreshold(location);
|
||||
|
||||
# ... and line up with the runway
|
||||
me.addWptGround({"hdgChange": 0, "dist": 30 + gliderOffsetM}, {"altChange": 0, "ktas": 2.5});
|
||||
me.addWptGround({"hdgChange": 0, "dist": me.getInitialDistance() + gliderOffsetM}, {"altChange": 0, "ktas": 2.5});
|
||||
|
||||
# Rolling
|
||||
me.addWptGround({"hdgChange": 0, "dist": 10}, {"altChange": 0, "ktas": 5});
|
||||
@@ -271,6 +271,17 @@ var FlightPlan = {
|
||||
return 1;
|
||||
},
|
||||
|
||||
#
|
||||
# Get initial distance AI plane from the glider that the tow is nearly tautened.
|
||||
#
|
||||
# Return distance in meters.
|
||||
#
|
||||
getInitialDistance: func () {
|
||||
var ropeLengthM = getprop("/sim/hitches/aerotow/tow/length") or 60;
|
||||
var tautenRelative = 0.68;
|
||||
return ropeLengthM * tautenRelative;
|
||||
},
|
||||
|
||||
#
|
||||
# Initialize AI aircraft variable
|
||||
#
|
||||
@@ -307,7 +318,7 @@ var FlightPlan = {
|
||||
return rwyThreshold.distance_to(gliderCoord);
|
||||
}
|
||||
|
||||
# We are not on runway
|
||||
# We are not on the runway
|
||||
return 0;
|
||||
},
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Object for write flight plan to the XML file
|
||||
# Class FlightPlanWriter for write flight plan to the XML file
|
||||
#
|
||||
var FlightPlanWriter = {
|
||||
#
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Object for display messages
|
||||
# Class Message for display messages on the screen with read by speech synthesizer.
|
||||
#
|
||||
var Message = {
|
||||
#
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Scenario object
|
||||
# Class Scenario for create AI scenario XML file and attach it to scenario property list for load it.
|
||||
#
|
||||
var Scenario = {
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
SCENARIO_ID: "aerotow_addon",
|
||||
SCENARIO_NAME: "Aerotow Add-on",
|
||||
SCENARIO_DESC: "This scenario starts the towing plane at the airport where the pilot with the glider is located. Use Ctrl-o to hook the plane.",
|
||||
FILENAME_SCENARIO: "aerotown-addon.xml",
|
||||
SCENARIO_ID: "aerotow_addon",
|
||||
SCENARIO_NAME: "Aerotow Add-on",
|
||||
SCENARIO_DESC: "This scenario starts the towing plane at the airport where the pilot with the glider is located. Use Ctrl-o to hook the plane.",
|
||||
FILENAME_SCENARIO: "aerotown-addon.xml",
|
||||
|
||||
#
|
||||
# Constructor
|
||||
|
||||
41
nasal/timer.nas
Normal file
41
nasal/timer.nas
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Aerotow Everywhere - Add-on for FlightGear
|
||||
#
|
||||
# Written and developer by Roman Ludwicki (PlayeRom, SP-ROM)
|
||||
#
|
||||
# Copyright (C) 2022 Roman Ludwicki
|
||||
#
|
||||
# Aerotow Everywhere is an Open Source project and it is licensed
|
||||
# under the GNU Public License v3 (GPLv3)
|
||||
#
|
||||
|
||||
#
|
||||
# Class Timer for wrapping maketimer() function.
|
||||
#
|
||||
var Timer = {
|
||||
#
|
||||
# Constructor
|
||||
#
|
||||
new: func () {
|
||||
return { parents: [Timer] };
|
||||
},
|
||||
|
||||
#
|
||||
# Run timer as single shot
|
||||
#
|
||||
# delaySec - Delay in seconds for execute timer's callback.
|
||||
# self - Specifying what any "me" references in the function being called will refer to.
|
||||
# callback - Function to be called after given delay.
|
||||
#
|
||||
# Return timer handler object
|
||||
#
|
||||
singleShot: func (delaySec, self, callback) {
|
||||
var timer = maketimer(delaySec, self, func () {
|
||||
callback();
|
||||
});
|
||||
timer.singleShot = 1;
|
||||
timer.start();
|
||||
|
||||
return timer;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user