I've been tasked to use two YEI 3-space sensors (IMUs) to detect the azimuth and elevation (altitude in the image below) angle of a moving arm with respect to a fixed object, with a sensor on the end of the arm and one on the object. For example, the sensor on the moving arm is the star shown in the image below and the sensor on the object is the observer (image is borrowed from the Wikipedia page on Azimuth).
I can move the arm along the sphere of the horizon as in the image above, but I can move the arm up and down in a straight line only.
However, I calculate correctly ONLY the azimuth angle. The angle equivalent to elevation/altitude barely ever changes during testing.
I've tried code based on the YEI documentation to calculate Pitch, Yaw, and Roll for a multi-axis joint or the following semi-pseudo code (based on quaternions to euler angles):
oriquat1 = sensor1.getUntaredOrientationAsQuaternion() oriquat2 = sensor2.getUntaredOrientationAsQuaternion() diffquat = oriquat1.inverse()*oriquat2 eulerang = convert2Euler(diffquat)
where "eulerang" is a vector containing the pitch, yaw, and roll. Both methods give me similar results.
I don't think it's an issue with the code per se but an issue with how I am positioning the sensors/using the sensors. I think I am calculating azimuth correctly because I can change the orientation of the moving-arm-sensor in a spherical manner along the horizon but not in the other direction.
Does it make sense for me to use the 3-space sensors to find the azimuth and elevation between a moving and static object? Is there a better method? (I do have some constraints if I should consider another method.)