If I truly understood the math behind it I could probably write it in PBP but I really don't and that, my friends, is why my robot has never balanced properly for more than a couple of seconds before bursting into oscillation and crashing violently :-)
I managed to get the compensation routines for the BME280 to work pretty well on PBP and that's some pretty intense math (in my mind) but this matrix transform stuff is like black magic to me.

I think this goes to show just what is possible with PBP if you know what you're doing. Kudos Dave, really nice job!