Compensate IMU pan/tilt
I am building quadcopter with IMU to get orientation in 3D and ultrasound range finder to measure distance to the ground. For some mechanical reasons, IMU is not aligned with quadcopter axis. Range finder is pointing down perpendicular to the copter plane. IMU has left-hand coordinate system where X axis pointing down, Z axis backwards and Y to the right. IMU provides quaternion to describe the orientation. The following picture illustrates the setup.