Help on Durection Cosine Matrix

You have assumed that the BNO055 or similar orientation sensor is the best way to measure what you want to measure.

I don't think it is, and suggest to look for a simpler and better method. Sorry.