I’m trying to setup sensor-level HIL simulation with the latest PX4 firmware and using my own simulator, but I’m having some issues.
The pitch and the roll react correctly to gyro rate data, but reacts very slowly to accelerometer data.
What I mean is that when I rotate the aircraft, the attitude displayed in QGC correctly reacts based on gyro rates. However this change is kind of like ‘dead reckoning’ and will diverge from the actual pitch, so it is supposed to also use accelerometer data to improve this estimate. What happens is that this accelerometer-based fix takes very long to take effect. For example, if I respawn the aircraft level on the ground, the pitch may take 15 seconds to come back to level. During flight, the pitch diverges from the actual pitch in a matter of seconds, and takes 15 seconds to come back to the actual pitch value if I pause the simulation. The same thing happens with the heading.
Any ideas on what could be causing this issue? It’s as if the filter is running too slow…
*I’m using the latest version of the firwmare with the HIL Quad airframe
*HIL setup: I’m connecting the simulator and QGC through UDP to Mavproxy, and Mavproxy is connected to the Pixhawk through USB with a baudrate of 921600.
*I’m sending the HIL_SENSOR message with sensor data at a frequency of 500 to 1000 Hz
*I’m confident I’m calculating and sending the sensor data correctly (correct units, type, ranges, etc), and it is being received correctly by the PX4 because the attitude moves as it should, it just takes a long time to get to the correct attitude.