Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow "map XKF1" in MAVExplorer #693

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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