Board index FlightGear Development Nasal

Autopilot  Topic is solved

Nasal is the scripting language of FlightGear.


Postby jamesBG » Fri May 04, 2018 7:59 am


I am trying to write a basic autopilot in Nasal, starting off with performing a turn every 30 seconds or so. I can't seem to work out what the best way to perform a turn is, should I be interfacing with the autopilot or with the orientation or should I be moving the ailerons.

For some context, the end goal is for this autopilot to be able to search an area to find something. So I'm not really worried about things like take-off and landing, just what happens in flight.

Thanks for your help.
Posts: 9
Joined: Fri May 04, 2018 7:37 am

Re: Autopilot  

Postby PINTO » Fri May 04, 2018 4:55 pm

Having done something like this before, I'd recommend first make a good autopilot backend. Make sure the regular heading hold works good. Then, via nasal, just write to the target heading property that your autopilot is seeking. I believe the default one is "/autopilot/settings/heading-bug-deg".

Here's my code: ... /drone.nas - specifically the "fly_pattern" function.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki) is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
Posts: 961
Joined: Wed Oct 21, 2015 6:28 pm
Callsign: pinto
Version: 2016.3.0
OS: Win10

Re: Autopilot

Postby jamesBG » Sat May 05, 2018 10:09 am

Thank you for your help.
Turning using .../heading-bug-deg works perfectly.
I am finding though that when setting the altitude "/autopilot/settings/target-altitude-ft" , it is always set to 21 no matter what value I put in. I have the same problem with setting landing gear down to false, the value is still true.
Do you know why it wouldn't be responding to these commands?

Posts: 9
Joined: Fri May 04, 2018 7:37 am

Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest