FDM: Add custom FDM. Sound: Add start safety voice. Keys: Add keys.
This commit is contained in:
parent
b82ba27d36
commit
cb6385724d
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- Copyright (c) 2019 Joshua Davidson (Octal450) -->
|
||||
|
||||
<direct name="Direct">
|
||||
</direct>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<electric_engine name="motor">
|
||||
<power unit="WATTS"> 568000 </power>
|
||||
</electric_engine>
|
Binary file not shown.
|
@ -0,0 +1,59 @@
|
|||
var max_P_KW = 568;
|
||||
var gearratio = 9.73;
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/rpm1",1000);
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/direction",1);
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/started",0);
|
||||
|
||||
var update_engine = func(){
|
||||
var direction = getprop("/controls/engines/engine/direction");
|
||||
var throttle = getprop("/controls/engines/engine/throttle");
|
||||
var rpm = getprop("/controls/engines/engine/rpm1");
|
||||
var rpm_rate = throttle*max_P_KW*0.06;
|
||||
var max_rpm = throttle*max_P_KW*90+1000;
|
||||
if(rpm > max_rpm){
|
||||
rpm_rate = -20;
|
||||
}else if(rpm == max_rpm){
|
||||
rpm_rate = 0;
|
||||
}else{
|
||||
rpm_rate = throttle*max_P_KW*0.053;
|
||||
}
|
||||
var rpmActual = rpm_calculate(rpm_rate);
|
||||
var torque = 0;
|
||||
if(rpmActual == 0){
|
||||
torque = 0;
|
||||
}else{
|
||||
torque = (throttle*max_P_KW*1000)/(rpmActual*6.283*0.1667);#max 967
|
||||
}
|
||||
var force = 3.33*direction*torque*gearratio;
|
||||
#print("torque:"~torque);
|
||||
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/engine/magnitude", force);
|
||||
}
|
||||
var rpm_calculate = func(rpm_rate){
|
||||
var rpm = getprop("/controls/engines/engine/rpm1");
|
||||
var rpm2 = 0;
|
||||
var gearspeed = math.round(getprop("/gear/gear/rollspeed-ms"));
|
||||
var rpm2 = (gearspeed/0.3)*9.8;
|
||||
#print(rpm2);
|
||||
rpm_rate = rpm_rate/1000;
|
||||
rpm = rpm + rpm * rpm_rate;
|
||||
var rpmActual = (rpm + rpm2)/2;
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/rpm1",rpm);
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/rpma",rpmActual);
|
||||
return rpmActual;
|
||||
}
|
||||
|
||||
var engineTimer = maketimer(0.001, update_engine);
|
||||
var startEngine = func(){
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/started",1);
|
||||
engineTimer.start();
|
||||
print("Engine started");
|
||||
}
|
||||
var stopEngine = func(){
|
||||
props.getNode("/",1).setValue("/controls/engines/engine/started",0);
|
||||
props.getNode("/",1).setValue("/fdm/jsbsim/external_reactions/engine/magnitude", 0);
|
||||
engineTimer.stop();
|
||||
print("Engine stopped");
|
||||
}
|
||||
|
||||
|
||||
|
Binary file not shown.
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<fx>
|
||||
|
||||
<engine>
|
||||
<name>rumble</name>
|
||||
<mode>looped</mode>
|
||||
<path>Sounds/rumble.wav</path>
|
||||
<property>/velocities/airspeed-kt</property>
|
||||
<volume>
|
||||
<property>/velocities/airspeed-kt</property>
|
||||
<factor>0.001</factor>
|
||||
<min>0.0</min>
|
||||
<max>0.0</max>
|
||||
</volume>
|
||||
<pitch>
|
||||
<property>/velocities/airspeed-kt</property>
|
||||
<factor>0.001</factor>
|
||||
<offset>1.5</offset>
|
||||
</pitch>
|
||||
</engine>
|
||||
|
||||
<safety>
|
||||
<name>safety</name>
|
||||
<mode>once</mode>
|
||||
<path>Aircraft/followme/Sounds/Safety.wav</path>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/controls/engines/engine/started</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<volume>
|
||||
<property>/controls/engines/engine/started</property>
|
||||
<factor>5</factor>
|
||||
</volume>
|
||||
</safety>
|
||||
|
||||
</fx>
|
||||
|
||||
</PropertyList>
|
|
@ -3,8 +3,8 @@
|
|||
<PropertyList>
|
||||
<sim>
|
||||
|
||||
<description>Follow Me</description>
|
||||
<author>Gijs de Rooy</author>
|
||||
<description>Follow Me e-tron</description>
|
||||
<author>Gijs de Rooy, Weihao Li, Sidi Liang</author>
|
||||
<status>early production</status>
|
||||
<rating>
|
||||
<FDM type="int">4</FDM>
|
||||
|
@ -26,13 +26,16 @@
|
|||
<aero>followme</aero>
|
||||
|
||||
<model>
|
||||
<path>Aircraft/followme/Models/followme.xml</path>
|
||||
<path>Aircraft/followme_e-tron/Models/followme_e-tron.xml</path>
|
||||
<livery>
|
||||
<file type="string"/>
|
||||
</livery>
|
||||
</model>
|
||||
|
||||
<view n="0">
|
||||
<sound>
|
||||
<path>Aircraft/followme_e-tron/followme-sound.xml</path>
|
||||
<switch type = "bool"></switch>
|
||||
</sound>
|
||||
<view n="/0">
|
||||
<internal archive="y">true</internal>
|
||||
<config>
|
||||
<x-offset-m archive="y" type="double">-0.35</x-offset-m>
|
||||
|
@ -105,6 +108,20 @@
|
|||
<script>aircraft.livery.dialog.toggle()</script>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Start Engine</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>engine.startEngine()</script>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Stop Engine</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>engine.stopEngine()</script>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
</default>
|
||||
</menubar>
|
||||
|
@ -243,8 +260,11 @@
|
|||
|
||||
<nasal>
|
||||
<followme>
|
||||
<file>Aircraft/followme/Nasal/systems.nas</file>
|
||||
<file>Aircraft/followme_e-tron.xml/Nasal/systems.nas</file>
|
||||
</followme>
|
||||
<engine>
|
||||
<file>Aircraft/followme_e-tron.xml/Nasal/engine.nas</file>
|
||||
</engine>
|
||||
</nasal>
|
||||
|
||||
</PropertyList>
|
|
@ -11,8 +11,8 @@
|
|||
</fileheader>
|
||||
|
||||
<metrics>
|
||||
<wingarea unit="M2">8</wingarea>
|
||||
<wingspan unit="M">4</wingspan>
|
||||
<wingarea unit="M2">1</wingarea>
|
||||
<wingspan unit="M">1</wingspan>
|
||||
<chord unit="M">2</chord>
|
||||
<htailarea unit="M2">1</htailarea>
|
||||
<htailarm unit="M">1</htailarm>
|
||||
|
@ -111,24 +111,37 @@
|
|||
</contact>
|
||||
</ground_reactions>
|
||||
|
||||
<propulsion/>
|
||||
<propulsion>
|
||||
<!--<engine file="motor">
|
||||
<location unit="M">
|
||||
<x> 1.5</x>
|
||||
<y> 0</y>
|
||||
<z> 0</z>
|
||||
</location>
|
||||
<orient unit="DEG">
|
||||
<roll> 0.0 </roll>
|
||||
<pitch> 0 </pitch>
|
||||
<yaw> 0 </yaw>
|
||||
</orient>
|
||||
<feed>0</feed>
|
||||
<thruster file="direct">
|
||||
<location unit="M">
|
||||
<x> 1.5</x>
|
||||
<y> 0</y>
|
||||
<z> 0</z>
|
||||
</location>
|
||||
<orient unit="DEG">
|
||||
<roll> 0.0 </roll>
|
||||
<pitch> 0 </pitch>
|
||||
<yaw> 0 </yaw>
|
||||
</orient>
|
||||
</thruster>
|
||||
</engine>-->
|
||||
</propulsion>
|
||||
|
||||
<flight_control name="Truck">
|
||||
<property value="1">/controls/engines/engine/direction</property>
|
||||
<channel name="Engine">
|
||||
<fcs_function name="fcs/engine-force">
|
||||
<function>
|
||||
<product>
|
||||
<property>/controls/engines/engine/throttle</property>
|
||||
<property>/controls/engines/engine/direction</property>
|
||||
<value>1200</value>
|
||||
</product>
|
||||
</function>
|
||||
<output>external_reactions/engine/magnitude</output>
|
||||
</fcs_function>
|
||||
</channel>
|
||||
|
||||
<channel name="Steer">
|
||||
|
||||
<summer name="Steer Sum">
|
||||
<input>fcs/rudder-cmd-norm</input>
|
||||
<clipto>
|
Loading…
Reference in New Issue