From 50a9eff3b14cbc4a9a42495fd724f846e642663f Mon Sep 17 00:00:00 2001
From: Paul Beuchat <beuchatp@control.ee.ethz.ch>
Date: Sun, 3 Feb 2019 11:51:38 +0100
Subject: [PATCH] Fixed a few connections so that the picker GUI works with
 ROS. Still need to integrate with the PickerControllerService

---
 .../flyingAgentGUI/forms/controllertabs.ui    |  2 +-
 .../forms/enablecontrollerloadyamlbar.ui      |  8 ++--
 .../forms/pickercontrollertab.ui              | 40 +++++++++----------
 .../include/enablecontrollerloadyamlbar.h     | 16 ++++----
 .../flyingAgentGUI/src/controllertabs.cpp     | 21 ++++++++++
 .../src/enablecontrollerloadyamlbar.cpp       | 16 ++++----
 6 files changed, 62 insertions(+), 41 deletions(-)

diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui
index b4718911..928aa115 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui
@@ -59,7 +59,7 @@
       </attribute>
       <layout class="QGridLayout" name="gridLayout_5">
        <item row="0" column="0">
-        <widget class="PickerControllerTab" name="widget_4" native="true"/>
+        <widget class="PickerControllerTab" name="picker_controller_tab_widget" native="true"/>
        </item>
       </layout>
      </widget>
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 0537109e..4201e18d 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
@@ -267,7 +267,7 @@
       </widget>
      </item>
      <item row="0" column="3">
-      <widget class="QPushButton" name="enable_demo_button">
+      <widget class="QPushButton" name="enable_picker_button">
        <property name="sizePolicy">
         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
          <horstretch>0</horstretch>
@@ -293,12 +293,12 @@
         </font>
        </property>
        <property name="text">
-        <string>Demo</string>
+        <string>Picker</string>
        </property>
       </widget>
      </item>
      <item row="1" column="3">
-      <widget class="QPushButton" name="load_yaml_demo_button">
+      <widget class="QPushButton" name="load_yaml_picker_button">
        <property name="sizePolicy">
         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
          <horstretch>0</horstretch>
@@ -318,7 +318,7 @@
         </size>
        </property>
        <property name="text">
-        <string>Demo</string>
+        <string>Picker</string>
        </property>
       </widget>
      </item>
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/pickercontrollertab.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/pickercontrollertab.ui
index ad7dea1b..232408bd 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/pickercontrollertab.ui
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/pickercontrollertab.ui
@@ -120,12 +120,12 @@
           <widget class="QCheckBox" name="checkbox_goto_end">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1027,12 +1027,12 @@
           <widget class="QCheckBox" name="checkbox_attach">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1832,12 +1832,12 @@
           <widget class="QCheckBox" name="checkbox_goto_start">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1852,12 +1852,12 @@
           <widget class="QCheckBox" name="checkbox_jump">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1879,12 +1879,12 @@
           <widget class="QCheckBox" name="checkbox_put_down">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1899,12 +1899,12 @@
           <widget class="QCheckBox" name="checkbox_lift_up">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1922,12 +1922,12 @@
            </property>
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -1948,12 +1948,12 @@
           <widget class="QCheckBox" name="checkbox_squat">
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -2254,12 +2254,12 @@
            </property>
            <property name="maximumSize">
             <size>
-             <width>40</width>
+             <width>30</width>
              <height>16777215</height>
             </size>
            </property>
            <property name="styleSheet">
-            <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+            <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
            </property>
            <property name="text">
             <string/>
@@ -2702,12 +2702,12 @@
         <widget class="QCheckBox" name="checkbox_should_publish_value_changed">
          <property name="maximumSize">
           <size>
-           <width>40</width>
+           <width>30</width>
            <height>16777215</height>
           </size>
          </property>
          <property name="styleSheet">
-          <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string>
+          <string notr="true">QCheckBox::indicator{ width:30px ; height:30px }</string>
          </property>
          <property name="text">
           <string/>
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h
index a5776823..53139bfe 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h
@@ -40,12 +40,12 @@
 // operation state of this agent. These "commands"
 // are sent from this GUI node to the "PPSClient"
 // node where the command is enacted
-#define CMD_USE_SAFE_CONTROLLER      1
-#define CMD_USE_DEMO_CONTROLLER      2
-#define CMD_USE_STUDENT_CONTROLLER   3
-#define CMD_USE_MPC_CONTROLLER       4
-#define CMD_USE_REMOTE_CONTROLLER    5
-#define CMD_USE_TUNING_CONTROLLER    6
+// #define CMD_USE_SAFE_CONTROLLER      1
+// #define CMD_USE_DEMO_CONTROLLER      2
+// #define CMD_USE_STUDENT_CONTROLLER   3
+// #define CMD_USE_MPC_CONTROLLER       4
+// #define CMD_USE_REMOTE_CONTROLLER    5
+// #define CMD_USE_TUNING_CONTROLLER    6
 
 
 namespace Ui {
@@ -75,13 +75,13 @@ private slots:
 
     // ENABLE CONTROLLER BUTTONS ON-CLICK CALLBACK
     void on_enable_safe_button_clicked();
-    void on_enable_demo_button_clicked();
+    void on_enable_picker_button_clicked();
     void on_enable_student_button_clicked();
     void on_enable_default_button_clicked();
 
     // LOAD YAML BUTTONS ON-CLICK CALLBACK
     void on_load_yaml_safe_button_clicked();
-    void on_load_yaml_demo_button_clicked();
+    void on_load_yaml_picker_button_clicked();
     void on_load_yaml_student_button_clicked();
     void on_load_yaml_default_button_clicked();
 
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
index 88a4973c..7f58a1c9 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp
@@ -31,6 +31,12 @@ ControllerTabs::ControllerTabs(QWidget *parent) :
             ui->student_controller_tab_widget , &StudentControllerTab::setMeasuredPose
         );
 
