I have come across a similar problem. After starting the simulation from Simulink, unpausing the simulator in FlightGear (by pressing "p") solved the problem for me. I don't know the reason, but somehow global positioning and ailerons angles work fine even FlightGear is paused. However, spin animations won't work when paused.
You can also start FlightGear unpaused by editing the runfg.bat file (which is generated by simulink GEN FG RUN block) by adding code --disable-freeze .
My setup is:MATLAB 2018b
FlightGear 2018.1.1
Aircraft --> custom made quadrotor
My model xml file is as below:
- Code: Select all
<PropertyList>
<path>speedy.ac</path>
<animation>
<type>spin</type>
<object-name>prop1</object-name>
<property>engines/engine[0]/rpm</property>
<factor>1</factor>
<center>
<x-m>-0.645391</x-m>
<y-m>0.772926</y-m>
<z-m>0.146984</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>spin</type>
<object-name>prop2</object-name>
<property>engines/engine[1]/rpm</property>
<factor>1</factor>
<center>
<x-m>0.651682</x-m>
<y-m>0.772986</y-m>
<z-m>0.146984</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>spin</type>
<object-name>prop3</object-name>
<property>engines/engine[2]/rpm</property>
<factor>1</factor>
<center>
<x-m>0.651682</x-m>
<y-m>-0.749851</y-m>
<z-m>0.146984</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>spin</type>
<object-name>prop4</object-name>
<property>engines/engine[3]/rpm</property>
<factor>1</factor>
<center>
<x-m>-0.645482</x-m>
<y-m>-0.749851</y-m>
<z-m>0.146984</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
</PropertyList>
You should also consider these inputs to the Simulink block "Pack net_fdm Packet for FlightGear":
num_engines = 4
eng_state = [2 2 2 2]
rpm = [rpm1 rpm2 rpm3 rpm4]