diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinator.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinator.ui index 13377061ad3943ba1e1a7d30aa819b11c0940384..855f9cecc650c5587bd7b3fb484c96ad006f294a 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinator.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinator.ui @@ -21,6 +21,12 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QLabel" name="coordintor_title_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="font"> <font> <weight>75</weight> @@ -37,6 +43,12 @@ </item> <item> <widget class="QLabel" name="coordinator_id_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="font"> <font> <weight>75</weight> @@ -58,10 +70,17 @@ </property> </widget> </item> + <item> + <widget class="QPushButton" name="toggle_details_button"> + <property name="text"> + <string>Toggle Details</string> + </property> + </widget> + </item> <item> <widget class="QPushButton" name="delete_button"> <property name="text"> - <string>Delete</string> + <string>Remove All</string> </property> </widget> </item> @@ -85,6 +104,12 @@ </item> <item> <widget class="QScrollArea" name="coordinated_agents_scrollArea"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="widgetResizable"> <bool>true</bool> </property> @@ -93,8 +118,8 @@ <rect> <x>0</x> <y>0</y> - <width>583</width> - <height>854</height> + <width>565</width> + <height>622</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_for_coordinatedAgentsScrollArea"/> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui index 790ff9ce5c842373671285685f48c3b592cdb034..06003ef3968d18a8ac3fd736d1c772483e489187 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui @@ -55,14 +55,14 @@ <item> <widget class="QCheckBox" name="shouldCoordinate_checkBox"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>180</width> + <width>50</width> <height>35</height> </size> </property> @@ -323,20 +323,20 @@ <item> <widget class="QLabel" name="controller_enabled_label"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>70</width> + <width>50</width> <height>35</height> </size> </property> <property name="maximumSize"> <size> - <width>70</width> + <width>180</width> <height>35</height> </size> </property> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui index 9304b2ad9c78438d2b92a9032e1fa6d67af9aa7d..80d40b200a37aa380a48a97c367e3b3c25d12eb4 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>595</width> - <height>561</height> + <width>1572</width> + <height>403</height> </rect> </property> <property name="sizePolicy"> @@ -26,43 +26,18 @@ </property> <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> - <layout class="QGridLayout" name="gridLayout"> - <item row="7" column="1"> - <widget class="QPushButton" name="load_yaml_safe_button"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>40</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>180</width> - <height>40</height> - </size> - </property> - <property name="text"> - <string>Safe</string> - </property> - </widget> - </item> - <item row="7" column="0"> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="4"> <widget class="QPushButton" name="enable_safe_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>40</height> </size> </property> @@ -84,16 +59,16 @@ </widget> </item> <item row="0" column="0"> - <widget class="QLabel" name="enable_controller_top_label"> + <widget class="QLabel" name="enable_controller_label"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>20</height> </size> </property> @@ -118,75 +93,81 @@ </widget> </item> <item row="0" column="1"> - <widget class="QLabel" name="load_yaml_top_label"> + <widget class="QPushButton" name="enable_default_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> - <height>20</height> + <width>60</width> + <height>40</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>20</height> + <height>40</height> </size> </property> <property name="font"> <font> - <weight>75</weight> - <bold>true</bold> + <weight>50</weight> + <bold>false</bold> </font> </property> <property name="text"> - <string>Load</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <string>Default</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QPushButton" name="load_yaml_demo_button"> + <item row="1" column="0"> + <widget class="QLabel" name="load_yaml_label"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> - <height>40</height> + <width>60</width> + <height>20</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>20</height> </size> </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> <property name="text"> - <string>Demo</string> + <string>Load YAML</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="4" column="0"> - <widget class="QPushButton" name="enable_demo_button"> + <item row="1" column="4"> + <widget class="QPushButton" name="load_yaml_safe_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>40</height> </size> </property> @@ -196,109 +177,72 @@ <height>40</height> </size> </property> - <property name="font"> - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> <property name="text"> - <string>Demo</string> + <string>Safe</string> </property> </widget> </item> - <item row="8" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="enable_controller_bot_label"> + <item row="1" column="1"> + <widget class="QPushButton" name="load_yaml_default_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> - <height>20</height> + <width>60</width> + <height>40</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>20</height> + <height>40</height> </size> </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> <property name="text"> - <string>Controller</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <string>Default</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLabel" name="load_yaml_bot_label"> + <item row="1" column="2"> + <widget class="QPushButton" name="load_yaml_student_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> - <height>20</height> + <width>60</width> + <height>40</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>20</height> + <height>40</height> </size> </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> <property name="text"> - <string>YAML</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <string>Student</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QPushButton" name="enable_default_button"> + <item row="0" column="2"> + <widget class="QPushButton" name="enable_student_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>40</height> </size> </property> @@ -315,46 +259,21 @@ </font> </property> <property name="text"> - <string>Default</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="load_yaml_default_button"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>40</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>180</width> - <height>40</height> - </size> - </property> - <property name="text"> - <string>Default</string> + <string>Student</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QPushButton" name="enable_student_button"> + <item row="0" column="3"> + <widget class="QPushButton" name="enable_demo_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>40</height> </size> </property> @@ -371,21 +290,21 @@ </font> </property> <property name="text"> - <string>Student</string> + <string>Demo</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QPushButton" name="load_yaml_student_button"> + <item row="1" column="3"> + <widget class="QPushButton" name="load_yaml_demo_button"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>120</width> + <width>60</width> <height>40</height> </size> </property> @@ -396,10 +315,23 @@ </size> </property> <property name="text"> - <string>Student</string> + <string>Demo</string> </property> </widget> </item> + <item row="0" column="5"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </item> </layout> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui index e35441f92db33a3865d14725acfbb30bccff8c8d..a30186338b9f7bbc2662b49126ad166e42ee7bbb 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui @@ -34,15 +34,21 @@ </property> <item> <widget class="Coordinator" name="customWidget_coordinator" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimumSize"> <size> - <width>400</width> + <width>300</width> <height>0</height> </size> </property> <property name="maximumSize"> <size> - <width>680</width> + <width>800</width> <height>16777215</height> </size> </property> @@ -70,7 +76,7 @@ <property name="maximumSize"> <size> <width>16777215</width> - <height>120</height> + <height>100</height> </size> </property> </widget> @@ -80,7 +86,32 @@ <property name="maximumSize"> <size> <width>16777215</width> - <height>120</height> + <height>80</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="EnableControllerLoadYamlBar" name="customWidget_enableControllerLoadYamlBar" native="true"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>100</height> </size> </property> </widget> @@ -112,31 +143,6 @@ </property> </widget> </item> - <item> - <widget class="EnableControllerLoadYamlBar" name="customWidget_enableControllerLoadYamlBar" native="true"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>500</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> </layout> </item> </layout> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/topbanner.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/topbanner.ui index 486f7235de0c57b4f08176daa3d7428627a2f2d1..0198a2db92cbb897fe7ba77a131b0a2dc72967c4 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/topbanner.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/topbanner.ui @@ -43,7 +43,7 @@ <property name="maximumSize"> <size> <width>16777215</width> - <height>120</height> + <height>100</height> </size> </property> <property name="text"> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinator.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinator.h index 82f3faf87a11a2281c42be76d854556513d6165b..27c6501b78650a577c7cf4b597e9851374ee907a 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinator.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinator.h @@ -22,11 +22,17 @@ public: private: QVector<CoordinatorRow*> vector_of_coordinatorRows; + int level_of_detail_to_display = 1; + void remove_all_entries_from_vector_of_coordinatorRows(); + void apply_level_of_detail_to_all_entries(int level); + private slots: void on_refresh_button_clicked(); + void on_toggle_details_button_clicked(); + void on_delete_button_clicked(); void on_coordinate_all_checkBox_clicked(); diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h index 75410c452c402d2f696fa852d20e408e48a01396..6fa61806d1b32c0c6e78a750d2e17d1ea4e09725 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h @@ -126,6 +126,8 @@ public: // PUBLIC METHODS FOR SETTING PROPERTIES // > Set the state of the checkbox void setShouldCoordinate(bool shouldCoordinate); + // > Set the level of detail to display + void setLevelOfDetailToDisplay(int level); private: // --------------------------------------------------- // @@ -133,9 +135,11 @@ private: Ui::CoordinatorRow *ui; // > For the ID of which agent this "coordinator row" relates to - int my_agentID; + int m_agentID; // > For using the agent ID in constructing namespaces - QString my_agentID_as_string; + QString m_agentID_as_string; + // > For the name of the allocated Crazyflie + QString m_crazyflie_name_as_string; // > For keeping track of the current RF Crazyradio state int my_radio_status; diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinator.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinator.cpp index 2a89aaa96d0953f0c308dbf54c70abc570c793fd..be2efe6665b1486ed99c132e98315801cbd19d8b 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinator.cpp +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinator.cpp @@ -94,10 +94,41 @@ void Coordinator::on_refresh_button_clicked() vector_of_coordinatorRows.append(temp_coordinatorRow); ui->coordinated_agents_scrollAreaWidgetContents->layout()->addWidget(temp_coordinatorRow); + + // Call the function that applies this level + // of detail to all the entries + apply_level_of_detail_to_all_entries(level_of_detail_to_display); } #endif } + +void Coordinator::on_toggle_details_button_clicked() +{ + // Toggle the level of detail to display + switch (level_of_detail_to_display) + { + case 0: + { + level_of_detail_to_display = 1; + break; + } + case 1: + { + level_of_detail_to_display = 0; + break; + } + default: + { + level_of_detail_to_display = 0; + break; + } + } + // Call the function that applies this level + // of detail to all the entries + apply_level_of_detail_to_all_entries(level_of_detail_to_display); +} + void Coordinator::on_delete_button_clicked() { // Call the function that performs the task requested @@ -114,6 +145,15 @@ void Coordinator::remove_all_entries_from_vector_of_coordinatorRows() vector_of_coordinatorRows.clear(); } +void Coordinator::apply_level_of_detail_to_all_entries(int level) +{ + // Apply this to all the rows + for ( int irow = 0 ; irow < vector_of_coordinatorRows.length() ; irow++ ) + { + vector_of_coordinatorRows[irow]->setLevelOfDetailToDisplay( level ); + } +} + void Coordinator::on_coordinate_all_checkBox_clicked() { // Get the state of the "coordinate all" is check box diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinatorrow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinatorrow.cpp index 68c7e58cbd3d78604edfa6ad6734145674da2a30..bffcaafee7e5527fa5ff193b22c0f506a2c31d10 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinatorrow.cpp +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinatorrow.cpp @@ -36,27 +36,27 @@ CoordinatorRow::CoordinatorRow(QWidget *parent, int agentID) : QWidget(parent), ui(new Ui::CoordinatorRow), - my_agentID(agentID) + m_agentID(agentID) { ui->setupUi(this); // CONVERT THE AGENT ID TO A ZERO PADDED STRING // > This is the c++ method: //std::ostringstream str_stream; - //str_stream << std::setw(3) << std::setfill('0') << my_agentID; + //str_stream << std::setw(3) << std::setfill('0') << m_agentID; //std::string agentID_as_string(str_stream.str()); // > This is the Qt method - //my_agentID_as_string = QString("%1").arg(my_agentID, 3, 10, QChar('0')); + //m_agentID_as_string = QString("%1").arg(m_agentID, 3, 10, QChar('0')); // For which the syntax is: // - Arg1: the number // - Arg2: how many 0 you want? // - Arg3: The base (10 - decimal, 16 hexadecimal) // > Alternate Qt method: - my_agentID_as_string = QString::number(my_agentID).rightJustified(3, '0'); + m_agentID_as_string = QString::number(m_agentID).rightJustified(3, '0'); // CONVERT THE AGENT ID TO A STRING FOR THE BASE NAMESPACE QString qstr_ros_base_namespace = "/dfall/agent"; - qstr_ros_base_namespace.append(my_agentID_as_string); + qstr_ros_base_namespace.append(m_agentID_as_string); std::string ros_base_namespace = qstr_ros_base_namespace.toStdString(); // SET THE INITIAL VALUE OF THE PRIVATE VARIABLES FOR THIS CLASS @@ -103,7 +103,7 @@ CoordinatorRow::CoordinatorRow(QWidget *parent, int agentID) : // LET THE USER KNOW WHAT THE BASE NAMESPACE IS - ROS_INFO_STREAM("[Coordinator Row GUI] using base namespace: " << ros_base_namespace.c_str() << ", for agentID = " << my_agentID); + ROS_INFO_STREAM("[Coordinator Row GUI] using base namespace: " << ros_base_namespace.c_str() << ", for agentID = " << m_agentID); // DEBUGGING FOR NAMESPACES //std::string temp_ros_namespace = ros::this_node::getNamespace(); @@ -141,7 +141,7 @@ CoordinatorRow::CoordinatorRow(QWidget *parent, int agentID) : loadCrazyflieContext(); // FOR DEBUGGING: - //ui->shouldCoordinate_checkBox->setText(my_agentID_as_string); + //ui->shouldCoordinate_checkBox->setText(m_agentID_as_string); //ui->shouldCoordinate_checkBox->setText(QString::fromStdString(base_namespace)); } @@ -160,6 +160,68 @@ void CoordinatorRow::setShouldCoordinate(bool shouldCoordinate) ui->shouldCoordinate_checkBox->setChecked( shouldCoordinate ); } +void CoordinatorRow::setLevelOfDetailToDisplay(int level) +{ + switch (level) + { + case 0: + { + ui->motors_off_button->setVisible(true); + ui->enable_flying_button->setVisible(true); + ui->disable_flying_button->setVisible(true); + + ui->battery_voltage_lineEdit->setVisible(true); + + ui->rf_connect_button->setVisible(true); + ui->rf_disconnect_button->setVisible(true); + + QString qstr_for_checkbox_label = "ID"; + qstr_for_checkbox_label.append(QString::number(m_agentID)); + qstr_for_checkbox_label.append(", "); + qstr_for_checkbox_label.append(m_crazyflie_name_as_string); + ui->shouldCoordinate_checkBox->setText(qstr_for_checkbox_label); + break; + } + case 1: + { + ui->motors_off_button->setVisible(false); + ui->enable_flying_button->setVisible(false); + ui->disable_flying_button->setVisible(false); + + ui->battery_voltage_lineEdit->setVisible(false); + + ui->rf_connect_button->setVisible(false); + ui->rf_disconnect_button->setVisible(false); + + QString qstr_for_checkbox_label = "ID"; + qstr_for_checkbox_label.append(QString::number(m_agentID)); + ui->shouldCoordinate_checkBox->setText(qstr_for_checkbox_label); + + + break; + } + default: + { + ui->motors_off_button->setVisible(true); + ui->enable_flying_button->setVisible(true); + ui->disable_flying_button->setVisible(true); + + ui->battery_voltage_lineEdit->setVisible(true); + + ui->rf_connect_button->setVisible(true); + ui->rf_disconnect_button->setVisible(true); + + QString qstr_for_checkbox_label = "ID"; + qstr_for_checkbox_label.append(QString::number(m_agentID)); + qstr_for_checkbox_label.append(", "); + qstr_for_checkbox_label.append(m_crazyflie_name_as_string); + ui->shouldCoordinate_checkBox->setText(qstr_for_checkbox_label); + break; + } + } +} + + // > For making the "enable flight" and "disable flight" buttons unavailable void CoordinatorRow::disableFlyingStateButtons() { @@ -186,7 +248,7 @@ void CoordinatorRow::enableFlyingStateButtons() // > For the Battery Voltage void CoordinatorRow::crazyRadioStatusCallback(const std_msgs::Int32& msg) { - //ROS_INFO_STEAM("[Coordinator Row GUI] Crazy Radio Status Callback called for agentID = " << my_agentID); + //ROS_INFO_STEAM("[Coordinator Row GUI] Crazy Radio Status Callback called for agentID = " << m_agentID); setCrazyRadioStatus( msg.data ); } #endif @@ -289,7 +351,7 @@ void CoordinatorRow::batteryVoltageCallback(const std_msgs::Float32& msg) void CoordinatorRow::batteryStateChangedCallback(const std_msgs::Int32& msg) { - //ROS_INFO_STEAM("[Coordinator Row GUI] Battery State Changed Callback called for agentID = " << my_agentID); + //ROS_INFO_STEAM("[Coordinator Row GUI] Battery State Changed Callback called for agentID = " << m_agentID); setBatteryState( msg.data ); } #endif @@ -516,7 +578,7 @@ float CoordinatorRow::fromVoltageToPercent(float voltage) #ifdef CATKIN_MAKE void CoordinatorRow::flyingStateChangedCallback(const std_msgs::Int32& msg) { - //ROS_INFO_STEAM("[Coordinator Row GUI] Flying State Changed Callback called for agentID = " << my_agentID); + //ROS_INFO_STEAM("[Coordinator Row GUI] Flying State Changed Callback called for agentID = " << m_agentID); setFlyingState(msg.data); } #endif @@ -585,7 +647,7 @@ void CoordinatorRow::setFlyingState(int new_flying_state) // > For the notification that the database was changes, received on the "DatabaseChangedSubscriber" void CoordinatorRow::databaseChangedCallback(const std_msgs::Int32& msg) { - //ROS_INFO_STEAM("[Coordinator Row GUI] Database Changed Callback called for agentID = " << my_agentID); + //ROS_INFO_STEAM("[Coordinator Row GUI] Database Changed Callback called for agentID = " << m_agentID); loadCrazyflieContext(); } #endif @@ -596,8 +658,8 @@ void CoordinatorRow::loadCrazyflieContext() QString qstr_crazyflie_name = ""; #ifdef CATKIN_MAKE CMQuery contextCall; - contextCall.request.studentID = my_agentID; - //ROS_INFO_STREAM("StudentID:" << my_agentID); + contextCall.request.studentID = m_agentID; + //ROS_INFO_STREAM("StudentID:" << m_agentID); centralManagerDatabaseService.waitForExistence(ros::Duration(-1)); @@ -610,7 +672,7 @@ void CoordinatorRow::loadCrazyflieContext() } else { - ROS_ERROR_STREAM("[Coordinator Row GUI] Failed to load context for agentID = " << my_agentID); + ROS_ERROR_STREAM("[Coordinator Row GUI] Failed to load context for agentID = " << m_agentID); } // This updating of the radio only needs to be done by the actual agent's node //ros::NodeHandle nh("CrazyRadio"); @@ -622,11 +684,13 @@ void CoordinatorRow::loadCrazyflieContext() // Construct and set the string for the checkbox label QString qstr_for_checkbox_label = "ID"; - qstr_for_checkbox_label.append(QString::number(my_agentID)); - qstr_for_checkbox_label.append(", CF"); + qstr_for_checkbox_label.append(QString::number(m_agentID)); + qstr_for_checkbox_label.append(", "); qstr_for_checkbox_label.append(qstr_crazyflie_name); ui->shouldCoordinate_checkBox->setText(qstr_for_checkbox_label); + // Set the name of the Crazyflie to the class variable + m_crazyflie_name_as_string = qstr_crazyflie_name; } @@ -634,7 +698,7 @@ void CoordinatorRow::loadCrazyflieContext() // > For the controller currently operating, received on "controllerUsedSubscriber" void CoordinatorRow::controllerUsedChangedCallback(const std_msgs::Int32& msg) { - //ROS_INFO_STEAM("[Coordinator Row GUI] Controller Used Changed Callback called for agentID = " << my_agentID); + //ROS_INFO_STEAM("[Coordinator Row GUI] Controller Used Changed Callback called for agentID = " << m_agentID); setControllerEnabled(msg.data); } #endif