Skip to content

Commit

Permalink
pymavlink: try to cope with old copter logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tridgell committed Jan 22, 2014
1 parent ab2623e commit b3179ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pymavlink/DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(self):
# read the whole file into memory for simplicity
self.msg_rate = {}
self.new_timestamps = False
self.interpolated_timestamps = False
self.px4_timestamps = False
self.px4_timebase = 0
self.timestamp = 0
Expand Down Expand Up @@ -166,7 +167,7 @@ def _find_time_base(self):

def _adjust_time_base(self, m):
'''adjust time base from GPS message'''
if self.new_timestamps:
if self.new_timestamps and not self.interpolated_timestamps:
return
if self.px4_timestamps:
return
Expand All @@ -189,7 +190,10 @@ def _set_time(self, m):
'''set time for a message'''
if self.px4_timestamps:
m._timestamp = self.timebase + self.px4_timebase
elif self.new_timestamps:
elif self.new_timestamps and not self.interpolated_timestamps:
if m.get_type() in ['ATT'] and not 'TimeMS' in m._fieldnames:
# old copter logs without TimeMS on key messages
self.interpolated_timestamps = True
if m.get_type() in ['GPS','GPS2']:
m._timestamp = self.timebase + m.T*0.001
elif 'TimeMS' in m._fieldnames:
Expand Down

0 comments on commit b3179ba

Please sign in to comment.