Hello all. I am using the BNO055 in NDOF mode, gathering the quaternions from the BNO055, and converting them to Euler Angles as shown in the wikipedia article here . We are making a modification to our device to where the orthoganl axes of the BNO055 do not line up with our systems axes, and thus we are trying to make an offset. Below I have attached an image showing the desired change:
In the above image, the black arrows represent the axes that we have remapped the BNO055 to (in accordance with the Datasheet), and the dashed red arrows represent where we want to shift the x-z coordinate plane, with the y axis remaining the same. The outer box is the physical orientation of the BNO055. This is just an offset to the pitch by roughly 30 degrees, however, we cannot just simply add 30 degrees to the final pitch as this will cause 2nd and 3rd order problems that need to then be rectified.
In an attempt to add an offset without generating the 2nd and 3rd order problems, we are trying to calculate the quaternion version of a 30 degree pitch offset, and use it to rotate the x-z plane. Unfortunately, we have not run into any success, as any adjustments we make to the quaternions reflect erroneous data after it is converted to the Euler Angles.
If anyone has more experience with quaternions and rotating the axes, help would be greatly appreciated.
Thanks for your inquiry.
In your case the best solution is to figure out the rotation matrix to convert the raw data of accel, gyro and mag from sensor x/y/z axes (black color) to your device body X/Y/Z axes (red color) and then feed the converted data to 9DoF sensor fusion to get the Euler angles with respect to the body axes. BNO055 is fixed which means that you cannot do the above. So you may do one of the two things:
(1) Redesign your PCB to make sure BNO055 sensor axes x/y/z are parallel to your device body axes X/Y/Z to keep everything simple.
(2) Switch to BHI260AP and also make sensors axes be parallel to body axes. BHI260AP is programmable and has SDK for you to do the above data conversion if sensor axes are not parallel to body axes.