Skip to content

Commit

Permalink
fixed mavplayback
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Dec 16, 2023
1 parent a7a6a87 commit fe9886f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/mavplayback.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ def pause(self):

def rewind(self):
'''rewind 10%'''
pos = int(self.mlog.filehandle.tell() - 0.1*self.filesize)
pos = int(self.mlog.f.tell() - 0.1*self.filesize)
if pos < 0:
pos = 0
self.mlog.filehandle.seek(pos)
self.find_message()

def forward(self):
'''forward 10%'''
pos = int(self.mlog.filehandle.tell() + 0.1*self.filesize)
pos = int(self.mlog.f.tell() + 0.1*self.filesize)
if pos > self.filesize:
pos = self.filesize - 2048
self.mlog.filehandle.seek(pos)
Expand All @@ -149,7 +149,7 @@ def find_message(self):
self.msg = self.mlog.recv_match(condition=args.condition)
if self.msg is not None and self.msg.get_type() != 'BAD_DATA':
break
if self.mlog.filehandle.tell() > self.filesize - 10:
if self.mlog.f.tell() > self.filesize - 10:
self.paused = True
break
self.last_timestamp = getattr(self.msg, '_timestamp')
Expand Down Expand Up @@ -190,13 +190,13 @@ def next_message(self):

while True:
self.msg = self.mlog.recv_match(condition=args.condition)
if self.msg is None and self.mlog.filehandle.tell() > self.filesize - 10:
if self.msg is None and self.mlog.f.tell() > self.filesize - 10:
self.paused = True
return
if self.msg is not None and self.msg.get_type() != "BAD_DATA":
break

pos = float(self.mlog.filehandle.tell()) / self.filesize
pos = float(self.mlog.f.tell()) / self.filesize
self.slider.set(pos)
self.filepos = self.slider.get()

Expand Down

0 comments on commit fe9886f

Please sign in to comment.