From eb7f733c0513f920b2dd9e351ad54965e4b118e7 Mon Sep 17 00:00:00 2001 From: alexklimaj Date: Fri, 5 Jul 2024 11:05:50 -0600 Subject: [PATCH] Remove thrust from altitude graph. Check if there is a valid altitude setpoint before plotting. --- app/plot_app/configured_plots.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/plot_app/configured_plots.py b/app/plot_app/configured_plots.py index ac72b5114..c12d386ac 100644 --- a/app/plot_app/configured_plots.py +++ b/app/plot_app/configured_plots.py @@ -194,13 +194,13 @@ def generate_plots(ulog, px4_ulog, db_data, vehicle_data, link_to_3d_page, data_plot.add_graph(['baro_alt_meter'], colors8[1:2], ['Barometer Altitude']) data_plot.change_dataset('vehicle_global_position') data_plot.add_graph(['alt'], colors8[2:3], ['Fused Altitude Estimation']) + # If there is no altitude setpoint and we don't check, the Y axis always starts at 0. data_plot.change_dataset('position_setpoint_triplet') - data_plot.add_circle(['current.alt'], [plot_config['mission_setpoint_color']], - ['Altitude Setpoint']) - data_plot.change_dataset(actuator_controls_0.thrust_sp_topic) - if actuator_controls_0.thrust_z_neg is not None: - data_plot.add_graph([lambda data: ('thrust', actuator_controls_0.thrust_z_neg*100)], - colors8[6:7], ['Thrust [0, 100]']) + if 'position_setpoint_triplet' in data and 'current' in data['position_setpoint_triplet']: + current = data['position_setpoint_triplet']['current'] + if 'alt' in current and current['alt'] is not None: + data_plot.add_circle(['current.alt'], [plot_config['mission_setpoint_color']], + ['Altitude Setpoint']) plot_flight_modes_background(data_plot, flight_mode_changes, vtol_states) if data_plot.finalize() is not None: plots.append(data_plot)