Board index FlightGear Development Aircraft Autopilot and route manager

Target-auto-hdg for backcourse

Designing a stable autopilot is one of the hardest things. Need help?

Target-auto-hdg for backcourse

Postby Octal450 » Fri Apr 14, 2017 5:26 pm

Hi all
When trying to build a BackCourse mode, I am unable due to the most better way to get VOR/LOC is by using the /instrumentation/nav[0]/radials/target-auto-hdg-deg property. However, this property only works in flying FrontCourse, for BackCourse it must use +180 degrees.

So:
How is this target-auto-hdg-deg made? I don't see any documentation on the nav instrument or anything?
If I can't find that, any other ideas for a Back Course LOC track?

Thanks,
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Target-auto-hdg for backcourse

Postby sanhozay » Fri Apr 14, 2017 6:54 pm

That one is calculated in the C++ code for the nav radio:

navradio.cxx, line 811.

Reading that code, it looks like it should calculate the correct back course if you set "instrumentation/nav[0]/back-course-btn" to 1. Same with nav[1], obviously.
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: Target-auto-hdg for backcourse

Postby Octal450 » Fri Apr 14, 2017 8:19 pm

I will test it, thank you so much!

I can just set the backcourse prop from logic then, and use the existing VOR/LOC controller without any changes! Thanks!

Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Target-auto-hdg for backcourse

Postby Octal450 » Fri Apr 14, 2017 9:21 pm

Hmm, changing that does nothing. to target-auto-hdg-deg
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Target-auto-hdg for backcourse

Postby sanhozay » Fri Apr 14, 2017 10:57 pm

Did you check it on a localizer?

It only adds 180° if it's a localizer (I think loc_node is "instrumentation/nav[0]/nav-loc", which is true for a localizer navaid).
Code: Select all
  if ( loc_node->getBoolValue() && backcourse_node->getBoolValue() ) {
      // tuned to a localizer and backcourse mode activated
      trtrue += 180.0;   // reverse the target localizer heading
      SG_NORMALIZE_RANGE(trtrue, 0.0, 360.0);
      nta_hdg = trtrue - adjustment - hdg_error;
  } else {
      nta_hdg = trtrue + adjustment - hdg_error;
  }
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: Target-auto-hdg for backcourse

Postby Octal450 » Fri Apr 14, 2017 11:51 pm

Yup. I tried to fly a ILS in B/C, and a VOR LOC in B/C. The property stayed the same.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: Target-auto-hdg for backcourse

Postby sanhozay » Sat Apr 15, 2017 9:49 am

It works as expected for me on 2017.2.0 (and I suspect it has done the same for many versions).

EGNM-14, frequency 110.9
Image

EGNM-14, frequency 110.9, with back course enabled
Image

I took off from EGNM-32, flew for a while, dialled in the localizer for EGNM-14 behind me and took the above screenshots within a few seconds of each other. I didn't bother trying to actually align on the localizer but the 180° flip is clear.
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: Target-auto-hdg for backcourse

Postby Octal450 » Sat Apr 15, 2017 2:00 pm

OK, then something is wrong. I'll do some troubleshooting. Thanks.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm


Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 1 guest