Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autopilot turns LNAV off for aircraft at their last waypoint before ensuring they are on track #354

Open
andubadea opened this issue Dec 23, 2021 · 1 comment

Comments

@andubadea
Copy link
Contributor

andubadea commented Dec 23, 2021

Hello!

In essence, the autopilot turns off LNAV for aircraft that are heading towards their last waypoint in order to prevent an attempt to get information about a non-existent next waypoint:

if not bs.traf.actwp.swlastwp[i]:
....

# Prevent trying to activate the next waypoint when it was already the last waypoint
else:
    bs.traf.swlnav[i] = False
    bs.traf.swvnav[i] = False
    bs.traf.swvnavspd[i] = False
    continue # Go to next a/c which reached its active waypoint

However, this is done without checking if the aircraft is truly heading towards the last waypoint. And because LNAV is off, any small deviation causes the aircraft to not reach its last waypoint. This effect is especially great when a turn happens before, like in this scenario:

00:00:00>HOLD
00:00:00>PAN 48.204011819028494 16.363471515762452
00:00:00>ZOOM 10
00:00:00>CASMACHTHR 0
00:00:00>CRE AC1 M600 48.2062878 16.3742024 340 30 30
00:00:00>ADDWAYPOINTS AC1 48.2064954,16.3740099,,30,FLYBY,0,48.2064954,16.3740099,,30,FLYBY,0,48.2067178,16.3736114,,30,FLYBY,0,48.2068545,16.3732765,,30,FLYBY,0, 48.2069278,16.3729623,,30,FLYBY,0, 48.2069826,16.3727506,,30,TURNSPD,10,48.2075894,16.3730102,,30,TURNSPD,10,48.20727253,16.37385858,,10,FLYBY,0
00:00:00>LNAV AC1 ON
00:00:00>VNAV AC1 ON

This aircraft has a turn for the second to last waypoint, and performs it with a slight overshoot. Thus, the original heading that the aircraft needed to have for it to reach the last waypoint needs slight adjustment. If LNAV would have been on, the aircraft would have compensated automatically. But as LNAV is off, the aircraft misses the destination waypoint.

A potential solution could be to only turn LNAV off if the aircraft is on track towards the last waypoint. Otherwise, to only turn LNAV off if the aircraft actually clears the last waypoint.

@ProfHoekstra
Copy link
Collaborator

Something like the fix your propose resulted in aircraft flying around the last waypoint for short legs. But I see the problem, will have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants