Board index FlightGear Support Flying Autopilot

Flying throug Programming

Using the autopilot is an important thing when flying airliners.

Flying throug Programming

Postby Muhammad Ahmad » Sun Nov 11, 2018 6:22 pm

I need to simply fly an aircraft through nasal coding in which I could be able to fly an aircraft from on point to another without using mouse, joystick or keyboard and in between of the route could do some sort of maneuver , I am using flight gear on ubuntu so please if anybody can guide me in detail how I can do it.
Muhammad Ahmad
 
Posts: 16
Joined: Sat Nov 03, 2018 7:05 am

Re: Flying throug Programming

Postby Thorsten » Sun Nov 11, 2018 6:37 pm

Please don't open the same topic twice.

Thanks.
Thorsten
 
Posts: 10693
Joined: Mon Nov 02, 2009 8:33 am

Re: Flying throug Programming

Postby Hooray » Sun Nov 11, 2018 7:16 pm

Yes, I was going to post the same suggestion.
If you feel the need to re-ask something, i.e. for clarification, please do so explicitly.
I have in fact been trying to answer your questions rather carefully, and they should contain plenty of pointers to get you going.

If in doubt, you could post your background (programming, languages, OS etc), so that we can come up with more tailored responses targeting specifically your background.

That being said, if you are entirely new to FlightGear or to programming in general, you will certainly have to spend at least 1-2 weekends reading through the material we previously suggested, which should include some time to tinker with the property browser and the nasal console.

Besides, if this is some sort of "homework", please tell us so, and share your assignment, i.e. its requirements.

I am sorry to say, but if you didn't have any other substantial exposure to coding and flightgear internals, there is certainly a more or less steep learning curve involved here, depending on your background (i.e. maths).

Thus, if you need any additional help, i.e. hand-holding, you'd be better off demonstrating that you are working through the pointers we recommend - as a matter of fact, I would volunteer to help you with this, if you'd be willing to document your whole journey via the FlightGear wiki, including screen shots and videos. But for that to happen, you should ideally have already worked through the previously recommended pointers.

For related discussions, please see:

How would I go about controlling an airplane with nasal?
Possibility to run a fully automatized mission ?
viewtopic.php?f=18&t=20739&p=189488
viewtopic.php?f=30&t=20120&p=184663#p184663
What c++ lib for auto-controlling a plane in a virtual world
viewtopic.php?f=23&t=19042&p=176705#p176702
viewtopic.php?f=18&t=32584
viewtopic.php?f=23&t=29023
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: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: Flying throug Programming

Postby Muhammad Ahmad » Mon Nov 12, 2018 5:31 am

Thanks for your support, you are right I am a beginner I am a graduated engineer recently involved in a research work related to collision avoidance of an aircraft. In my work, I have implemented the algorithm in MATLAB but that was very basic and a lot of things were simply Assumed. So I need to check the validity of the algorithm via such a platform that gives some real feel. I never had used FlightGear before it so, I need a quick start to meet some deadlines, and documenting my journey would surely be a part of my preferences. I can explain you in more details about my work.but as a first step I simply need to do write a nasal script through which I may be able to fly an aircraft from a starting point to destination point without any input via keyboard, mouse etc
Muhammad Ahmad
 
Posts: 16
Joined: Sat Nov 03, 2018 7:05 am

Re: Flying throug Programming

Postby Muhammad Ahmad » Mon Nov 12, 2018 5:57 am

'' http://www.flightgear.org/uas-demo/'' is not working where else i can find it?
Muhammad Ahmad
 
Posts: 16
Joined: Sat Nov 03, 2018 7:05 am

Re: Flying throug Programming

Postby Octal450 » Mon Nov 12, 2018 5:14 pm

Hi Muhammad,
If you are trying to control an actual FG aircraft, not an AI, then the generic autopilot should be good enough for most things. You can write directly to the pitch deg (/autopilot/settings/target-pitch-deg). You can also write directly to the heading deg. If you wanted to write to a roll degree, you will need to modify the generic autopilot, as by default, it will not accept any roll degree inputs.

So, for example:
if you know the trajectory required to have the aircraft fly, the generic AP should be good enough. You could for example:

Tell the aircraft to fly heading 320, and pitch degree of 7.
Tell the second aircraft to fly the same course. Considering they are in similar area of each other, they should be staying in a nice formation.

if you are trying to get one to follow another, simply send the heading and pitch to that aircraft directly to the autopilot, and it should follow.

Do I understand this right?

Kind Regards,
Josh
Octal450

Lead Programmer, IDG (Join our Discord!)
Download High Quality Aircraft from Octal450 Hangar
User avatar
Octal450
 
Posts: 4225
Joined: Tue Oct 06, 2015 12:51 pm

Re: Flying throug Programming

Postby Hooray » Tue Nov 13, 2018 7:22 pm

Muhammad Ahmad wrote in Mon Nov 12, 2018 5:31 am:Thanks for your support, you are right I am a beginner I am a graduated engineer recently involved in a research work related to collision avoidance of an aircraft.


In that case, you probably need to "add" multiple aircraft to the scene, correct ?
If so, you should know that it is not easily possible for non-coders to instantiate multiple FDM-driven aircraft short of using multiple separate fgfs/fdm (yasim/jsbsim) instances via the multiplayer protocol.

If you don't need FDM driven traffic, you can simply refer to the previous responses I have posted, as they contain all that you need to know, you will specifically want to look for anything mentioning "tanker.nas", which is also a standard component of FlightGear, i.e. you can simply open the fgdata directory and look at the file. You will probably still want to look up the postings I mentioned to make heads and tails of it, otherwise it will look like pure gibberish to you without any fgfs/coding background.

However, it's a fairly straightforward mechanism, used in a handful of places already.

http://wiki.flightgear.org/Scripted_AI_Objects


In my work, I have implemented the algorithm in MATLAB but that was very basic and a lot of things were simply Assumed.


That's actually another viable option: create all your traffic in MATLAB and then hook up your traffic generator to fgfs, e.g. also via the multiplayer protocol - that way, the only thing you need is some kind of middleware/protocol to interface between fgfs and MATLAB.

If you are familiar with C/C++, it would be relatively straightforward to modify/patch the fgms sources accordingly, which we have done previously as part of the fgais project (see the wiki for details):

http://wiki.flightgear.org/FGAIS
Image


I simply need to do write a nasal script through which I may be able to fly an aircraft from a starting point to destination point without any input via keyboard, mouse etc


Like I said, please refer to tanker.nas and the comments you can find here.
That being said, AI traffic subject to a number of limitations, among others it cannot easily make use of 1) FDMs, 2) autopilots 3) route managers - these are all hard-coded components which are not made available to scripting space.

Again, you almost certainly want to use either MATLAB directly (if you know how patch/rebuild C/C++ code, aka fgms) or the tanker.nas Nasal script, in conjunction with the pointers you can find on the forum.
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: 11317
Joined: Tue Mar 25, 2008 8:40 am


Return to Autopilot

Who is online

Users browsing this forum: No registered users and 1 guest