Skip to content

Commit

Permalink
allow "map XKF1" in MAVExplorer
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jun 20, 2022
1 parent 7de8c23 commit a96efeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def skip_to_type(self, type):
if self.type_nums is None:
# always add some key msg types so we can track flightmode, params etc
type = type.copy()
type.update(set(['MODE','MSG','PARM','STAT']))
type.update(set(['MODE','MSG','PARM','STAT','ORGN']))
self.indexes = []
self.type_nums = []
for t in type:
Expand Down Expand Up @@ -1139,7 +1139,7 @@ def skip_to_type(self, type):
if self.type_list is None:
# always add some key msg types so we can track flightmode, params etc
self.type_list = type.copy()
self.type_list.update(set(['MODE','MSG','PARM','STAT']))
self.type_list.update(set(['MODE','MSG','PARM','STAT','ORGN']))
self.type_list = list(self.type_list)
self.indexes = []
self.type_nums = []
Expand Down
16 changes: 9 additions & 7 deletions mavextra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,19 +1061,21 @@ def gps_offset(lat, lon, east, north):
distance = math.sqrt(east**2 + north**2)
return gps_newpos(lat, lon, bearing, distance)

ekf_home = None
ekf_origin = None

def ekf1_pos(EKF1):
'''calculate EKF position when EKF disabled'''
global ekf_home
global ekf_origin
from . import mavutil
self = mavutil.mavfile_global
if ekf_home is None:
if not 'GPS' in self.messages or self.messages['GPS'].Status != 3:
if getattr(EKF1,'C',0) != 0:
return None
if ekf_origin is None:
if not 'ORGN' in self.messages:
return None
ekf_home = self.messages['GPS']
(ekf_home.Lat, ekf_home.Lng) = gps_offset(ekf_home.Lat, ekf_home.Lng, -EKF1.PE, -EKF1.PN)
(lat,lon) = gps_offset(ekf_home.Lat, ekf_home.Lng, EKF1.PE, EKF1.PN)
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)

def quat_to_euler(q):
Expand Down

0 comments on commit a96efeb

Please # to comment.