Browse Source

LogAnalyzer: added 'import collections', allowed for some AC3.2 logging changes

mission-4.1.18
Andrew Chapman 11 years ago committed by Andrew Tridgell
parent
commit
f122b1ba37
  1. 11
      Tools/LogAnalyzer/DataflashLog.py
  2. 1
      Tools/LogAnalyzer/tests/TestBalanceTwist.py
  3. 4
      Tools/LogAnalyzer/tests/TestPitchRollCoupling.py
  4. 10
      Tools/LogAnalyzer/tests/TestUnderpowered.py

11
Tools/LogAnalyzer/DataflashLog.py

@ -297,6 +297,17 @@ class DataflashLog: @@ -297,6 +297,17 @@ class DataflashLog:
continue
if line == "----------------------------------------": # present in pre-3.0 logs
raise Exception("Log file seems to be in the older format (prior to self-describing logs), which isn't supported")
# Some logs are missing the initial dataflash header which says the log index and the type of log, but we can catch the vehicle
# type here too in the MSG line
if not self.vehicleType and tokens[0] == "MSG":
tokens2 = line.split(' ')
vehicleTypes = ["ArduPlane", "ArduCopter", "ArduRover"]
if tokens2[1] in vehicleTypes and tokens2[2][0].lower() == "v":
self.vehicleType = tokens2[1]
self.firmwareVersion = tokens2[1]
if len(tokens2) == 3:
self.firmwareHash = tokens2[2][1:-1]
continue
if len(tokens) == 1:
tokens2 = line.split(' ')
if line == "":

1
Tools/LogAnalyzer/tests/TestBalanceTwist.py

@ -15,5 +15,6 @@ class TestBalanceTwist(Test): @@ -15,5 +15,6 @@ class TestBalanceTwist(Test):
if logdata.vehicleType != "ArduCopter":
self.result.status = TestResult.StatusType.NA
return
# TODO: implement copter test for unbalanced or twisted copter frame

4
Tools/LogAnalyzer/tests/TestPitchRollCoupling.py

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
from LogAnalyzer import Test,TestResult
import DataflashLog
import collections
class TestPitchRollCoupling(Test):
'''test for divergence between input and output pitch/roll, i.e. mechanical failure or bad PID tuning'''
@ -25,7 +27,7 @@ class TestPitchRollCoupling(Test): @@ -25,7 +27,7 @@ class TestPitchRollCoupling(Test):
# figure out where each mode begins and ends, so we can treat auto and manual modes differently and ignore acro/tune modes
autoModes = ["RTL","AUTO","LAND","LOITER","GUIDED","CIRCLE","OF_LOITER"] # use NTUN DRol+DPit
manualModes = ["STABILIZE","DRIFT","ALT_HOLD"] # use CTUN RollIn/DesRoll + PitchIn/DesPitch
manualModes = ["STABILIZE","DRIFT","ALTHOLD","ALT_HOLD"] # use CTUN RollIn/DesRoll + PitchIn/DesPitch
ignoreModes = ["ACRO","SPORT","FLIP","AUTOTUNE"] # ignore data from these modes
autoSegments = [] # list of (startLine,endLine) pairs
manualSegments = [] # list of (startLine,endLine) pairs

10
Tools/LogAnalyzer/tests/TestUnderpowered.py

@ -55,11 +55,15 @@ class TestUnderpowered(Test): @@ -55,11 +55,15 @@ class TestUnderpowered(Test):
highThrottleSegments.append((start,i))
start = None
# loop through each checking CTUN.CRate, if < 50 FAIL, if < 100 WARN
# TODO: we should filter CRate and use its slope rather than value for this test
climbRate = "CRate"
if "CRate" not in logdata.channels["CTUN"]:
climbRate = "CRt"
# loop through each checking climbRate, if < 50 FAIL, if < 100 WARN
# TODO: we should filter climbRate and use its slope rather than value for this test
for seg in highThrottleSegments:
(startLine,endLine) = (data[seg[0]][0], data[seg[1]][0])
avgClimbRate = logdata.channels["CTUN"]["CRate"].getSegment(startLine,endLine).avg()
avgClimbRate = logdata.channels["CTUN"][climbRate].getSegment(startLine,endLine).avg()
avgThrOut = logdata.channels["CTUN"]["ThrOut"].getSegment(startLine,endLine).avg()
if avgClimbRate < climbThresholdFAIL:
self.result.status = TestResult.StatusType.FAIL

Loading…
Cancel
Save