def show(self, f, pattern=None, verbose=False): '''write status to status.txt''' if pattern is None: f.write('Counters: ') for c in self.counters: f.write('%s:%s ' % (c, self.counters[c])) f.write('\n') f.write('MAV Errors: %u\n' % self.mav_error) f.write(str(self.gps)+'\n') for m in sorted(self.msgs.keys()): if pattern is not None and not fnmatch.fnmatch(str(m).upper(), pattern.upper()): continue if verbose: try: mavutil.dump_message_verbose(f, self.msgs[m]) f.write("\n") except AttributeError as e: if "has no attribute 'dump_message_verbose'" in str(e): print("pymavlink update required for --verbose") else: raise e else: f.write("%u: %s\n" % (self.msg_count[m], str(self.msgs[m])))
csv_out[0] = "{:.8f}".format(last_timestamp) print(args.csv_sep.join(csv_out)) if isbin: csv_out = [ str(data[y]) if y != "timestamp" else "" for y in fields ] else: csv_out = [ str(data[y.split('.')[-1]]) if y.split('.')[0] == type and y.split('.')[-1] in data else "" for y in fields ] elif args.show_types: # do nothing pass elif args.verbose and istlog: mavutil.dump_message_verbose(sys.stdout, m) print("") else: # Otherwise we output in a standard Python dict-style format s = "%s.%02u: %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp)), int(timestamp * 100.0) % 100, m) if args.show_source: s += " srcSystem=%u srcComponent=%u" % (m.get_srcSystem(), m.get_srcComponent()) if args.show_seq: s += " seq=%u" % m.get_seq() print(s) # Update our last timestamp value. last_timestamp = timestamp