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:
Now I have to do this the start of the aerodynamics section of the JSBSim Xml file
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)