+    QObject::connect(
+            this , &ControllerTabs::measuredPoseValueChanged ,
+            ui->picker_controller_tab_widget , &PickerControllerTab::setMeasuredPose
+        );
+
+
 
     // CONNECT THE "MEASUREMENTS UNAVAILABLE" SIGNAL TO
     // EACH OF THE TABS
@@ -44,6 +50,11 @@ ControllerTabs::ControllerTabs(QWidget *parent) :
             ui->student_controller_tab_widget , &StudentControllerTab::poseDataUnavailableSlot
         );
 
+    QObject::connect(
+            this , &ControllerTabs::poseDataUnavailableSignal ,
+            ui->picker_controller_tab_widget , &PickerControllerTab::poseDataUnavailableSlot
+        );
+
 
     // CONNECT TO THE COORDINATOR SIGNAL TO BE ALWAYS UPDATED
     // WITH THE LIST OF AGENT IDs TO COORDINATE
@@ -60,6 +71,11 @@ ControllerTabs::ControllerTabs(QWidget *parent) :
             ui->student_controller_tab_widget , &StudentControllerTab::setAgentIDsToCoordinate
         );
 
+    QObject::connect(
+            this , &ControllerTabs::agentIDsToCoordinateChanged ,
+            ui->picker_controller_tab_widget , &PickerControllerTab::setAgentIDsToCoordinate
+        );
+
     
 
 
@@ -289,6 +305,11 @@ void ControllerTabs::setControllerEnabled(int new_controller)
             //ui->controller_enabled_label->setText("Tuning");
             break;
         }
+        case PICKER_CONTROLLER:
+        {
+            setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->picker_tab );
+            break;
+        }
         default:
         {
             //ui->controller_enabled_label->setText("Unknown");
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/enablecontrollerloadyamlbar.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/enablecontrollerloadyamlbar.cpp
index 5458bcce..ca509b8f 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/enablecontrollerloadyamlbar.cpp
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/enablecontrollerloadyamlbar.cpp
@@ -61,8 +61,8 @@ void EnableControllerLoadYamlBar::showHideController_student_changed()
 
 void EnableControllerLoadYamlBar::showHideController_picker_changed()
 {
-    ui->enable_demo_button   ->setHidden(    !(ui->enable_demo_button->isHidden()) );
-    ui->load_yaml_demo_button->setHidden( !(ui->load_yaml_demo_button->isHidden()) );
+    ui->enable_picker_button   ->setHidden(    !(ui->enable_picker_button->isHidden()) );
+    ui->load_yaml_picker_button->setHidden( !(ui->load_yaml_picker_button->isHidden()) );
 }
 
 void EnableControllerLoadYamlBar::showHideController_safe_changed()
@@ -89,14 +89,14 @@ void EnableControllerLoadYamlBar::on_enable_safe_button_clicked()
 #endif
 }
 
-void EnableControllerLoadYamlBar::on_enable_demo_button_clicked()
+void EnableControllerLoadYamlBar::on_enable_picker_button_clicked()
 {
 #ifdef CATKIN_MAKE
     d_fall_pps::IntWithHeader msg;
     fillIntMessageHeader(msg);
-    msg.data = CMD_USE_DEMO_CONTROLLER;
+    msg.data = CMD_USE_PICKER_CONTROLLER;
     this->commandPublisher.publish(msg);
-    ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Demo Controller");
+    ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Picker Controller");
 #endif
 }
 
@@ -132,7 +132,7 @@ void EnableControllerLoadYamlBar::on_load_yaml_safe_button_clicked()
 #endif
 }
 
-void EnableControllerLoadYamlBar::on_load_yaml_demo_button_clicked()
+void EnableControllerLoadYamlBar::on_load_yaml_picker_button_clicked()
 {
 #ifdef CATKIN_MAKE
     // Create a local variable for the message
@@ -140,11 +140,11 @@ void EnableControllerLoadYamlBar::on_load_yaml_demo_button_clicked()
     // Set for whom this applies to
     fillStringMessageHeader(yaml_filename_msg);
     // Specify the data
-    yaml_filename_msg.data = "DemoController";
+    yaml_filename_msg.data = "PickerController";
     // Send the message
     m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
     // Inform the user that the menu item was selected
-    ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Demo Controller YAML was clicked.");
+    ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Picker Controller YAML was clicked.");
 #endif
 }
 
-- 
GitLab