Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fixed mavplayback and split #890

Merged
merged 2 commits into from
Dec 16, 2023
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
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
5 changes: 4 additions & 1 deletion tools/mavsplit_sysid.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ def process(filename):
if args.condition and not mavutil.evaluate_condition(args.condition, mlog.messages):
continue

if m.get_type() == 'BAD_DATA':
continue

sysid = m.get_srcSystem()
if not sysid in output:
fname = "%s-%u.%s" % (base, sysid, extension)
print("Creating %s" % fname)
output[sysid] = open(fname, mode='wb')

if output[sysid] and m.get_type() != 'BAD_DATA':
if output[sysid]:
timestamp = getattr(m, '_timestamp', None)
output[sysid].write(struct.pack('>Q', int(timestamp*1.0e6)))
output[sysid].write(m.get_msgbuf())
Expand Down
Loading