[tools] calibrate.py: plot measurements if no remaining after filtering

This commit is contained in:
Felix Ruess
2015-11-05 22:43:26 +01:00
parent 23c4903f84
commit 92b8565588
2 changed files with 11 additions and 1 deletions

View File

@@ -112,7 +112,10 @@ def main():
if options.verbose:
print("remaining "+str(len(flt_meas))+" after filtering")
if len(flt_meas) == 0:
print("Error: found zero IMU_"+options.sensor+"_RAW measurements for aircraft with id "+options.ac_id+" in log file after filtering!")
print("Error: found zero IMU_" + options.sensor + "_RAW measurements for aircraft with id " + options.ac_id +
" in log file after filtering!\nMaybe try the --auto_threshold option.")
if options.plot:
calibration_utils.plot_measurements(options.sensor, measurements)
sys.exit(1)
# get an initial min/max guess

View File

@@ -163,6 +163,13 @@ def print_imu_scaled(sensor, measurements, attrs):
print("StDev " + str(measurements[:,1:].std(axis=0)*attrs[0]) + " " + attrs[1])
def plot_measurements(sensor, measurements):
plt.plot(measurements[:, 0])
plt.plot(measurements[:, 1])
plt.plot(measurements[:, 2])
plt.ylabel('ADC')
plt.title("Raw %s measurements" % sensor)
plt.show()
def plot_results(sensor, measurements, flt_idx, flt_meas, cp0, np0, cp1, np1, sensor_ref, blocking=True):
"""Plot calibration results."""