Can I extract yaw, pitch and roll from XYZ and/or latitude, longitude and altitude information

coordinate systemsrotationstrigonometry

I have a problem regarding my programming project and I'm stuck on the mathematical side of the problem.

I am parsing geometrical data from a provider and from their side every information is provided, but because of access problems, I don't have access to every field and my task is to recalculate the values when they get parsed. I still have the original data so that I can check if my calculations are right (or close enough).

I have access to the latitude, longitude and altitude information as well as the ECEF coordinates. Because of my limited geometry/trigonometry knowledge my problem is that I don't know if its even possible to extract that data from the info I have, and if so in what way.

I managed to recaluclate ECEF coordinates from latitude ,longitude but I wasn't successful with pitch, roll, yaw.

Data that I we acquire from provider (JSON):

 "pos": {
     "pitch": -0.839661672,
     "roll": -1.663901733,
     "x": -2707284.431485295,
     "y": -4262211.770268887,
     "yaw": 1.160845159,
     "z": 3883714.949993163
 },
 "lat_lng": {
     "height": -8.501139877, <- altitude
      "lat": 37.751917496,
      "lng": -122.423062823
 }

Data I have access to (JSON):

 "pos": {
     "pitch": ?, <- need this
     "roll": ?, <- need this
     "x": -2707284.431485295, <- calculated from lat_lng
     "y": -4262211.770268887, <- calculated from lat_lng
     "yaw": ?, <- need this
     "z": 3883714.949993163 <- calculated from lat_lng
 },
 "lat_lng": {
     "height": -8.501139877, <- altitude
      "lat": 37.751917496,
      "lng": -122.423062823
 }

As I understood I need a rotation matrix which can be easily converted to pitch, yaw ,roll. Formulas that I'm planning to use (found on other threads):

roll = math.atan2( -R[2][0], math.sqrt((R[2][1] * R[2][1]) + (R[2] 
[2] * R[2][2])) )
pitch = math.atan2( R[1][0], R[1][1] )
yaw = math.atan2( R[2][1], R[2][2] )

EDIT: Not homework, work related

Best Answer

Can I extract yaw, pitch and roll from XYZ and/or latitude, longitude and altitude information

No. The spherical coordinates (latitude, longitude, altitude) and the Cartesian coordinates (ECEF) both specify a location -- you can calculate one set of coordinates from the other. But (pitch, roll, yaw) specifies an orientation, and none of the data you show seem related to that. (Rotation matrices serve to convert between various representations of an orientation, but they don't help if you don't have some representation to begin with.)

Related Question