• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Flight Director Problem

Messages
1,468
Country
italy
I'm having a problem with two switches fighting each other!! i.e when one toggles off the the other toggles on and then won't turn off.
I'm trying to do two functions with one switch and perhaps that's not possible. The functions are Flight Director and Heading Lock. I need the heading lock for the INS gauge. There are two switches: AP2 which toggles the FD and HL (as above) and AP1 which toggles the AP on and off.

What happens is as follows:-
AP off FD off <----- that's OK
AP off FD on <----- that's OK
But, I cannot now turn off the FD
AP on FD on <----- that's OK
Now I can turn FD off
AP on FD off <----- that's OK
But, what happens now is
AP off FD on !!!!!!! <----- that's NOT OK

Here's the relevant code:-
vololiberista
Code:
[COLOR="Blue"]<Element>
      <Position X="127" Y="0"/>
      <Select>
         <Value>(A:AUTOPILOT MASTER,bool)</Value>
         <Case Value="1">
            <Image Name="AUTOPILOT_AP1.bmp" ImageSizes="26,46"/>
         </Case>
      </Select>
   </Element>

<Area Top="0" Left="127" Width="26" Height="46">
         <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_MASTER"/>
         <Cursor Type="Hand"/>
         <Click>(A:AUTOPILOT MASTER, bool) 1 == if{ 0 (&gt;L:AP ON,number) } els{ 1 (&gt;L:AP ON,number) } 0 (&gt;K:AP_MASTER) 1 (&gt;K:AP_ALT_HOLD_ON) 0 (&gt;K:AP_ALT_VAR_SET_ENGLISH) (A:Vertical speed,feet per minute) (&gt;K:AP_VS_VAR_SET_ENGLISH)</Click>
      </Area>[/COLOR]



[COLOR="SeaGreen"]<Element>
<Position X="231" Y="0"/>
      <Select>
         <Value>(A:Autopilot heading lock, bool) (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool)</Value>
         <Case Value="1">
            <Image Name="AUTOPILOT_AP2.bmp" ImageSizes="26,46"/>
         </Case>
      </Select>
   </Element>

<Area Top="0" Left="231" Width="26" Height="46">
<Tooltip>FD Eng / Hdg - INS LOCK</Tooltip>
         <Cursor Type="Hand"/>
          <Click>(&gt;K:TOGGLE_FLIGHT_DIRECTOR) (&gt;K:AP_PANEL_HEADING_HOLD)</Click>
      </Area>
[/COLOR]
 
Here lies one of your problems:

Code:
 <Click>(&gt;K:TOGGLE_FLIGHT_DIRECTOR) (&gt;K:AP_PANEL_HEADING_HOLD)</Click>

You are indeed toggling the FD and at the same time engaging Heading Hold, which automatically turns on FD if it is OFF. This is a normal behavior in aircraft with APFDS systems, so FS9 is replicating that (and the same for FSX).

Something similar happens in the AP_MASTER line, you are engaging Altitude Hod, which is going to engage FD as well if it is off.

Tom
 
I suppose then just heading hold would do!
I tried that and indeed it did turn the FD on. However clicking the switch again left both the heading hold and FD still on.
So I need to turn it off as well as on!!!!!!
In other words (&gt;K:AP_PANEL_HEADING_HOLD) doesn't seem to to toggle.
What's the best way to do that?
vololiberista
 
Last edited:
You could try (and modify as necessary):

Code:
<Click>
   (A:AUTOPILOT MASTER, bool) ! (>L:AP ON,number)
   (>K:AP_MASTER)  
   (A:Autopilot Flight Director Active,bool) (>K:AP_PANEL_ALTITUDE_SET)
   (A:Vertical speed,feet per minute) (>K:AP_VS_VAR_SET_ENGLISH)
</Click>

Code:
<Click>
   (>K:TOGGLE_FLIGHT_DIRECTOR)
   (A:Autopilot Flight Director Active,bool) (>K:AP_PANEL_HEADING_SET)
