diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/include/MainWindow.h b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/include/MainWindow.h index 6c39e0b0dd1d9b19d5c0f6a571699a51aa9713c5..1499f42db6c05da740334846d256c9389824f731 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/include/MainWindow.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/include/MainWindow.h @@ -103,6 +103,8 @@ private: Setpoint m_safe_setpoint; Setpoint m_custom_setpoint; + int m_battery_state; + ros::Publisher crazyRadioCommandPublisher; ros::Subscriber crazyRadioStatusSubscriber; ros::Publisher PPSClientCommandPublisher; diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp index 0680f944346f918faffb8b7c83d802d0a75c8e8e..6415e0eff2b082d2fad29c50c57a73217577e3e8 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp +++ b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp @@ -92,6 +92,7 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) : disableGUI(); highlightSafeControllerTab(); ui->label_battery->setStyleSheet("QLabel { color : red; }"); + m_battery_state = BATTERY_STATE_NORMAL; } @@ -109,7 +110,10 @@ void MainWindow::disableGUI() void MainWindow::enableGUI() { // ui->groupBox_general->setEnabled(true); - ui->groupBox_4->setEnabled(true); + if(m_battery_state == BATTERY_STATE_NORMAL) + { + ui->groupBox_4->setEnabled(true); + } } void MainWindow::highlightSafeControllerTab() @@ -197,10 +201,12 @@ void MainWindow::batteryStateChangedCallback(const std_msgs::Int32& msg) qstr.append("Low Battery!"); ui->groupBox_4->setEnabled(false); ui->label_battery->setText(qstr); + m_battery_state = BATTERY_STATE_LOW; break; case BATTERY_STATE_NORMAL: ui->groupBox_4->setEnabled(true); ui->label_battery->clear(); + m_battery_state = BATTERY_STATE_NORMAL; break; default: break;