Browse Source

Tools: LogAnalyzer: fix various Tests for newer-style logs

Tools: LogAnalyzer: don't continue if we fail to set vehicle type from MSG

Tools: LogAnalyzer: cope with renamed CTUN.BarAlt attribute

Tools: LogAnalyzer: cope with renamed CTUN.BarAlt attribute

Tools: LogAnalyzer: cope with missing THR_MIN parameter
mission-4.1.18
Peter Barker 7 years ago
parent
commit
3dc6c34465
  1. 2
      Tools/LogAnalyzer/DataflashLog.py
  2. 16
      Tools/LogAnalyzer/tests/TestBrownout.py
  3. 7
      Tools/LogAnalyzer/tests/TestParams.py
  4. 12
      Tools/LogAnalyzer/tests/TestPitchRollCoupling.py

2
Tools/LogAnalyzer/DataflashLog.py

@ -609,7 +609,7 @@ class DataflashLog(object): @@ -609,7 +609,7 @@ class DataflashLog(object):
try:
self.set_vehicleType_from_MSG_vehicle(tokens[0]);
except ValueError:
pass
return
self.backPatchModeChanges()
self.firmwareVersion = tokens[1]
if len(tokens) == 3:

16
Tools/LogAnalyzer/tests/TestBrownout.py

@ -30,11 +30,15 @@ class TestBrownout(Test): @@ -30,11 +30,15 @@ class TestBrownout(Test):
self.result.statusMessage = "No CTUN log data"
return
if "BarAlt" in logdata.channels['CTUN']:
self.ctun_baralt_att = 'BarAlt'
else:
self.ctun_baralt_att = 'BAlt'
# check for relative altitude at end
if "CTUN" in logdata.channels and "BarAlt" in logdata.channels["CTUN"]:
(finalAlt,finalAltLine) = logdata.channels["CTUN"]["BarAlt"].getNearestValue(logdata.lineCount, lookForwards=False)
(finalAlt,finalAltLine) = logdata.channels["CTUN"][self.ctun_baralt_att].getNearestValue(logdata.lineCount, lookForwards=False)
finalAltMax = 3.0 # max alt offset that we'll still consider to be on the ground
if isArmed and finalAlt > finalAltMax:
self.result.status = TestResult.StatusType.FAIL
self.result.statusMessage = "Truncated Log? Ends while armed at altitude %.2fm" % finalAlt
finalAltMax = 3.0 # max alt offset that we'll still consider to be on the ground
if isArmed and finalAlt > finalAltMax:
self.result.status = TestResult.StatusType.FAIL
self.result.statusMessage = "Truncated Log? Ends while armed at altitude %.2fm" % finalAlt

7
Tools/LogAnalyzer/tests/TestParams.py

@ -46,9 +46,10 @@ class TestParams(Test): @@ -46,9 +46,10 @@ class TestParams(Test):
# if more complex checking or correlations are required you can access parameter values directly using the logdata.parameters[paramName] dict
if logdata.vehicleType == VehicleType.Copter:
self.__checkParamIsEqual ("MAG_ENABLE", 1, logdata)
self.__checkParamIsLessThan("THR_MIN", 200, logdata)
self.__checkParamIsLessThan("THR_MID", 701, logdata)
self.__checkParamIsMoreThan("THR_MID", 299, logdata)
if "THR_MIN" in logdata.parameters:
self.__checkParamIsLessThan("THR_MIN", 200, logdata)
self.__checkParamIsLessThan("THR_MID", 701, logdata)
self.__checkParamIsMoreThan("THR_MID", 299, logdata)
# TODO: add more parameter tests, these are just an example...
elif logdata.vehicleType == VehicleType.Plane:
# TODO: add parameter checks for plane...

12
Tools/LogAnalyzer/tests/TestPitchRollCoupling.py

@ -27,6 +27,16 @@ class TestPitchRollCoupling(Test): @@ -27,6 +27,16 @@ class TestPitchRollCoupling(Test):
self.result.statusMessage = "No ATT log data"
return
if not "CTUN" in logdata.channels:
self.result.status = TestResult.StatusType.UNKNOWN
self.result.statusMessage = "No CTUN log data"
return
if "BarAlt" in logdata.channels['CTUN']:
self.ctun_baralt_att = 'BarAlt'
else:
self.ctun_baralt_att = 'BAlt'
# 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",
@ -104,7 +114,7 @@ class TestPitchRollCoupling(Test): @@ -104,7 +114,7 @@ class TestPitchRollCoupling(Test):
lit = DataflashLog.LogIterator(logdata, startLine)
assert(lit.currentLine == startLine)
while lit.currentLine <= endLine:
relativeAlt = lit["CTUN"]["BarAlt"]
relativeAlt = lit["CTUN"][self.ctun_baralt_att]
if relativeAlt > minAltThreshold:
roll = lit["ATT"]["Roll"]
pitch = lit["ATT"]["Pitch"]

Loading…
Cancel
Save