</Click>

Tom
 
This seems to work Tom:-
Code:
<Element>
      <Position X="64" Y="0"/>
      <Select>
         <Value>(L:Autopilot heading lock, bool)</Value>
         <Case Value="1">
            <Image Name="AUTOPILOT_NAV.bmp" ImageSizes="26,46"/>
         </Case>
      </Select>
   </Element>

<Click>(L:Autopilot heading lock, bool) 0 == (A:Autopilot heading lock, bool) 0 == and
if{ 1 (&gt;L:Autopilot heading lock, bool) (>K:AP_PANEL_HEADING_HOLD) }
els{ 0 (&gt;L:Autopilot heading lock, bool) (>K:AP_PANEL_HEADING_HOLD) 
(&gt;K:TOGGLE_FLIGHT_DIRECTOR) }</Click>

However, I have another question if I may.
What are the correct A: and K: vars for use with the NAV function?
I now need to asign the NAV function (i.e. that tracks and aligns the a/c with the VOR OBS bearing) to another switch.
vololiberista
 
I don't have the FS9 SDK, though I guess is the same as FSX for XML variables:

(K:AP_NAV1_HOLD) to toggle NAV1 hold ON/OFF
(A:AUTOPILOT NAV1 LOCK, bool) to check whether NAV1 hold is ON/OFF


Tom
 
When ever you choose your variable look for ON, OFF, or SET first if it's going to be used with other variables. TOGGLE is only good for a 2 way switch and will cause an issue if used wrong. i just checked autopilot and found it has several codes. This tip should help your future decisions when choosing your variables. Toggle is sometimes the only choice and so many developers make a dummy primer due to the limits of the standard FSX coding. C++ will take you from these limits and can do magic. Too bad i can't write C++, maybe one day!
 
Last edited:
Yes DG,
Unfortunately I have never had any conflict with any C++ gauges :-(

for Tom, This the coding I have for the localisor/VOR switch
Code:
//---------------------------------- LOC/VOR --------------------------------------
      <Area Top="68" Left="74" Width="38" Height="11">
      	 <Tooltip>LOC/VOR Hold</Tooltip>
         <Cursor Type="Hand"/>
         <Click>5 (&gt;L:AP Var1,number) 0 (&gt;K:AP_HDG_HOLD_OFF) 0 (&gt;K:AP_APR_HOLD_OFF) 0 (&gt;K:AP_LOC_HOLD_ON)</Click>
      </Area>
You can see that it doesn't have (A:AUTOPILOT NAV1 LOCK, bool) nor (K:AP_NAV1_HOLD) though they do exist in the FS9 SDK.
The above code does work certainly for a localisor but is pretty aggressive! For capturing a normal VOR it's even more aggressive.
It often puts the VC10 on its wingtip (The VC10 can handle that for a while!!) and in both cases it turns the a/c away initially if the lubber line is out of range.
L:AP Var1 is just the switch possition.
Do you have any recommendations as to changes if needed?
Its intention is to function as a LOC/VOR capture and follow.
vololiberista
 
The above code does work certainly for a localisor but is pretty aggressive! For capturing a normal VOR it's even more aggressive.

It is reasonable to expect an aggresive behavior as that is to be used for Localizer captures, not for VOR radial following. For this one you should try with NAV1 commands. Regarding a too much aggresive LOC capture, I think you should check for proper parameters in aircraft.cfg [autopilot] section.

Tom
 
Thanks Tom,
My AP cfg settings are below and don't appear to be at all aggressive!!!
I'll have a look at using the NAV1 commands instead. What I'm really after is the A:var that is triggered by the INS. It works with the INS as is but the way the AP switch is set up at the moment is pretty much identical to the normal HDG switch on the AP.
vololiberista
Code:
[autopilot]
autopilot_available=1
flight_director_available=1
default_vertical_speed=1500.000000
autothrottle_available=1
autothrottle_arming_required=1
autothrottle_takeoff_ga=1
autothrottle_max_rpm=93.000000
pitch_takeoff_ga=8.000000
USE_NO_DEFAULT_PITCH=1
USE_NO_DEFAULT_BANK=1
default_pitch_mode=0
default_bank_mode=0
max_pitch=10.000000
max_pitch_acceleration=2.000000
max_pitch_velocity_lo_alt=2.500000
max_pitch_velocity_hi_alt=1.500000
max_pitch_velocity_lo_alt_breakpoint=20000.000000
max_pitch_velocity_hi_alt_breakpoint=28000.000000
max_bank=20.000000
max_bank_acceleration=2.000000
max_bank_velocity=3.000000
max_throttle_rate=0.200000
nav_proportional_control=15.000000
nav_integrator_control=0.250000
nav_derivative_control=0.000000
nav_integrator_boundary=2.500000
nav_derivative_boundary=0.000000
gs_proportional_control=12.520000
gs_integrator_control=0.260000
gs_derivative_control=0.000000
gs_integrator_boundary=0.700000
gs_derivative_boundary=0.000000
yaw_damper_gain=1.000000
 
Why do you have both of these? They do the same thing after all:

USE_NO_DEFAULT_PITCH=1
USE_NO_DEFAULT_BANK=1

default_pitch_mode=0
default_bank_mode=0

Unless you're wanting it to be compatible with both FS9 and FSX, in which case only the first (old form) is required. ;)
 
Hello. Does anyone know how a person can write to (A:AUTOPILOT FLIGHT DIRECTOR BANK, Degrees)? I have tried but nothing seems to be able to affect it. I'm working on a bank limiter for FS9 (since it doesn't have (A:AUTOPILOT MAX BANK) like FSX). I have it working but when I activate my bank limiter, the Flight Director goes to the zero bank position. I would like the Flight Director to at least reflect the bank angle commanded by the bank limiter.
 
