Board index FlightGear Development New features

make defined events in Flighgear?

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

make defined events in Flighgear?

Postby Erik_S » Wed Jun 30, 2010 8:48 am

Hello I have a question.

I want to use FlightGear for university. I can compile the complete Program but have only low skills in using C++....


The demand seems to be difficult for me. Is it possible in Flighgear to make defined events?


That's the task:

5 minutes of free-flight
then go to an defined position and altitude -> then doing a flight-task for 5 minutes
go to an defined altitude -> here I need to have some defined „angle of roll“ change like the „Random attitude“ but not random
after that go to a defined Position and altitude for another flight-task.


Or if this isn't possible, I want to use the „Random Attitude“ function with a key command, could someone write me were and what I have to change in the sourcecode to get a key binding for the “random attitude” event.


Thanks

Erik
Erik_S
 
Posts: 3
Joined: Wed Jun 30, 2010 8:45 am
Version: 191

Re: make defined events in Flighgear?

Postby Avionyx » Wed Jun 30, 2010 8:55 am

Erik,

What you want to do is certainly possible, and probably not as hard as you think.

As its for a university project I assume your goal is to learn as much of how to do it on your own rather than just being given the code.
I suggest you look at the wiki first, start here and this will teach you about the property tree you will need to manipulate:
http://wiki.flightgear.org/index.php/Property_Tree

Then, depending on the aircraft you are using (and which flight dynamics model that uses - see the end of that wiki article) you'll need to send the parameters you want to set (position, bank angle etc) via the command line.

Once you've worked it all out and can run your scenario manually from the command line you can set it all to run automatically from within a nasal file in the aircraft or one of the systems. You could have it executed from a keystroke or, if you wished, even add a new switch in the cockpit to switch it on.

If you've got any more questions just ask and I'm sure someone will be able to help you.

Alex
Avionyx
 
Posts: 459
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGMD
Callsign: G-AVYX
Version: 2020.3.3
OS: Manjaro

Re: make defined events in Flighgear?

Postby Erik_S » Wed Jun 30, 2010 7:18 pm

Thank you for the answer,

this is the solution of my Problem. I created a new Tutorial to make a defined flight-task. I have not exspect such an easy way, FlightGear is realy a nice program.

If anyone else is interest in:

- make a new xml file in the planes tutorial folder
- make for every task a new step:

(like this)

<step>
<set>
<property>/orientation/roll-deg</property>
<value>45</value>
</set>


<exit>
<greater-than>
<property>/sim/time/elapsed-sec</property>
<value>40</value>
</greater-than>
</exit>
</step>





<step>
<set>
<property>/position/latitude-deg</property>
<value>37.57059</value>
</set>
<set>
<property>/position/longitude-deg</property>
<value>-122.2551</value>
</set>
<set>
<property>/position/altitude-ft</property>
<value>1812.34</value>
</set>

<exit>
<greater-than>
<property>/sim/time/elapsed-sec</property>
<value>90</value>
</greater-than>
</exit>
</step>


the command will be executed at the "elapsed-sec" value


- include the new file in the [plane]-tutorials.xml


Thanks for the help

Erik
Erik_S
 
Posts: 3
Joined: Wed Jun 30, 2010 8:45 am
Version: 191

Re: make defined events in Flighgear?

Postby Avionyx » Wed Jun 30, 2010 8:57 pm

Erik,

Thanks for posting the solution you found that works for you, hopefully others can learn from it.

Alex
Avionyx
 
Posts: 459
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGMD
Callsign: G-AVYX
Version: 2020.3.3
OS: Manjaro

Re: make defined events in Flighgear?

Postby Hooray » Tue Jul 06, 2010 10:55 am

The easiest way will be to use the built-in tutorial system, if that isn't yet powerful enough. Just using pure Nasal scripting and the property tree directly, should certainly be powerful. Let us know if you get stuck anywhere. There is also a dedicated Nasal sub 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: 12058
Joined: Tue Mar 25, 2008 8:40 am


Return to New features

Who is online

Users browsing this forum: No registered users and 1 guest