Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions python/cli/diagnose/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def generateReport(args):
'gyroscope': {"v": [], "t": [], "td": []},
'magnetometer': {"v": [], "t": [], "td": []},
'barometer': {"v": [], "t": [], "td": []},
'gps': {"v": [], "t": [], "td": []},
'gnss': {"v": [], "t": [], "td": []},
'cpu': {"v": [], "t": []},
'cameras': {}
}
Expand Down Expand Up @@ -76,7 +76,7 @@ def addMeasurement(type, t, v):
time = measurement.get("time")
sensor = measurement.get("sensor")
barometer = measurement.get("barometer")
gps = measurement.get("gps")
gnss = measurement.get("gps")
frames = measurement.get("frames")
metrics = measurement.get("systemMetrics")
if frames is None and 'frame' in measurement:
Expand All @@ -89,7 +89,7 @@ def addMeasurement(type, t, v):
and frames is None
and metrics is None
and barometer is None
and gps is None): continue
and gnss is None): continue

if startTime is None:
startTime = time
Expand All @@ -109,9 +109,9 @@ def addMeasurement(type, t, v):
addMeasurement(measurementType, t, v)
elif barometer is not None:
addMeasurement("barometer", t, barometer["pressureHectopascals"])
elif gps is not None:
enu = gnssConverter.enu(gps["latitude"], gps["longitude"], gps["altitude"])
addMeasurement("gps", t, [enu["x"], enu["y"], gps["altitude"]])
elif gnss is not None:
enu = gnssConverter.enu(gnss["latitude"], gnss["longitude"], gnss["altitude"])
addMeasurement("gnss", t, [enu["x"], enu["y"], gnss["altitude"]])
elif frames is not None:
for f in frames:
if f.get("missingBitmap", False): continue
Expand All @@ -135,7 +135,7 @@ def addMeasurement(type, t, v):
diagnoseGyroscope(data, output)
diagnoseMagnetometer(data, output)
diagnoseBarometer(data, output)
diagnoseGps(data, output)
diagnoseGNSS(data, output)
diagnoseCpu(data, output)

if args.output_json:
Expand Down
11 changes: 6 additions & 5 deletions python/cli/diagnose/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ def generateHtml(output, outputHtml):
for camera in output["cameras"]:
kvPairs.append((
'Camera #{}'.format(camera["ind"]),
'{:.1f}Hz {} frames'.format(
'{:.1f} Hz<span style="color: gray">, {} frames</span>'.format(
camera["frequency"],
camera["count"])))

SENSOR_NAMES = ["accelerometer", "gyroscope", "magnetometer", "barometer", "gps"]
SENSOR_NAMES = ["accelerometer", "gyroscope", "magnetometer", "barometer", "GNSS"]
for sensor in SENSOR_NAMES:
if sensor not in output: continue
kvPairs.append((
sensor.capitalize(),
sensor.capitalize() if sensor.islower() else sensor,
'No data' if output[sensor]["count"] == 0 else
'{:.1f}Hz {} samples'.format(
'{:.1f} Hz<span style="color: gray">, {} samples</span>'.format(
output[sensor]["frequency"],
output[sensor]["count"]
)))
Expand All @@ -194,7 +194,8 @@ def generateHtml(output, outputHtml):

for sensor in SENSOR_NAMES:
if sensor not in output: continue
s += generateSensor(output[sensor], sensor.capitalize())
name = sensor.capitalize() if sensor.islower() else sensor
s += generateSensor(output[sensor], name)

s += TAIL

Expand Down
20 changes: 10 additions & 10 deletions python/cli/diagnose/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,11 @@ def diagnoseBarometer(data, output):
if status.diagnosis == DiagnosisLevel.ERROR:
output["passed"] = False

def diagnoseGps(data, output):
GPS_MIN_FREQUENCY_HZ = None
GPS_MAX_FREQUENCY_HZ = 100.0
def diagnoseGNSS(data, output):
GNSS_MIN_FREQUENCY_HZ = None
GNSS_MAX_FREQUENCY_HZ = 100.0

sensor = data["gps"]
sensor = data["gnss"]
timestamps = np.array(sensor["t"])
deltaTimes = np.array(sensor["td"])
signal = np.array(sensor['v'])
Expand All @@ -668,16 +668,16 @@ def diagnoseGps(data, output):
timestamps,
deltaTimes,
getImuTimestamps(data),
GPS_MIN_FREQUENCY_HZ,
GPS_MAX_FREQUENCY_HZ,
GNSS_MIN_FREQUENCY_HZ,
GNSS_MAX_FREQUENCY_HZ,
plotArgs={
"title": "GPS time diff"
"title": "GNSS time diff"
},
allowDataGaps=True,
isOptionalSensor=True)
status.analyzeSignalDuplicateValues(signal)

output["gps"] = {
output["GNSS"] = {
"diagnosis": status.diagnosis.toString(),
"issues": status.serializeIssues(),
"frequency": computeSamplingRate(deltaTimes),
Expand All @@ -686,7 +686,7 @@ def diagnoseGps(data, output):
plotFrame(
signal[:, 0],
signal[:, 1],
"GPS position",
"GNSS position",
xLabel="ENU x (m)",
yLabel="ENU y (m)",
style='-' if len(timestamps) > 1 else '.',
Expand All @@ -696,7 +696,7 @@ def diagnoseGps(data, output):
plotFrame(
timestamps,
signal[:, 2],
"GPS altitude (WGS-84)",
"GNSS altitude (WGS-84)",
xLabel="Time (s)",
yLabel="Altitude (m)",
style='-' if len(timestamps) > 1 else '.')
Expand Down