# ENU to rolled pitched yawed coordinate transform

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?

• I think it'd be easier if you posted your original use. – Erik Mar 6 at 15:07
• My original what? – user2913869 Mar 6 at 15:23
• The final application is dual axis servo with a camera attached (this is the "laser turret"). The servo is rigidly attached to a platform base that will be driven out to an arbitrarily location (this is the "tank base"). The camera will be instructed to look at arbitrary things ("ufo") at arbitrary locations. Everything else in the post is exactly the same: The platform base has inclinometers, GPS coordaintes, bearing information, and it will be commanded to look at something specified with ENU coordaintes. I need to perform the coordinate transforms to turn servo/camera to look at the object. – user2913869 Mar 6 at 15:59
• There have been previous questions that were similar although they might have been trying to convert in the other direction. Try searching on yaw or pitch. – mkennedy Mar 6 at 17:29
• I've tried searching this stack exchange and google, but I'm having trouble finding the similar questions you are referring to. Would you mind pointing me to your example question? – user2913869 Mar 6 at 21:59