From 7ed90c6d0c48bf6b5c19f5b54b7b5843266f400c Mon Sep 17 00:00:00 2001 From: Sean Murphy Date: Wed, 21 Jun 2023 21:08:43 -0400 Subject: [PATCH] ekf2: process_logdata_ekf.py fix reject_mag* and imu_coning* key errors --- Tools/ecl_ekf/analysis/checks.py | 13 ++++++++----- Tools/ecl_ekf/analysis/metrics.py | 6 +++--- Tools/ecl_ekf/plotting/pdf_report.py | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Tools/ecl_ekf/analysis/checks.py b/Tools/ecl_ekf/analysis/checks.py index ac0248a4c1..36f806ead9 100644 --- a/Tools/ecl_ekf/analysis/checks.py +++ b/Tools/ecl_ekf/analysis/checks.py @@ -56,11 +56,14 @@ def perform_imu_checks( # perform the vibration check imu_status['imu_vibration_check'] = 'Pass' for imu_vibr_metric in ['imu_coning', 'imu_hfgyro', 'imu_hfaccel']: - mean_metric = '{:s}_mean'.format(imu_vibr_metric) - peak_metric = '{:s}_peak'.format(imu_vibr_metric) - if imu_metrics[mean_metric] > check_levels['{:s}_warn'.format(mean_metric)] \ - or imu_metrics[peak_metric] > check_levels['{:s}_warn'.format(peak_metric)]: - imu_status['imu_vibration_check'] = 'Warning' + mean_metric = '{:s}_mean_warn'.format(imu_vibr_metric) + peak_metric = '{:s}_peak_warn'.format(imu_vibr_metric) + mean_key = '{:s}_mean'.format(imu_vibr_metric) + peak_key = '{:s}_peak'.format(imu_vibr_metric) + if mean_key in imu_metrics and peak_key in imu_metrics: + if imu_metrics[mean_key] > check_levels[mean_metric] \ + or imu_metrics[peak_key] > check_levels[peak_metric]: + imu_status['imu_vibration_check'] = 'Warning' if imu_status['imu_vibration_check'] == 'Warning': print('IMU vibration check warning.') diff --git a/Tools/ecl_ekf/analysis/metrics.py b/Tools/ecl_ekf/analysis/metrics.py index 6c07c12caa..d435f88af9 100644 --- a/Tools/ecl_ekf/analysis/metrics.py +++ b/Tools/ecl_ekf/analysis/metrics.py @@ -104,9 +104,9 @@ def calculate_innov_fail_metrics( # calculate innovation check fail metrics for signal_id, signal, result in [('posv', 'reject_ver_pos', 'hgt_fail_percentage'), - ('magx', 'reject_mag_x', 'magx_fail_percentage'), - ('magy', 'reject_mag_y', 'magy_fail_percentage'), - ('magz', 'reject_mag_z', 'magz_fail_percentage'), + ('magx', 'fs_bad_mag_x', 'magx_fail_percentage'), + ('magy', 'fs_bad_mag_y', 'magy_fail_percentage'), + ('magz', 'fs_bad_mag_z', 'magz_fail_percentage'), ('yaw', 'reject_yaw', 'yaw_fail_percentage'), ('velh', 'reject_hor_vel', 'vel_fail_percentage'), ('velv', 'reject_ver_vel', 'vel_fail_percentage'), diff --git a/Tools/ecl_ekf/plotting/pdf_report.py b/Tools/ecl_ekf/plotting/pdf_report.py index a22e7fec63..785ea4df22 100644 --- a/Tools/ecl_ekf/plotting/pdf_report.py +++ b/Tools/ecl_ekf/plotting/pdf_report.py @@ -222,7 +222,7 @@ def create_pdf_report(ulog: ULog, multi_instance: int, output_plot_filename: str data_plot = CheckFlagsPlot( status_flags_time, estimator_status_flags, [['reject_hor_vel', 'reject_hor_pos'], ['reject_ver_vel', 'reject_ver_pos', 'reject_hagl'], - ['reject_mag_x', 'reject_mag_y', 'reject_mag_z', + ['fs_bad_mag_x', 'fs_bad_mag_y', 'fs_bad_mag_z', 'reject_yaw'], ['reject_airspeed'], ['reject_sideslip'], ['reject_optflow_x', 'reject_optflow_y']], x_label='time (sec)',