In any case,
here is my attempt at quaternions.
This was an interesting presentation, but its main focus were the details and problems of 32kSPS MPU-9250 data collection and logging rather than a justification of the need for it.
The actual signal contained in the data was clear at a much lower frequency than 32kSPS.
I'm using quaternion differentials at about 500Hz. It seems to work OK shortly after liftoff, but by apogee I'm off by as much as 30 degrees.
Closely looking at this seems to mean that this is a tilt calculation that’s derived from an accumulation of quaternion differential measurements.
Additionally
I'm doing rotation updates at 500Hz which is pretty quick, and the accuracy seems to drop off right when the rocket is flopping over.
— this indicates that the 30 degree tilt error primarily occurs at apogee, and not during the much longer ascent time during which the tilt results are also being calculated.
Since there’s no indication that a rocket’s roll rate increases at apogee, how can gyroscope crosstalk from roll axis be the main contributing cause for the 30 degree error since most of it happens at apogee.
While I have not yet done a detailed analysis of the MPU-9250’s data sheet regarding gyroscope axis crosstalk, I still think it would help to see the actual launch data and the conditions under which it was collected.
From my past experience as a developer of embedded scientific data collection modules, there might even be a problem with error accumulation with summing small numbers into large ones using simple floating point, especially over many seconds at 500SPS and above, especially if floating point calculations are used. The mantissa information of the small number gets truncated so the error in resulting sum shows increasing error. Such problems are easily remedied by converting the data to long 32 or 64 bit integers with the data’s lsb of resolution before summing.
One way to simply test whether its a small number summing problem would be to reduce the data collection rate from 500 to 50SPS and see if the characteristics of the calculated tilt error changes.
If there’s a constant crosstalk contribution from the gyroscopic roll axis, the tilt error should be relatively flat, instead of growing during apogee.
My point here is that error problems can be difficult to resolve and might require looking in many places.