'''APM Dataflash log file reader and container class. Keep this simple, add more advanced or specific functions to DataflashLogHelper class'''
'''APM Dataflash log file reader and container class. Keep this simple, add more advanced or specific functions to DataflashLogHelper class'''
# TODO: implement some kind of iterator or different data storage approeach where we can step through the log by time/line and easily access, interpolate and cross-reference values from all channels at that point
filename=None
filename=None
vehicleType=""# ArduCopter, ArduPlane, ArduRover, etc, verbatim as given by header
vehicleType=""# ArduCopter, ArduPlane, ArduRover, etc, verbatim as given by header
'''check performance monitoring messages (PM) for issues with slow loops, etc'''
'''check performance monitoring messages (PM) for issues with slow loops, etc'''
def__init__(self):
def__init__(self):
self.name="Performance"
self.name="PM"
defrun(self,logdata):
defrun(self,logdata):
self.result=TestResult()
self.result=TestResult()
self.result.status=TestResult.StatusType.PASS
self.result.status=TestResult.StatusType.PASS
iflogdata.vehicleType!="ArduCopter":
self.result.status=TestResult.StatusType.NA
return
# NOTE: we'll ignore MaxT altogether for now, it seems there are quite regularly one or two high values in there, even ignoring the ones expected after arm/disarm events
# NOTE: we'll ignore MaxT altogether for now, it seems there are quite regularly one or two high values in there, even ignoring the ones expected after arm/disarm events
# gather info on arm/disarm lines, we will ignore the MaxT data from the first line found after each of these
# gather info on arm/disarm lines, we will ignore the MaxT data from the first line found after each of these
# TODO: implement test for underpowered copter (use log Randy provided)
ifnot"CTUN"inlogdata.channels:
self.result.status=TestResult.StatusType.UNKNOWN
self.result.statusMessage="No CTUN log data"
return
ifnot"ATT"inlogdata.channels:
self.result.status=TestResult.StatusType.UNKNOWN
self.result.statusMessage="No ATT log data"
return
# check for throttle (CTUN.ThrOut) above 700 for a chunk of time with copter not rising
highThrottleThreshold=700
tiltThreshold=20# ignore high throttle when roll or tilt is above this value
climbThresholdWARN=100
climbThresholdFAIL=50
minSampleLength=50
highThrottleSegments=[]
# find any contiguous chunks where CTUN.ThrOut > highThrottleThreshold, ignore high throttle if tilt > tiltThreshold, and discard any segments shorter than minSampleLength