Board index FlightGear Development Nasal

Testing of An Algorithm

Nasal is the scripting language of FlightGear.

Testing of An Algorithm

Postby Muhammad Ahmad » Sat Nov 03, 2018 7:14 am

I want to know that how can I test a designed algorithm in FlightGear
Muhammad Ahmad
 
Posts: 16
Joined: Sat Nov 03, 2018 7:05 am

Re: Testing of An Algorithm

Postby Hooray » Sat Nov 03, 2018 8:54 am

Muhammad Ahmad wrote in Sat Nov 03, 2018 7:14 am:I want to know that how can I test a designed algorithm in FlightGear



Hi & welcome, I am afraid, you will have to be a little more specific - otherwise, we can only provide a fairly generic response in the form of
  • by converting the algorithm to Nasal syntax/code
  • loading your code into FlightGear (e.g. via the console or by adding it to $FG_HOME/Nasal)
  • providing test data to invoke your ported algorithm
  • checking the output against the desired output

This would seem to be a good starting point: http://wiki.flightgear.org/Creating_new_Nasal_scripts

And here some more pointers that are likely to be relevant:

Depending on the type of algo/code you have in mind, it may also be necessary to come up with routines that Nasal may not support out of the box, e.g. if you have Python or JavaScript code doing something that fgfs/Nasal cannot currently do easily.

That being said, depending on the circumstances, you may be better off porting some/all of your algo into so called "property rules" due to Nasal running typically at frame rate and being subject to frame rate/spacing (latencies) as well as due to Nasal Garbage Collection "jitters": http://wiki.flightgear.org/Property_rule

Either way it would make sense to share some more information with us, so that others can chime in any provide additional feedback
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: 11272
Joined: Tue Mar 25, 2008 8:40 am

Re: Testing of An Algorithm

Postby Muhammad Ahmad » Sun Nov 04, 2018 5:08 am

Well I have gone through the above-mentioned procedure, but in my algo i need to take some inputs from FG just want to know how can I do, Like I need a state space containing information about Aircraft current Position and Velocity
Muhammad Ahmad
 
Posts: 16
Joined: Sat Nov 03, 2018 7:05 am

Re: Testing of An Algorithm

Postby Hooray » Sun Nov 04, 2018 7:40 am

please refer to $FG_ROOT/Docs: http://sourceforge.net/p/flightgear/fgd ... /tree/Docs

specifically, see:

README.introduction
README.properties
README.logging

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

(You will find /position, /velocities and /orientation nodes there)

You will want to look up the setprop/getprop APIs, to get you started, refer to these wiki articles:

http://wiki.flightgear.org/Property_Tree
http://wiki.flightgear.org/Nasal_library/props
http://wiki.flightgear.org/Developing_a ... Nasal_code
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: 11272
Joined: Tue Mar 25, 2008 8:40 am


Return to Nasal

Who is online

Users browsing this forum: No registered users and 2 guests