Here are some updates to the KAP140 autopilot in the default c172. It now uses
ailerons and elevator instead of aileron-trim and elevator-trim. I've started
to "upgrade" it to the "two axis altitude preselect" version. Vertical speed
select rounds to nearest 100 fpm.
I've also modified the c172 electrical configuration to turn on the gps
instrument.
Perhaps the most important change is that the nasal script for the KAP140 has
moved from data/Nasal to the c172p aircraft subdir. So it is important that
you delete data/Nasal/kap140.nas. Having the kap140.nas script as a global
script was not a good solution. Now it is aircraft specific, and thus
included in the c172p-set.xml file. Ideally I would like it to be instrument
specific, so that it would be included whenever the KAP140*.xml instruments
where included on the panel.
typo; the SimGear "pass subproperty as first argument" shortcut
doesn't work in Nasal. This checkin is blind, but should have a high
probability of correctness.
I'd like to suggest that the spoiler settings are set in the same way as the
flaps are now done i.e. via Nasal, so that specific spoiler settings can also
be defined in the aircraft set file.
It was only when I was about to change the keyboard bindings for the slats
control that I remembered that there wasn't already a mapping for them in
keyboard.xml. I've _not_ added a mapping for slats as this is a bit of a hot
topic atm but as I had already added a Nasal func for the slats in
controls.nas I've left that in there. It's a trivial bit of code but I don't
know if leaving it in there is a good idea as it's code that shouldn't ever
be called until there's a corresponding keyboard mapping.
x/y/width/height values went into the calculation for the next popup,
and things got iteratively worse due to padding issues). But the
good news is that this whole subsystem is vastly simpler when
implemented with the new interface.
"engines die when any tank is empty" behavior. Otherwise, just
deselect the empty tank. This matches the "both" behavior many
lightplane fuel selectors have.
Here is the KAP140 Two Axis Autopilot update.
I think it's fairly complete now, all the modes are working. I tested the
localizer and glideslope hold and it was pretty stable all the way down to
the middle marker.
In the pilot guide for backcourse hold (REV) mode it says to reset the heading
bug to the _front course_. I haven't figured out how to implement this so for
the time beeing one should reset the heading bug to the _backcourse_. Apart
from this the panel should operate identical to the way the pilot guide
describes.
Here is the KAP140 Two Axis Autopilot.
Aircraft/Instruments/KAP140TwoAxis.xml
Is of course the instrument config file.
Aircraft/Instruments/Textures/KAP140.rgb
The texture.
Nasal/kap140.nas
Most of the work is done here. Without Nasal I don't see how I could implement
the NAV-ARM modes and the flashing annunciators.
Aircraft/c172p/Systems/KAP140.xml
The autopilot PID controllers configuration file. Maybe this file should be in
a more accessible directory and not hidden deep inside c172p!?
I've also attached the changes to the default C172 to include this autopilot
in the 3d-cockpit panel and the 2d vfr panel. Or at least I hope that I've
managed to include all that is needed.
tanks created by the C++ code look empty, and were causing the fuel
code to detect out of fuel conditions. Since there is no way to tell
a "FDM" tank from a "C++" tank, I just filter them by capacity. Very
ugly hack, we need to fix the code to report only the tanks created
by the aircraft/FDM configuration.
/sim/input/selected/engine[n] properties. Also, new properties get
empty string values (which are boolean true in Nasal, maybe that
should be changed?), so test for numeric truth.
Move the "tip popup" code from view.nas to a new gui.nas module, and
make it generically useful.
Wire up flap steppings for the 747 as an example of per-aircraft
flaps.
Realtime-based property slewing, to eliminate dependence of trim and
view direction rates on frame rate.
New Node.setValues() method which sets whole property trees from Nasal
data.
A view.nas module, which takes over handling of the X/x zoom keys. It
clamps the FOV to a dynamically calculated maximum corresponding to
typical human visual accuity, and pops up a pretty dialog informing
you of the new FOV.