Skip to content

Commit

Permalink
Merge branch 'gps-raw' of github.com:mrosseel/PiFinder into gps-raw
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosseel committed Jan 26, 2025
2 parents 6ac73fe + 89fc262 commit add39e3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions python/PiFinder/gps_ubx.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,16 @@ def _parse_ubx(self, data: bytes) -> dict:
def _ecef_to_lla(self, x: float, y: float, z: float):
a = 6378137.0
f = 1/298.257223563
b = a * (1 - f)
e = (a**2 - b**2)**0.5 / a
e = 0.0818191908426 # First eccentricity
p = (x**2 + y**2)**0.5
theta = math.atan2(z*a, p*b)
lat = math.atan2(z, p * (1 - e**2))
lon = math.atan2(y, x)
lat = math.atan2(
z + e**2 * b * math.sin(theta)**3,
p - e**2 * a * math.cos(theta)**3
)
N = a / (1 - e**2 * math.sin(lat)**2)**0.5
alt = p / math.cos(lat) - N
h = z / math.sin(lat) - N * (1 - e**2)
return {
"latitude": math.degrees(lat),
"longitude": math.degrees(lon),
"altitude": alt
"altitude": h
}

def _parse_nav_sol(self, data: bytes) -> dict:
Expand Down

0 comments on commit add39e3

Please sign in to comment.