mirror of https://github.com/ArduPilot/ardupilot
Tools: add --core to solution_status_change.py
This commit is contained in:
parent
a22e28cf02
commit
8347a86d59
|
@ -17,8 +17,11 @@ from pymavlink import mavutil
|
||||||
|
|
||||||
|
|
||||||
class SolutionStatusChange(object):
|
class SolutionStatusChange(object):
|
||||||
def __init__(self, master):
|
def __init__(self, master, core=None):
|
||||||
self.master = master
|
self.master = master
|
||||||
|
self.core = core
|
||||||
|
if self.core is not None:
|
||||||
|
self.core = set(self.core)
|
||||||
|
|
||||||
def progress(self, text):
|
def progress(self, text):
|
||||||
'''emit text with possible timestamps etc'''
|
'''emit text with possible timestamps etc'''
|
||||||
|
@ -53,13 +56,13 @@ class SolutionStatusChange(object):
|
||||||
old_message_per_core = {}
|
old_message_per_core = {}
|
||||||
while True:
|
while True:
|
||||||
m = self.conn.recv_match(type=desired_type)
|
m = self.conn.recv_match(type=desired_type)
|
||||||
if m.C != 0:
|
|
||||||
continue
|
|
||||||
if m is None:
|
if m is None:
|
||||||
break
|
break
|
||||||
if m.C not in old_message_per_core:
|
if m.C not in old_message_per_core:
|
||||||
old_message_per_core[m.C] = m
|
old_message_per_core[m.C] = m
|
||||||
continue
|
continue
|
||||||
|
if self.core is not None and m.C not in self.core:
|
||||||
|
continue
|
||||||
current = old_message_per_core[m.C]
|
current = old_message_per_core[m.C]
|
||||||
if m.SS == current.SS:
|
if m.SS == current.SS:
|
||||||
continue
|
continue
|
||||||
|
@ -86,6 +89,9 @@ class SolutionStatusChange(object):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = optparse.OptionParser("solution-status-change.py [options]")
|
parser = optparse.OptionParser("solution-status-change.py [options]")
|
||||||
|
|
||||||
|
parser.add_option("", "--core", action="append", type="int",
|
||||||
|
default=[], help="core to show (default is all)")
|
||||||
|
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
|
@ -94,5 +100,8 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
master = args[0]
|
master = args[0]
|
||||||
|
|
||||||
tester = SolutionStatusChange(master)
|
if len(opts.core) == 0:
|
||||||
|
opts.core = None
|
||||||
|
|
||||||
|
tester = SolutionStatusChange(master, core=opts.core)
|
||||||
tester.run()
|
tester.run()
|
||||||
|
|
Loading…
Reference in New Issue