On 7 Mar 2014, at 21:33, Alan Teeder <ajteeder@v-twin.org.uk> wrote:

I have now tried my WIP and found that I needed to change the way that I added extra variables in the /fdm/jsbsim/fcs property tree. Previously I did this in Nasal:
props.globals.getNode("/fdm/jsbsim/fcs/afcs-left-taileron-cmd-deg", 1).setDoubleValue(0);
props.globals.getNode("/fdm/jsbsim/fcs/afcs-right-taileron-cmd-deg", 1).setDoubleValue(0);
props.globals.getNode("/fdm/jsbsim/fcs/afcs-rudder-cmd-deg", 1).setDoubleValue(0);
props.globals.getNode("/fdm/jsbsim/fcs/afcs-throttle-cmd-norm", 1).setDoubleValue(0);
 
Now I have to do this the start of the aerodynamics section of the JSBSim Xml file
 
<aerodynamics>
 
    <property>fcs/afcs-left-taileron-cmd-deg</property>
    <property>fcs/afcs-right-taileron-cmd-deg</property>
    <property>fcs/afcs-rudder-cmd-deg</property>
    <property>fcs/afcs-throttle-cmd-norm</property>
 
    <axis name="LIFT">
 
I also set the initial values (all zero in this case) when I re-initialise my autopilot after an in-air reset.
 
It is likely that other aircraft that use user added properties within /fdm/jsbsim/fcs/ tree will need similar changes.


Okay, this is unfortunate - it was not my intention to require any aircraft changes.

The problem is, there is some state persisting in /fdm which is causing the upsets on re-position. My current solution is to wipe the entire /fdm tree on reposition, so JSBsim starts with clean values. Of course I didn’t realise aircraft developers were prep-ing values inside this area. (Any idea how wide-spread this practice is?)

I think the better solution would be to find exactly which /fdmjsbsim properties are causing the upsets, but that will be a much longer process. 

(BTW, can’t you initialise such properties from your JSBSim config file, instead of using Nasal? Then they would be created with their default values when the FDM starts, which would ‘just work’ on re-position. But, as I said, I was hoping not to require any aircraft changes)

Kind regards,
James