From dce0dfa1538a489a9439241b610efc4d40689e3f Mon Sep 17 00:00:00 2001 From: Angel <roangel@student.ethz.ch> Date: Tue, 26 Sep 2017 17:43:00 +0200 Subject: [PATCH] fixed small detail --- .../src/d_fall_pps/GUI_Qt/studentGUI/include/MainWindow.h | 2 ++ .../src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 6c39e0b0..1499f42d 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 0680f944..6415e0ef 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; -- GitLab