Board index FlightGear Development

How to configure the control algorithms of an aircraft

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

How to configure the control algorithms of an aircraft

Postby Jarmck » Fri Jan 09, 2015 10:38 am

hi, guys,

what i'm dealing with is to use flightgear for control algorithm tuning,
but i didn't find enough docs for this.

so, do you know how flightgear works with the inputs of the joysticks, or whatever control devices,
and by what means the inputs are transformed into signals of the control surfaces.

does there really exist a kind of flight control system in flightgear :?:

i really appreciate your help, that you! :)
Jarmck
 
Posts: 2
Joined: Fri Jan 09, 2015 10:26 am

Re: How to configure the control algorithms of an aircraft

Postby Hooray » Fri Jan 09, 2015 11:12 am

Hi & welcome,

I'd suggest to check out this article, as well as the sidebar on the right for additional pointers: http://wiki.flightgear.org/Autopilot
Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: How to configure the control algorithms of an aircraft

Postby Johan G » Fri Jan 09, 2015 11:25 am

Edit: Hooray beat me to it, but I will post this anyway.

FlightGear is extremely flexible when it comes to this. 8)

Lets start by mentioning a few things that will be good to have further down.
  • The "nervous system" of FlightGear is the property tree, which is a tree-like structure that stores values as properties. These properties are used for interfacing various things.
  • I will reference to $FGDATA a few times. This is the location of the "data" directory/folder of your FlightGear installation.

Inputs
When FlightGear is starting up it among other things read a joystick configuration file (or several if you for example have joystick, pedals and a throttle). This configuration file is a XML file with bindings that maps axles and buttons to properties, and can do that conditionally or even with embedded scripts. The joystick configuration files lives in $FGDATA/Input/Joysticks.

In addition to the joystick configuration file there is also a keyboard configuration file with bindings, of with are related to flight controls. That file lives in $FGDATA.

The bindings are themselves stored in the property tree, and in fact the configuration files are a so called PropertyList file that contains the properties serialized in XML form.

Flight dynamic models (FDMs)
Depending on which aircraft is used there can be different FDMs that determin how the aircraft acts in the air (and on the ground). The two ones currently in use are YASim and JSBSim.

The properties with the control inputs are fed to them and will usually control the deflection of the control surfaces or are driving a flight control system.

Flight control systems (FCSs)
Most aircraft does not have a flight control system (FCS) and in essence feed the control inputs directly to the control surfaces, however some do have one.

The flight control systems can be built in many ways. Some are programs in FlightGears scripting language Nasal and some are built using property rules in a way similar to how autopilots in FlightGear are configured.

One can of course also mix Nasal and property rules, for example having a cockpit control with a binding that will call a Nasal script that sets some properties that will in turn override some control laws of the FCS.

JSBSim aircraft can have the FCS integrated in the FDM configuration file and the way they are set up is very much like how they are set up with property rules (if I have understood it correctly).
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5513
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: How to configure the control algorithms of an aircraft

Postby Jarmck » Fri Jan 09, 2015 2:48 pm

Hi, Johan,

So, you have just mentioned that if i'm going to configure a FCS, i will have about three means to acomplish that (the third one is what i heard from others):
1. is to work with a Nasal or property rules, or both;
2. is to use a JSBSim aircraft which may allow me to integrate the FCS in the FDM configuration file;
3. is to use a matlab or other external FDMs.

Is that correct :?:

Thank all you guys to help me :!: :D
Last edited by Johan G on Fri Jan 09, 2015 3:22 pm, edited 1 time in total.
Reason: Please don't quote entire posts.
Jarmck
 
Posts: 2
Joined: Fri Jan 09, 2015 10:26 am

Re: How to configure the control algorithms of an aircraft

Postby Hooray » Fri Jan 09, 2015 3:12 pm

yeah, that's basically correct - how you should proceed is mainly determined by your requirements/goals - for instance, JSBSim involves XML and possibly C++ level changes - property rules/ap stuff is generally pretty flexible but also somewhat restricted, Nasal is fairly flexible but generally frame-rate/garbage-collection bound, so may affect frame-spacing and frame rate of the fg main loop. External interfacing works pretty well but isn't as integrated obviously, and bring a certain setup overhead with it, too.

People intimately familiar with JSBSim and its concepts (or with a strong background in control theory and aerodynamics), will usually want to use JSBSim.
People with a "tinkering mentality" should be just fine using Nasal, replacing performance-critical stuff with XML-based PropertyRules.
External interfacing (matlab etc) is usually used by professional/proprietary projects that may need to work with closed-source code/data.

The latter is usually also used for hooking up external plotting tools to fgfs for visualization purposes.
If you're looking for a totally integrated solution, Nasal/Canvas is offering a ton of possibilities, as can be seen by fgplot: http://wiki.flightgear.org/FGPlot

In addition, there are some hard-coded restrictions affecting if/how certain solutions may be feasible/appropriate - but the details will heavily depend on your concrete use-case/scenario.
JSBSim stuff generally works great and it's a fairly accessible code-base, too - so can be easily extended by people familiar with C++ - and extending JSBSim also doesn't necessarily involve building FlightGear from source, so is pretty straightforward (fgfs can use jsbsim in "external fdm" mode).
Rebuilding fgfs from source is a completely different challenge - but once you've got a working build environment, it's hard to beat the degree of integration offered by using built-in means (PropertyRules, Nasal, Canvas, I/O etc).
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: How to configure the control algorithms of an aircraft

Postby Johan G » Fri Jan 09, 2015 3:27 pm

What are you going to use this for? Is it for tuning an external FCS or autopilot using an FDM in FlightGear, is it tuning a FlightGear aircraft? Both can and have been done. Or is it something else? This might make it easier for people here to figure out what you need. ;)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5513
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit


Return to Development

Who is online

Users browsing this forum: No registered users and 29 guests