Board index FlightGear Development Nasal

Autopilot  Topic is solved

Nasal is the scripting language of FlightGear.

Autopilot

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

Hi,

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.
jamesBG
 
Posts: 9
Joined: Fri May 04, 2018 8:37 am

Re: Autopilot  

Postby PINTO » Fri May 04, 2018 5: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: https://github.com/l0k1/QF-4E/blob/mast ... /drone.nas - specifically the "fly_pattern" function.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10

Re: Autopilot

Postby jamesBG » Sat May 05, 2018 11: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?

Thanks
jamesBG
 
Posts: 9
Joined: Fri May 04, 2018 8:37 am


Return to Nasal

Who is online

Users browsing this forum: No registered users and 2 guests