-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from argparse import ArgumentParser | ||
parser = ArgumentParser() | ||
parser.add_argument("log") | ||
|
||
args = parser.parse_args() | ||
|
||
from pymavlink import mavutil | ||
|
||
def process(logfile): | ||
'''look for duplicate raw gyro samples''' | ||
mlog = mavutil.mavlink_connection(logfile) | ||
|
||
last_gyr = {} | ||
dup_count = {} | ||
total_dup = {} | ||
while True: | ||
m = mlog.recv_match(type='GYR') | ||
if m is None: | ||
break | ||
if not m.I in last_gyr: | ||
last_gyr[m.I] = m | ||
dup_count[m.I] = 0 | ||
total_dup[m.I] = 0 | ||
continue | ||
axes = 0 | ||
if last_gyr[m.I].GyrX == m.GyrX and abs(m.GyrX) >= 1: | ||
axes |= 1 | ||
if last_gyr[m.I].GyrY == m.GyrY and abs(m.GyrY) >= 1: | ||
axes |= 2 | ||
if last_gyr[m.I].GyrX == m.GyrZ and abs(m.GyrZ) >= 1: | ||
axes |= 4 | ||
if axes != 0: | ||
if dup_count[m.I] == 0: | ||
print("%s" % str(last_gyr[m.I])) | ||
dup_count[m.I] += 1 | ||
total_dup[m.I] += 1 | ||
print("%s dup=%u axes=%u" % (str(m), dup_count[m.I], axes)) | ||
else: | ||
dup_count[m.I] = 0 | ||
last_gyr[m.I] = m | ||
print(total_dup) | ||
|
||
process(args.log) | ||
|