I'm trying to figure out the correct way to perform a certain coordinate transformation, and I think the best way to describe it is with an analogy. Imagine a tank has rolled up the side of a hill and it must point a laser at a UFO:
The command station, knowing the UFO's GPS location as well as the tank's GPS location, informs the tank of the UFO's position via a relative East,North,Up (ENU) coordinate system:
The tank operator needs to figure out how much to rotate the turret in az and el in order to point the laser at this target, relative to its local coordinate system. I'm calling the axes Side,Forward,Roof (SFR):
In addition to having the ENU coordinates, the tank operator also knows the following information:
1) It knows the bearing of the base relative to true north (which direction it is driving when driving forward). 2) It has an inclinometer installed on the base, squared up to the F and S axis. So it gets a roll and pitch measurement. The inclinometer utilizes gravity to make this measurement, so I believe these measurements are always indicating an offset from a perfectly level plane (I believe this is the way all inclinometers work, but just thought I'd state it).
I believe all I need to do is transform the ENU coordinates to SFR coordaintes, and then do the trig to figure out the correct az and el degrees. I'm struggling a little bit on visualizing and figuring out if I should rotate for the bearing first and then the roll/pitch, or the other way around. Maybe there is some cross product needed to get the roll and pitch in terms of the ENU axis first?
Can someone help me solve this problem?