diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h index c444bcd46e326ef6afaed1c35ee12e20bf474e22..f40fc702ec457e73d1f29857051d3ebbb8880bd6 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h @@ -168,6 +168,8 @@ private: bool m_shouldPerformStep = false; // > Flag for whether to store data for plotting bool m_shouldStoreData_for_plotting = false; + // > Flag for reseting the zoom level + bool m_shouldResetZoom = false; // > Time (as a float) for the horizontal axis float m_time_for_step = 0.0f; // > The duration for which to record the step diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp index 03bc22209da69b019b253316f6888e8bb454f2c9..f868f8e28ea2d3578e7c8b92e9b51efb1cb2e9d0 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp @@ -218,6 +218,9 @@ void CsoneControllerTab::on_perform_step_button_clicked() // Set the flag that a step should be performed m_shouldPerformStep = true; + // Set the flag that the zoom levels should be reset + m_shouldResetZoom = true; + // Set the time back to be less than zero m_time_for_step = -1.0; @@ -283,6 +286,9 @@ void CsoneControllerTab::on_log_data_button_clicked() // Set the flag that a step should be performed m_shouldPerformStep = false; + // Set the flag that the zoom levels should be reset + m_shouldResetZoom = true; + // Set the time back to zero m_time_for_step = 0.0; @@ -544,7 +550,7 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc static float max_x_value_plotted = 0.01; static float min_pitch_value_plotted = -0.01; static float max_pitch_value_plotted = 0.01; - static float next_rezoom_at_time = 2.00; + static float next_rezoom_at_time = 0.50; // Initialise a bool for whether the step response should be analsysed bool shouldAnalyseStepResponse = false; @@ -552,6 +558,18 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc // Lock the mutex m_chart_mutex.lock(); + // Reset the min, max, and rezoom time if requested + if (m_shouldResetZoom) + { + min_x_value_plotted = -0.01; + max_x_value_plotted = 0.01; + min_pitch_value_plotted = -0.01; + max_pitch_value_plotted = 0.01; + next_rezoom_at_time = 0.50; + // Set the flag to false + m_shouldResetZoom = false; + } + // Only do something if the flag indicates to do so if (m_shouldStoreData_for_plotting) { @@ -565,17 +583,6 @@ void CsoneControllerTab::newDataForPerformingStepAndPlotting(float x, float pitc //m_lineSeries_for_setpoint_pitch->append(m_time_for_step, ... ); m_lineSeries_for_measured_pitch->append(m_time_for_step, pitch ); - - // Reset the min, max, and rezoom time at the start of performing the step - if (m_time_for_step <= -0.998) - { - min_x_value_plotted = -0.01; - max_x_value_plotted = 0.01; - min_pitch_value_plotted = -0.01; - max_pitch_value_plotted = 0.01; - next_rezoom_at_time = 2.00; - } - // Update the min and max values min_x_value_plotted = std::min( min_x_value_plotted , std::min(temp_x_setpoint,x) ); max_x_value_plotted = std::max( max_x_value_plotted , std::max(temp_x_setpoint,x) );