Skip to content

Commit

Permalink
mavextra: fixed distance_two(GPS,XKF1[0])
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Dec 20, 2023
1 parent 4d8c4ff commit 04375e5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions mavextra.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,9 @@ def get_lat_lon_alt(MSG):
alt = MSG.alt*0.001
elif hasattr(MSG, 'PN'):
# origin relative position from EKF
global ORGN
if ORGN is None:
ORGN = get_origin()
if ORGN is None:
return None
(lat,lon) = gps_offset(ORGN.Lat, ORGN.Lng, MSG.PN, MSG.PE)
(lat,lon,alt) = ekf1_pos(MSG)
lat = radians(lat)
lon = radians(lon)
alt = ORGN.Alt - MSG.PD
else:
return None
return (lat, lon, alt)
Expand Down Expand Up @@ -1098,7 +1092,8 @@ def ekf1_pos(EKF1):
ekf_origin = self.messages['ORGN']
(ekf_origin.Lat, ekf_origin.Lng) = (ekf_origin.Lat, ekf_origin.Lng)
(lat,lon) = gps_offset(ekf_origin.Lat, ekf_origin.Lng, EKF1.PE, EKF1.PN)
return (lat, lon)
alt = ekf_origin.Alt - EKF1.PD
return (lat, lon, alt)

def quat_to_euler(q):
'''
Expand Down

0 comments on commit 04375e5

Please sign in to comment.