• 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.

FSX:SE Automating Rudder For Simple Heading Hold

Messages
73
Country
us-texas
Hello,

I have been away quite a while with health issues, including COVID-19, but I won't bore you with my scars. In the interim, I have tried to program a number of projects in Python with middling success which I define as a script that does not have syntax and other "trace back" errors. The one I am focusing on outside of Python is trying to create a simple heading hold in FSX. I have done a lot of Internet searches, including,
"In FSX, how does the twisting of the joystick send signal to the rudder?"
...without getting *any* helpful hits.

Here is what I am thinking...
  1. Set a HDG in a gauge.
  2. If the heading of the vehicle is not aligned to the set HDG, then deflect the rudder to turn the vehicle toward the set HDG.
  3. As the vehicle's heading approaches the set HDG, decrease the rudder deflection incrementally about every 1/10 second until centered.
Essentially, I would like to mimic the input of a joystick twist for rudder deflection (not the left-right for aileron). I know information is being read by virtue of the FSUIPC readouts, so I am wondering if the same thing could be written into FSX via a simple gauge. Unfortunately, I do not know a thing about Simconnect.

Lastly, I do not know if this is "simple" or not.

Thoughts?
 
Last edited:
It can be done - I've done it - but in C, not XML.

Problems:
- the heading will change more rapidly if you have autorudder engaged because it will feed in more bank
- unless you are a PID (proportional integral derivative) calculation expert, you will overshoot and set off a rapidly worsening oscillation, guaranteed
- do not use full rudder deflection because you will end up chasing yourself (see (2)). One-quarter maximum deflection was enough to turn a simulated 42-ton aircraft and keep it under control

So:
- you need to calculate your delta angle ('which way do I turn?') before doing anything else
- if you can't calculate PIDs (I can't) the best way to do it is to cheat and use the in-built autopilot as a helper, not as a do-it-all-for-you

Steps, assuming autopilot on:
- get heading delta
- feed in rudder slowly until you reach one-quarter max deflection. Slowly = trial and error
- when you are within about ten degrees of the new heading, set AP HDG HOLD ON and rudder deflection to zero. The aircraft should take up the new course without oscillation but that depends on how fast you hit ten degrees
- if the new course is less than ten degrees from your current course, set AP HDG HOLD ON and rudder deflection to zero when within two degrees of the new heading. You may get some oscillation
- when established on the new heading, set AP HDG HOLD OFF
 
"In FSX, how does the twisting of the joystick send signal to the rudder?"
The rudder has a defined angular sweep from left to right. The joystick has a angular motion from left to right. The sim probably uses a simple forecast formula to translate the joystick's position to a rudder position and then causes the rudder to move to that position at a given maximum angular velocity.
I could be completely wrong.
 
Here is what I use for simulated heading hold, but using ailerons. The rudder command should be able to be substituted: (>K:AXIS_RUDDER_SET) instead of (>K:AXIS_AILERONS_SET)?

You don't need all the L: variables I test for at the beginning, just replace them with your own tests.

XML:
//-------- SIMULATED HEADING HOLD - ADJUST TURN RIGHT IF BANK IS LESS THAN DESIRED VALUE -----------
   <Element>
    <Select>
      <Value> (L:PPStarted1, enum) 1 != (L:APP_init, bool) ! &amp;&amp; (L:GCA_init, bool) ! &amp;&amp; (L:AILA,bool) ! &amp;&amp; (A:Sim on Ground, bool) ! &amp;&amp; (A:Autopilot master,bool) &amp;&amp; (L:AP_SW, enum) 0 == (L:AP_SW, enum) 1 == (L:Confusion Zone, bool) &amp;&amp; || &amp;&amp; (A:Attitude indicator bank degrees,degrees) /-/ (A:AUTOPILOT HEADING LOCK DIR,degrees) (A:PLANE HEADING DEGREES GYRO,degrees) - 0.1* &lt; &amp;&amp; (L:Heading Off, bool) ! &amp;&amp; (L:Sim_Head_Hold, bool) &amp;&amp; if{ (A:Attitude indicator bank degrees,degrees) /-/ (A:AUTOPILOT HEADING LOCK DIR,degrees) (A:PLANE HEADING DEGREES GYRO,degrees) - 0.2 * - abs 6 min -500 * d 400 (A:AIRSPEED INDICATED,knots) / * (&gt;K:AXIS_AILERONS_SET) } </Value>
    </Select>
   </Element>
