Recently, I've been spending a good bit of time attempting to program all of my 
most-used aircraft so that I can engage and disengage the autopilot through the 
joystick.  I've been able to get this to work on the Seneca II with a short 
nasal script in Nasal/SenecaII.nasal that sets the 
/autopilot/CENTURYIII/controls and /autopilot/CENTURYIII/locks properties 
appropriately.  Silly me, I though it would be a simple matter to port the 
working code over to the Comanche PA-24-250 (w/ CIII autopilot).

Unfortunately, the structure of the nasal scripts of the PA24 bears very little 
resemblance to that of the Seneca II.  Although the relevant autopilot 
properties are the same for both planes, the flow of control is not.  For 
example, turning on the autopilot roll axis control with the plane on the 
ground is harmless in the Seneca, but will cause a nasal crash in the (stock, 
unmodified) Comanche, and turning the autopilot off again will not recover.  
(The ailerons will be locked permanently at 0 until you restart.)  The routine 
that crashes is action-sim.nas, a file that doesn't even exist in the Seneca. 
It contains an update_actions() script that is looped repeatedly, updating 
positions of control surfaces, etc.  With the autopilot on, the script attempts 
to get the appropriate aileron position from the autopilot, but it returns null 
and then cause a setValue() error when it blindly tries to set the actual 
aileron position to that null.  The same thing
 happens if I turn on the autopilot in flight by using the joystick to change 
the /autopilot/CENTURYIII/controls properties through a script.

Is there a general file and scripting structure that it is recommended to 
follow for implementing aircraft?  It's very challenging to learn to understand 
and modify aircraft implementations when the general arrangement of files is so 
different from one to the next.


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to