Sounds like you're shutting off the autopilot to do this... or activating something that makes the built-in autopilot command zero degrees bank.

There's no way to overwrite the sim var's value.
 
Thank you for your response. No, I'm not turning off the Autopilot. In fact, I need/use (A:AUTOPILOT MASTER, Bool) 1 or ON. I do have the (>K:AP_PANEL_HEADING_OFF) though. The big boys LevelD 767, Captain Sim's 757, PSS 747/777 all have a bank limiter gauge but use the *.gau format. I suspect that they had to re-write their own autopilot scheme to make it work. I don't really want to do that. I did come up with an xml gauge that works effectively enough for me, though it was very challenging. It just looks weird to have the Flight Director not match actual command. I believe technically speaking, the Flight Director (either from FMC or MCP) is suppose to command the controls whether flown automatically or manually. Again, thanks.
 
Of course it is... but you're turning off the lateral control... so there is no command to give except straight and level. It's doing exactly what you told it to do.
 
Yes, as I mentioned above, I think the .gau makers for FS2004 probably had to design their own autopilot scheme in order to display the information correctly. I may have to do the same but will have to see if I have the desire/time. Currently my bank limiter xml gauge does work to control bank angle but only with heading changes but for me, that's when I want/need it. I was just hoping there was a way to control the FD another way, thanks for your info/time. An update. I came across an ADI (fancy acronym for attitude indictor with a Flight Director) and altough it does not show the bank desired, it does not default to a "no signal" state. It defaults to the current bank. At least it shows the correct direction and since my bank limiter is regulating the bank angle, it shows that bank as a command. The main reason for this update is that the gauge is written in xml (adi.xml) - so it can be modified! In addition, it has a very smooth response compared to the default Cessna's attitude and attitude with FD. I do not know how I obtained the gauge but it is part of: Z_742RKM.cab. I think it's from the original VMAX's Ready For Pushback 747's.
 
Last edited by a moderator:
Back
Top