> From: Johnathan Van Why <jrvanwhy@gm...> - 2012-08-29 13:20
>
> I have a need to run Nasal code at the same rate as the simulation.
>
> At this point, I am unsure which to pursue. Which method do you find to be
> better?

To be frank, the whole idea is just bad in the first place - so I vote 
for #3: avoid *any* Nasal in the fast simulation loop.
Nasal execution is slow and non-deterministic. Running it in the fast 
simulation loop is the last thing we want.

I know, some people on the forum would like to eventually replace 
fgfs(.exe) with nasal(.exe), because apparently everything is "just 
better" (tm) when implemented in Nasal (core = bad, nasal = good). But I 
really think this is a completely wrong direction - and harming the project.

Concerning your original issue on implementing an autopilot: a much 
better way to do it is to avoid Nasal for the actual autopilot 
controller elements (numeric computation). Instead, use XML "autopilot" 
rules for the filter, gain, damper, integrator elements:
http://wiki.flightgear.org/Autopilot_Configuration_Reference

You can then use Nasal for the high level stuff, and 
enable/disable/switch the individual controller elements (e.g. in order 
to automatically switch the autopilot mode when capturing the ILS). 
There are some nice examples with fgdata/Git aircraft. You could look at 
the 777.

This is also how such things are done in the real world: controllers 
aren't implemented in imperative programming languages these days - 
especially not in scripting languages. People use model-based design and 
connect controller elements - using graphical tools like 
MATLAB/Simulink. Obviously, FG is missing a graphical interface to 
specify the controller rules - but the idea of specifying through XML is 
the same and specification is straight forward.

cheers,
Thorsten


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to