//-------- SIMULATED HEADING HOLD - ADJUST TURN LEFT IF BANK IS GREATER THAN DESIRED VALUE -----------
   <Element>
    <Select>
      <Value> (L:PPStarted1, enum) 1 != (L:APP_init, bool) ! &amp;&amp; (L:GCA_init, bool) ! &amp;&amp; (L:AILA,bool) ! &amp;&amp; (A:Sim on Ground, bool) ! &amp;&amp; (A:Autopilot master,bool) &amp;&amp; (L:AP_SW, enum) 0 == (L:AP_SW, enum) 1 == (L:Confusion Zone, bool) &amp;&amp; || &amp;&amp; (A:Attitude indicator bank degrees,degrees) /-/ (A:AUTOPILOT HEADING LOCK DIR,degrees) (A:PLANE HEADING DEGREES GYRO,degrees) - 0.1* &gt; &amp;&amp; (L:Heading Off, bool) ! &amp;&amp; (L:Sim_Head_Hold, bool) &amp;&amp; if{ (A:Attitude indicator bank degrees,degrees) /-/ (A:AUTOPILOT HEADING LOCK DIR,degrees) (A:PLANE HEADING DEGREES GYRO,degrees) - 0.2 * - abs 6 min 500 * d 400 (A:AIRSPEED INDICATED,knots) / * (&gt;K:AXIS_AILERONS_SET) } </Value>
    </Select>
   </Element>

I set up this system using the following mouse excerpt (i.e. when the user throws the AP to "HDG" mode):

XML:
            (L:AP_SW, enum) 0 == (A:Autopilot Master, bool) 1 == &amp;&amp; if{ (&gt;K:AP_NAV1_HOLD_OFF) (&gt;K:AP_ATT_HOLD_ON) (&gt;K:AP_WING_LEVELER_OFF) (A:Plane Heading Degrees Magnetic, degrees)

Hope this helps,
 
Thank you all very much for the input. Unfortunately, my skills are below the necessary pay grade. LOL

FYI - What I was trying to accomplish is a "rudder-controlled" autopilot as opposed to using ailerons which has a number of applications. Firsdt, the Sperry DC-3 AP held HDG via the rudder. Also, boats and ships use rudders. Anyway, I appreciate your help. I think have taken this as far as I can. :)
 
Depends on which DC-3. Wartime (and earlier) aircraft used both Sperry A-2 and A-3 gyropilots which work slightly differently. Information is quite freely available for the A-3 gyropilot, but unless you have very deep pockets (i.e. $250 - $300 asking price for an installation manual), there is next-to-no information available for the A-2. I doubt there are any DC-3s left with a working A-2 or A-3 gyropilot as one of the biggest complaints from aircrews was fluid leakage from the pneumo-hydraulic systems which contaminated the cockpit floor. Post-war new aircraft were fitted with A-4 electric-hydraulic gyropilots and finally, A-5 autopilots.

I am unfortunately too familiar with the A-2 and A-3 gyropilots, having coded them for the Boeing Model 314. It isn't just a case of feeding in the control surfaces and checking the heading. There are two separate inputs per control surface; angular deflection and speed of deflection. The crew can make the control surfaces react from very slow to very fast and, if they get it wrong, into full hydraulic lock. Additionally, the gyropilots were specifically tuned for the aircraft type they were fitted to. There is a booklet that comes up on the various ebays every-now-and-again called 'Elmer Carries On' by the Sperry Company. It's never that expensive and gives an excellent high-level pilot's view of how the A-3 gyropilot operates.

I'm not trying to put you off; simply giving you some idea of the overall problems you will run into if you decide to go that route.
 
Back
Top