Skip to content
Snippets Groups Projects
Commit 5ba9ddbf authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Updates to the CS1 GUI

parent 9700c546
No related branches found
No related tags found
No related merge requests found
......@@ -109,11 +109,15 @@ private slots:
void on_lineEdit_k_returnPressed();
void on_lineEdit_T_returnPressed();
void on_lineEdit_alpha_returnPressed();
void on_lineEdit_kp_returnPressed();
void on_lineEdit_kd_returnPressed();
void on_lineEdit_step_size_returnPressed();
void on_lineEdit_step_duration_returnPressed();
void on_set_controller_parameters_button_clicked();
void on_set_lead_compensator_parameters_button_clicked();
void on_perform_step_button_clicked();
void on_log_data_button_clicked();
......
......@@ -179,9 +179,41 @@ void CsoneControllerTab::on_perform_step_button_clicked()
// Set the flag that a step should be performed
m_shouldPerformStep = true;
// Set the time back to zero
// Set the time back to be less than zero
m_time_for_step = -1.0;
// Set the minimum of the x-axis to agree with this
ui->chartView_for_x->chart()->axisX()->setMin(m_time_for_step);
// Update the duration from the field
if(!ui->lineEdit_step_duration->text().isEmpty())
{
float temp_duration = (ui->lineEdit_step_duration->text()).toFloat();
// Ensure that it is in the range [2,60]
if (temp_duration < 2.0)
{
temp_duration = 2.0;
ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
}
else if (temp_duration > 60.0)
{
temp_duration = 60.0;
ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
}
// Update the global variable
m_step_response_data_recording_duration = temp_duration;
}
else
{
// Default the duration to 10
m_step_response_data_recording_duration = 10.0;
ui->lineEdit_step_duration->setText(QString::number( m_step_response_data_recording_duration, 'f', 0));
}
// Set the minimum of the x-axis to agree with the duration
ui->chartView_for_x->chart()->axisX()->setMax(m_step_response_data_recording_duration);
// Clear any data from the line series
m_lineSeries_for_setpoint_x->removePoints(0,m_lineSeries_for_setpoint_x->count());
m_lineSeries_for_measured_x->removePoints(0,m_lineSeries_for_measured_x->count());
......@@ -198,8 +230,66 @@ void CsoneControllerTab::on_perform_step_button_clicked()
#endif
}
void CsoneControllerTab::on_log_data_button_clicked()
{
// Lock the mutex
m_chart_mutex.lock();
// Set the flag that a step should be performed
m_shouldPerformStep = false;
void CsoneControllerTab::on_set_controller_parameters_button_clicked()
// Set the time back to zero
m_time_for_step = 0.0;
// Set the minimum of the x-axis to agree with this
ui->chartView_for_x->chart()->axisX()->setMin(m_time_for_step);
// Update the duration from the field
if(!ui->lineEdit_step_duration->text().isEmpty())
{
float temp_duration = (ui->lineEdit_step_duration->text()).toFloat();
// Ensure that it is in the range [2,60]
if (temp_duration < 2.0)
{
temp_duration = 2.0;
ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
}
else if (temp_duration > 60.0)
{
temp_duration = 60.0;
ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
}
// Update the global variable
m_step_response_data_recording_duration = temp_duration;
}
else
{
// Default the duration to 10
m_step_response_data_recording_duration = 10.0;
ui->lineEdit_step_duration->setText(QString::number( m_step_response_data_recording_duration, 'f', 0));
}
// Set the minimum of the x-axis to agree with the duration
ui->chartView_for_x->chart()->axisX()->setMax(m_step_response_data_recording_duration);
// Clear any data from the line series
m_lineSeries_for_setpoint_x->removePoints(0,m_lineSeries_for_setpoint_x->count());
m_lineSeries_for_measured_x->removePoints(0,m_lineSeries_for_measured_x->count());
// Set the flag that should store data
m_shouldStoreData_for_plotting = true;
// Unlock the mutex
m_chart_mutex.unlock();
// Inform the user about the change
#ifdef CATKIN_MAKE
ROS_INFO_STREAM("[CSONE CONTROLLER TAB GUI] Perform step started");
#endif
}
void CsoneControllerTab::on_set_lead_compensator_parameters_button_clicked()
{
// Initialise local variable for each of (x,y,z,yaw)
float k = 1.0f, T = 1.0f, alpha = 1.0f;
......@@ -305,22 +395,37 @@ void CsoneControllerTab::publishControllerParamters(float k, float T, float alph
void CsoneControllerTab::on_lineEdit_k_returnPressed()
{
ui->set_controller_parameters_button->animateClick();
ui->set_lead_compensator_parameters_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_T_returnPressed()
{
ui->set_controller_parameters_button->animateClick();
ui->set_lead_compensator_parameters_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_alpha_returnPressed()
{
ui->set_controller_parameters_button->animateClick();
ui->set_lead_compensator_parameters_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_kp_returnPressed()
{
ui->set_pd_controller_parameters_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_kd_returnPressed()
{
ui->set_pd_controller_parameters_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_step_size_returnPressed()
{
ui->set_controller_parameters_button->animateClick();
ui->perform_step_button->animateClick();
}
void CsoneControllerTab::on_lineEdit_step_duration_returnPressed()
{
ui->log_data_button->animateClick();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment