Hello!
I have FG JSBSim model for my aircraft and i want to use FG as part of HIL simulation. So i send some control data from external control system, and JSBSim model from FG sends back some accelerations, velocities, positions, so on.
It works ok except one detail: My aircraft is a tiltrotor, so to control it i have to send pitch angles for each engine.
For JSBSim, it's not a problem, since it has property /propulsion/engine[N]/pitch-angle-rad.
But FG doesn't have such property. Therefore, i cannot setup this property in protocol configuration file, like this:
<input>
<line_separator>newline</line_separator>
<var_separator>tab</var_separator>
<!-- Controls -->
<chunk>
<name>aileron</name>
<type>float</type>
<node>/controls/flight/aileron</node>
</chunk>
....
</input>
FG has property /controls/flight/aileron which is mapped to /fcs/aileron-cmd-norm for JSBSim.
But FG doesn't have property, say, /controls/flight/engine[0]/pitch-angle-rad which would be mapped to /propulsion/engine[0]/pitch-angle-rad.
The workaround i suppose is:
1. Create nasal script that would have property, say, /controls/engines/engine[0]/pitch-angle-rad.
2. Expose this property to the protocol, say:
<input>
<line_separator>newline</line_separator>
<var_separator>tab</var_separator>
<!-- Controls -->
<chunk>
<name>engine_0_pitch</name>
<type>float</type>
<node>/controls/engines/engine[0]/pitch-angle-rad</node>
</chunk>
....
</input>
3. Write Nasal script that reads from FG's /controls/engines/engine[0]/pitch-angle-rad property and writes to JSBSim's /propulsion/engine[0]/pitch-angle-rad property.
The problem is that i don't have any experience with Nasal, and was unable to find any example, similar to the described above.
I suppose the situations when FG and JSBSim don't have directly mapped properties should be pretty common, and some examples must exist.
However, i didn't find any.
Could you please provide some examples or other hints, how to solve this task?