diff --git a/.gitignore b/.gitignore index 52c7ef3528c7aa225ae1e2d12712c10e908eca52..86b1b272b491f6743a1a21680c4aaed917b03b4e 100755 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ pps_ws/devel/ pps_ws/src/d_fall_pps/lib/vicon/ pps_ws/src/d_fall_pps/include/DataStreamClient.h +pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/*.pro.user *.pyc *.orig diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro new file mode 100644 index 0000000000000000000000000000000000000000..0c6a4bb5251e92447543141fb6f0cb3cdf51b7b0 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro @@ -0,0 +1,48 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-04-26T16:04:19 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +#greaterThan(QT_MAJOR_VERSION, 4): QT += svg + +TARGET = flyingAgentGUI +TEMPLATE = app + +INCLUDEPATH += $$PWD/include +CONFIG += c++11 + +SOURCES += src/main.cpp\ + src/mainwindow.cpp \ + src/topbanner.cpp \ + src/connectstartstopbar.cpp \ + src/enablecontrollerloadyamlbar.cpp \ + src/controllertabs.cpp \ + src/safecontrollertab.cpp \ + src/coordinator.cpp \ + src/coordinatorrow.cpp + +HEADERS += include/mainwindow.h \ + include/topbanner.h \ + include/connectstartstopbar.h \ + include/enablecontrollerloadyamlbar.h \ + include/controllertabs.h \ + include/safecontrollertab.h \ + include/coordinator.h \ + include/coordinatorrow.h + +FORMS += forms/mainwindow.ui \ + forms/topbanner.ui \ + forms/connectstartstopbar.ui \ + forms/enablecontrollerloadyamlbar.ui \ + forms/controllertabs.ui \ + forms/safecontrollertab.ui \ + forms/coordinator.ui \ + forms/coordinatorrow.ui + +RESOURCES += \ + flyingagentgui.qrc diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingagentgui.qrc b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingagentgui.qrc new file mode 100644 index 0000000000000000000000000000000000000000..0f6e7d8eebb915c0f0f16522394150bbc2d84ec1 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingagentgui.qrc @@ -0,0 +1,19 @@ +<RCC> + <qresource prefix="/"> + <file>images/battery_20.png</file> + <file>images/battery_40.png</file> + <file>images/battery_60.png</file> + <file>images/battery_80.png</file> + <file>images/battery_empty.png</file> + <file>images/battery_full.png</file> + <file>images/rf_connected.png</file> + <file>images/rf_connecting.png</file> + <file>images/rf_disconnected.png</file> + <file>images/battery_unknown.png</file> + <file>images/flying_state_disabling.png</file> + <file>images/flying_state_enabling.png</file> + <file>images/flying_state_flying.png</file> + <file>images/flying_state_off.png</file> + <file>images/flying_state_unknown.png</file> + </qresource> +</RCC> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/connectstartstopbar.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/connectstartstopbar.ui new file mode 100644 index 0000000000000000000000000000000000000000..c08c3341678b5e68eb2f9d7738f786fb1a9be3c2 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/connectstartstopbar.ui @@ -0,0 +1,286 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ConnectStartStopBar</class> + <widget class="QWidget" name="ConnectStartStopBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1791</width> + <height>300</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QPushButton" name="rf_disconnect_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>750</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string>Disconnect</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="rf_status_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>95</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>95</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="rf_connect_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>750</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string>Connect</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="battery_voltage_lineEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>180</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>70</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>-.-- V</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="battery_status_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>50</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="take_off_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>750</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string>Take off</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="land_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>750</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string>Land</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="flying_state_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>90</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>90</width> + <height>70</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="motors_off_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>70</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>750</width> + <height>70</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Motors OFF</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..3f072f66d0807b9f77cbe9d54a5abf2bd4500a00 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/controllertabs.ui @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ControllerTabs</class> + <widget class="QWidget" name="ControllerTabs"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1150</width> + <height>718</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QTabWidget" name="controller_tabs_widget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="safe_tab"> + <attribute name="title"> + <string>Safe</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="SafeControllerTab" name="widget" native="true"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="demo_tab"> + <attribute name="title"> + <string>Demo</string> + </attribute> + </widget> + <widget class="QWidget" name="student_tab"> + <attribute name="title"> + <string>Student</string> + </attribute> + </widget> + <widget class="QWidget" name="mpc_tab"> + <attribute name="title"> + <string>MPC</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>SafeControllerTab</class> + <extends>QWidget</extends> + <header>safecontrollertab.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..7969a64d19de84b40effb73e6dfe7357500504d4 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinator.ui @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Coordinator</class> + <widget class="QWidget" name="Coordinator"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>603</width> + <height>1050</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="coordintor_title_label"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Coordinator</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="coordinator_id_label"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>ID = </string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="refresh_button"> + <property name="text"> + <string>Refresh</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="delete_button"> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="coordinate_all_checkBox"> + <property name="styleSheet"> + <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string> + </property> + <property name="text"> + <string>Coordinate All</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QScrollArea" name="coordinated_agents_scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="coordinated_agents_scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>571</width> + <height>744</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_for_coordinatedAgentsScrollArea"/> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..0fce7b313c6fcd4dd92feae9e0c9018d4f3a151c --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CoordinatorRow</class> + <widget class="QWidget" name="CoordinatorRow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1567</width> + <height>72</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>15</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="shouldCoordinate_checkBox"> + <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>16777215</width> + <height>40</height> + </size> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QCheckBox::indicator{ width:40px ; height:40px }</string> + </property> + <property name="text"> + <string>XXX</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="rf_disconnect_button"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string>RF-DIS</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="rf_status_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>70</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>70</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="rf_connect_button"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string>RF-CON</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="battery_voltage_lineEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>60</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>160</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>-.-- V</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="battery_status_label"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="enable_flying_button"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string>EN</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="disable_flying_button"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string>DIS</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="flying_state_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>70</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>70</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="motors_off_button"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>OFF</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="controller_enabled_label"> + <property name="text"> + <string>Controller</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..38bee8ad39c58b1ad5550f68edc433e7c5b657ff --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui @@ -0,0 +1,409 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>EnableControllerLoadYamlBar</class> + <widget class="QWidget" name="EnableControllerLoadYamlBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>595</width> + <height>561</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="enable_controller_top_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>16777215</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Enable</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="load_yaml_top_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>16777215</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Load</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPushButton" name="load_yaml_demo_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>Demo</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QPushButton" name="enable_demo_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Demo</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="load_yaml_safe_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>Safe</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="enable_safe_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Safe</string> + </property> + </widget> + </item> + <item row="6" 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"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>16777215</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> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="load_yaml_bot_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>16777215</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> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QPushButton" name="enable_student_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Student</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QPushButton" name="load_yaml_student_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>Student</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QPushButton" name="enable_mpc_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>MPC</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QPushButton" name="load_yaml_mpc_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>160</width> + <height>80</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>220</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>MPC</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..cbad976ebfa34732af756b842abeffc81af01899 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui @@ -0,0 +1,209 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1862</width> + <height>839</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="Coordinator" name="customWidget_coordinator" native="true"> + <property name="minimumSize"> + <size> + <width>900</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1500</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="TopBanner" name="customWidget_topBanner" native="true"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="ConnectStartStopBar" name="customWidget_connectStartStopBar" native="true"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item> + <widget class="ControllerTabs" name="customWidget_controller_tabs" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="EnableControllerLoadYamlBar" name="customWidget_enableControllerLoadYamlBar" native="true"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>500</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1862</width> + <height>37</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionShowHide_Coordinator"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QToolBar" name="mainToolBar"> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QStatusBar" name="statusBar"/> + <action name="actionShowHide_Coordinator"> + <property name="text"> + <string>Hide Coordinator</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>TopBanner</class> + <extends>QWidget</extends> + <header location="global">topbanner.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ConnectStartStopBar</class> + <extends>QWidget</extends> + <header location="global">connectstartstopbar.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>EnableControllerLoadYamlBar</class> + <extends>QWidget</extends> + <header>enablecontrollerloadyamlbar.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>ControllerTabs</class> + <extends>QWidget</extends> + <header>controllertabs.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>Coordinator</class> + <extends>QWidget</extends> + <header>coordinator.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/safecontrollertab.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/safecontrollertab.ui new file mode 100644 index 0000000000000000000000000000000000000000..eecb384b5b36ef592c01a6f29ccef1a20022c7f7 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/safecontrollertab.ui @@ -0,0 +1,281 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SafeControllerTab</class> + <widget class="QWidget" name="SafeControllerTab"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>924</width> + <height>631</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="4" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_yaw"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_measured_yaw"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>yaw [deg]</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_roll"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_measured_pitch"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>pitch [deg]</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Measured</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="7" column="1"> + <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="3" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_z"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_measured_x"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>x [m]</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_pitch"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_measured_y"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>y [m]</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_measured_z"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>z [m]</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_x"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEdit_measured_y"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>250</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_measured_roll"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="text"> + <string>roll [deg]</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <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> + </widget> + <resources/> + <connections/> +</ui> 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 new file mode 100644 index 0000000000000000000000000000000000000000..486f7235de0c57b4f08176daa3d7428627a2f2d1 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/topbanner.ui @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TopBanner</class> + <widget class="QWidget" name="TopBanner"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1049</width> + <height>300</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>20</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="top_banner_label"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="text"> + <string>Flying Agent Graphical User Interface</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_20.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_20.png new file mode 100644 index 0000000000000000000000000000000000000000..cc7ae62ab7c662f7cf3e098e713232d2d6e0ae14 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_20.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_40.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_40.png new file mode 100644 index 0000000000000000000000000000000000000000..cea5ab35b9605910112dd8a7e2eda371c430894b Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_40.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_60.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_60.png new file mode 100644 index 0000000000000000000000000000000000000000..1f75257c3c1f44fc10f318274741942916b47b70 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_60.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_80.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_80.png new file mode 100644 index 0000000000000000000000000000000000000000..8224e7e1e2ed8e251f37f802b14ce4ebd9027f35 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_80.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_empty.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..0bf35549aab7c7c0247cebd69a176d68ea67387c Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_empty.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_full.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_full.png new file mode 100644 index 0000000000000000000000000000000000000000..495383be5e346e624d7a92670fcf9ddb053f99ef Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_full.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_unknown.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..e20348f65a39bac7c0e40a2a4c0b338ef018dc03 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/battery_unknown.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_disabling.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_disabling.png new file mode 100644 index 0000000000000000000000000000000000000000..667c8027f2b902f08f8e81d3120599a5ed151d48 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_disabling.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_enabling.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_enabling.png new file mode 100644 index 0000000000000000000000000000000000000000..ef2dc5bffa6d27edbb6c6ff1171cd77a5af5c20a Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_enabling.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_flying.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_flying.png new file mode 100644 index 0000000000000000000000000000000000000000..b0b51f3d42edbfad9f875c1faa413391c4f21de9 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_flying.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_off.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_off.png new file mode 100644 index 0000000000000000000000000000000000000000..70669664f07c12ef27a41f5b5fb918aff93da688 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_off.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_unknown.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..5c0c7337a103e5726af53def62e37ad22209c972 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/flying_state_unknown.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connected.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connected.png new file mode 100644 index 0000000000000000000000000000000000000000..f9f3580113053f71fe86344e6f34a74e98c17b70 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connected.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connecting.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connecting.png new file mode 100644 index 0000000000000000000000000000000000000000..5f1d4ca1b48496ecf1372e1a0f727058bbc24d95 Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_connecting.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_disconnected.png b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_disconnected.png new file mode 100644 index 0000000000000000000000000000000000000000..0e99e624009059328820b317c908d337caf55ddc Binary files /dev/null and b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/images/rf_disconnected.png differ diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/connectstartstopbar.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/connectstartstopbar.h new file mode 100644 index 0000000000000000000000000000000000000000..285a788cf615b237c87579fb06e546b06e7a0e5d --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/connectstartstopbar.h @@ -0,0 +1,28 @@ +#ifndef CONNECTSTARTSTOPBAR_H +#define CONNECTSTARTSTOPBAR_H + +#include <QWidget> + +//#include <QGraphicsSvgItem> +//#include <QSvgRenderer> + +namespace Ui { +class ConnectStartStopBar; +} + +class ConnectStartStopBar : public QWidget +{ + Q_OBJECT + +public: + explicit ConnectStartStopBar(QWidget *parent = 0); + ~ConnectStartStopBar(); + +private slots: + void on_rf_disconnect_button_clicked(); + +private: + Ui::ConnectStartStopBar *ui; +}; + +#endif // CONNECTSTARTSTOPBAR_H diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/controllertabs.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/controllertabs.h new file mode 100644 index 0000000000000000000000000000000000000000..3ce7749754833f1c8d0bae089553dec71bee9520 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/controllertabs.h @@ -0,0 +1,22 @@ +#ifndef CONTROLLERTABS_H +#define CONTROLLERTABS_H + +#include <QWidget> + +namespace Ui { +class ControllerTabs; +} + +class ControllerTabs : public QWidget +{ + Q_OBJECT + +public: + explicit ControllerTabs(QWidget *parent = 0); + ~ControllerTabs(); + +private: + Ui::ControllerTabs *ui; +}; + +#endif // CONTROLLERTABS_H 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 new file mode 100644 index 0000000000000000000000000000000000000000..11092332bbe7137d4f61890fa59ca084e5dae5f5 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinator.h @@ -0,0 +1,35 @@ +#ifndef COORDINATOR_H +#define COORDINATOR_H + +#include "coordinatorrow.h" + +#include <QWidget> +#include <QVector> + +namespace Ui { +class Coordinator; +} + +class Coordinator : public QWidget +{ + Q_OBJECT + +public: + explicit Coordinator(QWidget *parent = 0); + ~Coordinator(); + +private: + QVector<CoordinatorRow*> vector_of_coordinatorRows; + +private slots: + void on_refresh_button_clicked(); + + void on_delete_button_clicked(); + + void on_coordinate_all_checkBox_clicked(); + +private: + Ui::Coordinator *ui; +}; + +#endif // COORDINATOR_H 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 new file mode 100644 index 0000000000000000000000000000000000000000..85602b0a82ee0c9d1b71494d9605c582c04a4e77 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h @@ -0,0 +1,253 @@ +// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// Coordinator Row GUI heder. +// +// ---------------------------------------------------------------------------------- + + +#ifndef COORDINATORROW_H +#define COORDINATORROW_H + +#include <string> +#include <QWidget> +#include <QMutex> + +#ifdef CATKIN_MAKE +#include <std_msgs/Int32.h> +#include <std_msgs/Float32.h> + +#include <ros/ros.h> +#include <ros/network.h> +#include <ros/package.h> + +#include "d_fall_pps/CrazyflieContext.h" +#include "d_fall_pps/CMQuery.h" +#endif + +// TYPES OF CONTROLLER BEING USED +#define SAFE_CONTROLLER 1 +#define DEMO_CONTROLLER 2 +#define STUDENT_CONTROLLER 3 +#define MPC_CONTROLLER 4 +#define REMOTE_CONTROLLER 5 +#define TUNING_CONTROLLER 6 + +// COMMANDS FOR CRAZYRADIO +#define CMD_RECONNECT 0 +#define CMD_DISCONNECT 1 + +// CRAZYRADIO STATES +#define CONNECTED 0 +#define CONNECTING 1 +#define DISCONNECTED 2 + +// COMMANDS FOR THE FLYING STATE/CONTROLLER USED +// The constants that "command" changes in the +// 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_CRAZYFLY_TAKE_OFF 11 +#define CMD_CRAZYFLY_LAND 12 +#define CMD_CRAZYFLY_MOTORS_OFF 13 + +// FLYING STATES +#define STATE_MOTORS_OFF 1 +#define STATE_TAKE_OFF 2 +#define STATE_FLYING 3 +#define STATE_LAND 4 + +// BATTERY STATES +#define BATTERY_STATE_NORMAL 0 +#define BATTERY_STATE_LOW 1 + +// BATTERY LABEL IMAGE INDEX +#define BATTERY_LABEL_IMAGE_INDEX_EMPTY 0 +#define BATTERY_LABEL_IMAGE_INDEX_20 1 +#define BATTERY_LABEL_IMAGE_INDEX_40 2 +#define BATTERY_LABEL_IMAGE_INDEX_60 3 +#define BATTERY_LABEL_IMAGE_INDEX_80 4 +#define BATTERY_LABEL_IMAGE_INDEX_FULL 5 +#define BATTERY_LABEL_IMAGE_INDEX_UNKNOWN 6 + + +namespace Ui { +class CoordinatorRow; +} + +class CoordinatorRow : public QWidget +{ + Q_OBJECT + +public: + explicit CoordinatorRow(QWidget *parent = 0, int agentID = 0); + ~CoordinatorRow(); + + // PUBLIC METHODS FOR SETTING PROPERTIES + // > Set the state of the checkbox + void setShouldCoordinate(bool shouldCoordinate); + +private: + // --------------------------------------------------- // + // PRIVATE VARIABLES + Ui::CoordinatorRow *ui; + + // > For the ID of which agent this "coordinator row" relates to + int my_agentID; + // > For using the agent ID in constructing namespaces + QString my_agentID_as_string; + + // > For keeping track of the current RF Crazyradio state + int my_radio_status; + // > For keeping track of the current battery state + int my_battery_state; + // > For keeping track of which image is currently displayed + int my_battery_status_label_image_current_index; + // > For keeping track of the current operating state + int my_flying_state; + + // MUTEX FOR HANDLING ACCESS + // > For the "rf_status_label" UI element + QMutex my_rf_status_label_mutex; + // > For the "my_battery_state" variable + QMutex my_battery_state_mutex; + // > For the "battery_voltage_lineEdit" UI element + QMutex my_battery_voltage_lineEdit_mutex; + // > For the "battery_status_label" UI element + QMutex my_battery_status_label_mutex; + // > For the "my_flying_state" variable + QMutex my_flying_state_mutex; + + // BATTERY VOLTAGE LIMITS (THESE SHOULD BE READ IN AS PARAMTERS) + // > When in a "standby" type of state + float battery_voltage_standby_empty; + float battery_voltage_standby_full; + // > When in a "flying" type of state + float battery_voltage_flying_empty; + float battery_voltage_flying_full; + + + // --------------------------------------------------- // + // PRIVATE FUNCTIONS + + // > For updating the RF Radio status shown in the UI element of "rf_status_label" + void setCrazyRadioStatus(int radio_status); + // > For updating the battery state + void setBatteryState(int new_battery_state); + // > For updating the battery voltage shown in the UI elements of "battery_voltage_lineEdit" and "battery_status_label" + void setBatteryVoltageTextAndImage(float battery_voltage); + void setBatteryVoltageText(float battery_voltage); + void setBatteryVoltageImage(float battery_voltage); + // > For converting a voltage to a percentage, depending on the current "my_flying_state" value + float fromVoltageToPercent(float voltage); + // > For making the "enable flight" and "disable flight" buttons (un-)available + void disableFlyingStateButtons(); + void enableFlyingStateButtons(); + // > For updating the "my_flying_state" variable, and the UI element of "flying_state_label" + void setFlyingState(int new_flying_state); + // > For loading the "context" for this agent, i.e., the {agentID,cfID,flying zone} tuple + void loadCrazyflieContext(); + // > For updating the text in the UI element of "controller_enabled_label" + void setControllerEnabled(int new_controller); + + + +#ifdef CATKIN_MAKE + // --------------------------------------------------- // + // PRIVATE VARIABLES FOR ROS + + // > For running this is a ROS node thread + //rosNodeThread* myrosNodeThread; + + // > For the namespace of this node + std::string my_ros_namespace; + + // > For the "context" of this agent + CrazyflieContext my_context; + + // PUBLISHERS AND SUBSRIBERS + // > For Crazyradio commands based on button clicks + ros::Publisher crazyRadioCommandPublisher; + // > For updating the "rf_status_label" picture + ros::Subscriber crazyRadioStatusSubscriber; + // > For updating the current battery voltage + ros::Subscriber batteryVoltageSubscriber; + // > For updating the current battery state + ros::Subscriber batteryStateSubscriber; + // > For Flying state commands based on button clicks + ros::Publisher flyingStateCommandPublisher; + // > For updating the "flying_state_label" picture + ros::Subscriber flyingStateSubscriber; + // > For changes in the database that defines {agentID,cfID,flying zone} links + ros::Subscriber databaseChangedSubscriber; + ros::ServiceClient centralManagerDatabaseService; + // > For updating the controller that is currently operating + ros::Subscriber controllerUsedSubscriber; + + + // --------------------------------------------------- // + // PRIVATE CALLBACKS IN RESPONSE TO ROS MESSAGES + + // > For the CrazyRadio status, received on the "crazyRadioStatusSubscriber" + void crazyRadioStatusCallback(const std_msgs::Int32& msg); + // > For the Battery Voltage, received on the "batteryVoltageSubscriber" + void batteryVoltageCallback(const std_msgs::Float32& msg); + // > For the Battery State, receieved on the "batteryStateSubscriber" + void batteryStateChangedCallback(const std_msgs::Int32& msg); + // > For the Flying State, received on the "flyingStateSubscriber" + void flyingStateChangedCallback(const std_msgs::Int32& msg); + // > For the notification that the database was changes, received on the "DatabaseChangedSubscriber" + void databaseChangedCallback(const std_msgs::Int32& msg); + // > For the controller currently operating, received on "controllerUsedSubscriber" + void controllerUsedChangedCallback(const std_msgs::Int32& msg); + + +#endif + + + +private slots: + + // PRIVATE METHODS FOR BUTTON CALLBACKS + // > For the RF Crazyradio connect/disconnect buttons + void on_rf_connect_button_clicked(); + void on_rf_disconnect_button_clicked(); + // > For the enable, disable, motors-off buttons + void on_enable_flying_button_clicked(); + void on_disable_flying_button_clicked(); + void on_motors_off_button_clicked(); + +}; + +#endif // COORDINATORROW_H 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 new file mode 100644 index 0000000000000000000000000000000000000000..9ef5f5338135cc83fcff19bd3a665af381bfea74 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h @@ -0,0 +1,36 @@ +#ifndef ENABLECONTROLLERLOADYAMLBAR_H +#define ENABLECONTROLLERLOADYAMLBAR_H + +#include <QWidget> + +namespace Ui { +class EnableControllerLoadYamlBar; +} + +class EnableControllerLoadYamlBar : public QWidget +{ + Q_OBJECT + +public: + explicit EnableControllerLoadYamlBar(QWidget *parent = 0); + ~EnableControllerLoadYamlBar(); + +private slots: + + // ENABLE CONTROLLER BUTTONS ON-CLICK CALLBACK + void on_enable_safe_button_clicked(); + void on_enable_demo_button_clicked(); + void on_enable_student_button_clicked(); + void on_enable_mpc_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_student_button_clicked(); + void on_load_yaml_mpc_button_clicked(); + +private: + Ui::EnableControllerLoadYamlBar *ui; +}; + +#endif // ENABLECONTROLLERLOADYAMLBAR_H diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/mainwindow.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/mainwindow.h new file mode 100644 index 0000000000000000000000000000000000000000..d70ce302f75ce456216e7aeefc1bc6fb3f2553e9 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/mainwindow.h @@ -0,0 +1,70 @@ +// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// Coordinator GUI main window header. +// +// ---------------------------------------------------------------------------------- + + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> +#include <QShortcut> + +#ifdef CATKIN_MAKE +#include "rosNodeThread.h" +#endif + + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(int argc, char **argv, QWidget *parent = 0); + ~MainWindow(); + +private slots: + void on_actionShowHide_Coordinator_triggered(); + +private: + Ui::MainWindow *ui; + + QShortcut* m_close_GUI_shortcut; + +#ifdef CATKIN_MAKE + rosNodeThread* m_rosNodeThread; +#endif + +}; + +#endif // MAINWINDOW_H diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/safecontrollertab.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/safecontrollertab.h new file mode 100644 index 0000000000000000000000000000000000000000..7903ad85883dc451fb33ebde6192a67458ea7131 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/safecontrollertab.h @@ -0,0 +1,22 @@ +#ifndef SAFECONTROLLERTAB_H +#define SAFECONTROLLERTAB_H + +#include <QWidget> + +namespace Ui { +class SafeControllerTab; +} + +class SafeControllerTab : public QWidget +{ + Q_OBJECT + +public: + explicit SafeControllerTab(QWidget *parent = 0); + ~SafeControllerTab(); + +private: + Ui::SafeControllerTab *ui; +}; + +#endif // SAFECONTROLLERTAB_H diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/topbanner.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/topbanner.h new file mode 100644 index 0000000000000000000000000000000000000000..684801fb3bf0efc91590f1421715ddda53862294 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/topbanner.h @@ -0,0 +1,22 @@ +#ifndef TOPBANNER_H +#define TOPBANNER_H + +#include <QWidget> + +namespace Ui { +class TopBanner; +} + +class TopBanner : public QWidget +{ + Q_OBJECT + +public: + explicit TopBanner(QWidget *parent = 0); + ~TopBanner(); + +private: + Ui::TopBanner *ui; +}; + +#endif // TOPBANNER_H diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/connectstartstopbar.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/connectstartstopbar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a7ec4e9d8fe9430e8e7ffd5d8274a3d68d918db1 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/connectstartstopbar.cpp @@ -0,0 +1,54 @@ +#include "connectstartstopbar.h" +#include "ui_connectstartstopbar.h" + +ConnectStartStopBar::ConnectStartStopBar(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConnectStartStopBar) +{ + ui->setupUi(this); + + // SET A FEW PROPERTIES OF THE UI ELEMENTS + // > Default the battery voltage field to be "blank" + QString qstr = "-.-- V"; + ui->battery_voltage_lineEdit->setText(qstr); + // > Red font colour for the battery message label + //ui->battery_message_label->setStyleSheet("QLabel { color : red; }"); + // > Default the battery message label to be "blank" + //ui->battery_message_label->setText(""); + + // SET THE DEFAULT IMAGE FOR THE RF CONNECTION STATUS + QPixmap rf_disconnected_pixmap(":/images/rf_disconnected.png"); + ui->rf_status_label->setPixmap(rf_disconnected_pixmap); + ui->rf_status_label->setScaledContents(true); + + // SET THE DEFAULT IMAGE FOR THE BATTERY STATUS + QPixmap battery_unknown_pixmap(":/images/battery_unknown.png"); + ui->battery_status_label->setPixmap(battery_unknown_pixmap); + //ui->battery_status_label->setPixmap(battery_status_unknown_pixmap.scaled(ui->battery_status_label->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->battery_status_label->setScaledContents(true); + + // SET THE DEFAULT IMAGE FOR THE FLYING STATE + QPixmap flying_state_unknown_pixmap(":/images/flying_state_unknown.png"); + ui->flying_state_label->setPixmap(flying_state_unknown_pixmap); + ui->flying_state_label->setScaledContents(true); + + + + + + // ADD KEYBOARD SHORTCUTS + // > For "all motors off", press the space bar + ui->motors_off_button->setShortcut(tr("Space")); + + +} + +ConnectStartStopBar::~ConnectStartStopBar() +{ + delete ui; +} + +void ConnectStartStopBar::on_rf_disconnect_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 new file mode 100644 index 0000000000000000000000000000000000000000..9c7e79ab75582c577a45fa13a51ec684fe858d4b --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/controllertabs.cpp @@ -0,0 +1,14 @@ +#include "controllertabs.h" +#include "ui_controllertabs.h" + +ControllerTabs::ControllerTabs(QWidget *parent) : + QWidget(parent), + ui(new Ui::ControllerTabs) +{ + ui->setupUi(this); +} + +ControllerTabs::~ControllerTabs() +{ + delete ui; +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..a4b99f78d2531381a2ad12a41d0b00fd51d8f219 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinator.cpp @@ -0,0 +1,66 @@ +#include "coordinator.h" +#include "ui_coordinator.h" + +Coordinator::Coordinator(QWidget *parent) : + QWidget(parent), + ui(new Ui::Coordinator) +{ + ui->setupUi(this); + + ui->verticalLayout_for_coordinatedAgentsScrollArea->setAlignment(Qt::AlignTop); +} + +Coordinator::~Coordinator() +{ + delete ui; +} + +void Coordinator::on_refresh_button_clicked() +{ + + + for ( int i_agent = 1 ; i_agent < 11 ; i_agent++ ) + { + //ui->scrollAreaWidgetContents->setLayout(new QVBoxLayout); + + CoordinatorRow *temp_coordinatorRow = new CoordinatorRow(this,i_agent); + + // Check the box if "coordinate all" is checked + if (ui->coordinate_all_checkBox->isChecked()) + { + temp_coordinatorRow->setShouldCoordinate(true); + } + else + { + temp_coordinatorRow->setShouldCoordinate(false); + } + + // Add to the vector of coordinator rows + vector_of_coordinatorRows.append(temp_coordinatorRow); + + ui->coordinated_agents_scrollAreaWidgetContents->layout()->addWidget(temp_coordinatorRow); + } +} + +void Coordinator::on_delete_button_clicked() +{ + + foreach ( CoordinatorRow* temp_coordinatorRow, vector_of_coordinatorRows) { + delete( temp_coordinatorRow ); + } + + vector_of_coordinatorRows.clear(); + +} + +void Coordinator::on_coordinate_all_checkBox_clicked() +{ + // Get the state of the "coordinate all" is check box + bool shouldCoordinateAll = ui->coordinate_all_checkBox->isChecked(); + + // Apply this to all the rows + for ( int irow = 0 ; irow < vector_of_coordinatorRows.length() ; irow++ ) + { + vector_of_coordinatorRows[irow]->setShouldCoordinate( shouldCoordinateAll ); + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..6eeccdebb8335e94485c5b09f12330d59ac810d2 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/coordinatorrow.cpp @@ -0,0 +1,733 @@ +// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// Coordinator Row GUI. +// +// ---------------------------------------------------------------------------------- + + +#include "coordinatorrow.h" +#include "ui_coordinatorrow.h" + +CoordinatorRow::CoordinatorRow(QWidget *parent, int agentID) : + QWidget(parent), + ui(new Ui::CoordinatorRow), + my_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; + //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')); + // 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'); + + // 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); + std::string ros_base_namespace = qstr_ros_base_namespace.toStdString(); + + // SET THE INITIAL VALUE OF THE PRIVATE VARIABLES FOR THIS CLASS + // > For keeping track of the current RF Crazyradio state + my_radio_status = CONNECTED; + // > For keeping track of the current battery state + my_battery_state = BATTERY_STATE_NORMAL; + // > For keeping track of which image is currently displayed + my_battery_status_label_image_current_index = -999; + // > For keeping track of the current operating state + my_flying_state = STATE_MOTORS_OFF; + + // FOR BATTERY VOLTAGE LIMITS (THESE SHOULD BE READ IN AS PARAMTERS) + // > When in a "standby" type of state + battery_voltage_standby_empty = 3.30f; + battery_voltage_standby_full = 4.20f; + // > When in a "flying" type of state + battery_voltage_flying_empty = 2.80f; + battery_voltage_flying_full = 3.70f; + + // SET THE STARTING RADIO STATUS TO BE: DISCONNECTED + // > this also updates the image for the "rf_status_label", "battery_voltage_lineEdit", and "battery_status_label" + setCrazyRadioStatus(DISCONNECTED); + // SET THE STARTING FLYING STATE STATUS TO BE: MOTORS OFF + // > this also updates the image for the "flying_state_label" + setFlyingState(CMD_CRAZYFLY_MOTORS_OFF); + // SET THE DEFAULT NAME FOR THE SELECTED CONTROLLER + setControllerEnabled(SAFE_CONTROLLER); + +#ifdef CATKIN_MAKE + //m_rosNodeThread = new rosNodeThread(argc, argv, "coordinatorRowGUI"); + //m_rosNodeThread->init(); + + //m_ros_namespace = ros::this_node::getNamespace(); + + //qRegisterMetaType<ptrToMessage>("ptrToMessage"); + //QObject::connect(m_rosNodeThread, SIGNAL(newViconData(const ptrToMessage&)), this, SLOT(updateNewViconData(const ptrToMessage&))); + + //ros::NodeHandle nodeHandle(m_ros_namespace); + + // communication with PPS Client, just to make it possible to communicate through terminal also we use PPSClient's name + //ros::NodeHandle nh_PPSClient(m_ros_namespace + "/PPSClient"); + //ros::NodeHandle nh_PPSClient("PPSClient"); + + + // LET THE USER KNOW WHAT THE BASE NAMESPACE IS + ROS_INFO_STREAM("[Coordinator Row GUI] using base namespace: %s" << ros_base_namespace.c_str() << ", for agentID = " << my_agentID); + + // CREATE A NODE HANDLE TO THE BASE NAMESPACE + ros::NodeHandle base_nodeHandle(ros_base_namespace); + + // CREATE A NODE HANDLE TO THE ROOT OF THE D-FaLL SYSTEM + ros::NodeHandle dfall_root_nodeHandle("/dfall"); + + // SUBSCRIBERS AND PUBLISHERS: + // > For Crazyradio commands based on button clicks + crazyRadioCommandPublisher = base_nodeHandle.advertise<std_msgs::Int32>("PPSClient/crazyRadioCommand", 1); + // > For updating the "rf_status_label" picture + crazyRadioStatusSubscriber = base_nodeHandle.subscribe("CrazyRadio/CrazyRadioStatus", 1, &CoordinatorRow::crazyRadioStatusCallback, this); + // > For updating the current battery voltage + batteryVoltageSubscriber = base_nodeHandle.subscribe("CrazyRadio/CFBattery", 1, &CoordinatorRow::batteryVoltageCallback, this); + // > For updating the current battery state + batteryStateSubscriber = base_nodeHandle.subscribe("PPSClient/batteryState", 1, &CoordinatorRow::batteryStateChangedCallback, this); + // > For Flying state commands based on button clicks + flyingStateCommandPublisher = base_nodeHandle.advertise<std_msgs::Int32>("PPSClient/Command", 1); + // > For updating the "flying_state_label" picture + flyingStateSubscriber = base_nodeHandle.subscribe("PPSClient/flyingState", 1, &CoordinatorRow::flyingStateChangedCallback, this); + // > For changes in the database that defines {agentID,cfID,flying zone} links + databaseChangedSubscriber = dfall_root_nodeHandle.subscribe("my_GUI/DBChanged", 1, &CoordinatorRow::databaseChangedCallback, this);; + centralManagerDatabaseService = dfall_root_nodeHandle.serviceClient<CMQuery>("CentralManagerService/Query", false); + // > For updating the controller that is currently operating + controllerUsedSubscriber = base_nodeHandle.subscribe("PPSClient/controllerUsed", 1, &CoordinatorRow::controllerUsedChangedCallback, this); + +#endif + + // FURTHER INITILIASATIONS NEED TO OCCUR AFTER THE ROS RELATED + // INITIALISATIONS ARE COMPLETE + loadCrazyflieContext(); + + // FOR DEBUGGING: + //ui->shouldCoordinate_checkBox->setText(my_agentID_as_string); + //ui->shouldCoordinate_checkBox->setText(QString::fromStdString(base_namespace)); +} + +CoordinatorRow::~CoordinatorRow() +{ + delete ui; +} + + + +// PUBLIC METHODS FOR SETTING PROPERTIES + +// > Set the state of the checkbox +void CoordinatorRow::setShouldCoordinate(bool shouldCoordinate) +{ + ui->shouldCoordinate_checkBox->setChecked( shouldCoordinate ); +} + +// > For making the "enable flight" and "disable flight" buttons unavailable +void CoordinatorRow::disableFlyingStateButtons() +{ + ui->motors_off_button->setEnabled(true); + ui->enable_flying_button->setEnabled(false); + ui->disable_flying_button->setEnabled(false); +} + +// > For making the "enable flight" and "disable flight" buttons available +void CoordinatorRow::enableFlyingStateButtons() +{ + ui->motors_off_button->setEnabled(true); + ui->enable_flying_button->setEnabled(true); + ui->disable_flying_button->setEnabled(true); +} + + + + + +#ifdef CATKIN_MAKE +// PRIVATE CALLBACKS IN RESPONSE TO ROS MESSAGES + +// > 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); + setCrazyRadioStatus( msg.data ); +} +#endif + + +// PRIVATE METHODS FOR SETTING PROPERTIES + +void CoordinatorRow::setCrazyRadioStatus(int new_radio_status) +{ + // add more things whenever the status is changed + switch(new_radio_status) + { + case CONNECTED: + { + // SET THE APPROPRIATE IMAGE FOR THE RADIOSTATUS LABEL + my_rf_status_label_mutex.lock(); + //ui->rf_status_label->clear(); + QPixmap rf_connected_pixmap(":/images/rf_connected.png"); + ui->rf_status_label->setPixmap(rf_connected_pixmap); + ui->rf_status_label->setScaledContents(true); + //ui->rf_status_label->update(); + my_rf_status_label_mutex.unlock(); + // ENABLE THE REMAINDER OF THE GUI + my_battery_state_mutex.lock(); + if (my_battery_state == BATTERY_STATE_NORMAL) + { + enableFlyingStateButtons(); + } + my_battery_state_mutex.unlock(); + + break; + } + + case CONNECTING: + { + // SET THE APPROPRIATE IMAGE FOR THE RADIO STATUS LABEL + my_rf_status_label_mutex.lock(); + //ui->rf_status_label->clear(); + QPixmap rf_connecting_pixmap(":/images/rf_connecting.png"); + ui->rf_status_label->setPixmap(rf_connecting_pixmap); + ui->rf_status_label->setScaledContents(true); + //ui->rf_status_label->update(); + my_rf_status_label_mutex.unlock(); + break; + } + + case DISCONNECTED: + { + // SET THE APPROPRIATE IMAGE FOR THE RADIO STATUS LABEL + my_rf_status_label_mutex.lock(); + //ui->rf_status_label->clear(); + QPixmap rf_disconnected_pixmap(":/images/rf_disconnected.png"); + ui->rf_status_label->setPixmap(rf_disconnected_pixmap); + ui->rf_status_label->setScaledContents(true); + //ui->rf_status_label->update(); + my_rf_status_label_mutex.unlock(); + // SET THE BATTERY VOLTAGE FIELD TO BE BLANK + QString qstr = "-.-- V"; + my_battery_voltage_lineEdit_mutex.lock(); + ui->battery_voltage_lineEdit->setText(qstr); + my_battery_voltage_lineEdit_mutex.unlock(); + // SET THE APPROPRIATE IMAGE FOR THE BATTERY STATUS LABEL + // > Lock the mutex for accessing both "my_battery_status_label_image_current_index" + // and "ui->battery_status_label" + my_battery_status_label_mutex.lock(); + if (my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_UNKNOWN) + { + ui->battery_status_label->clear(); + QPixmap battery_unknown_pixmap(":/images/battery_unknown.png"); + ui->battery_status_label->setPixmap(battery_unknown_pixmap); + ui->battery_status_label->setScaledContents(true); + my_battery_status_label_image_current_index = BATTERY_LABEL_IMAGE_INDEX_UNKNOWN; + ui->battery_status_label->update(); + } + my_battery_status_label_mutex.unlock(); + // DISABLE THE REMAINDER OF THE GUI + disableFlyingStateButtons(); + break; + } + + default: + { + break; + } + } + my_radio_status = new_radio_status; +} + + + +#ifdef CATKIN_MAKE +// PRIVATE CALLBACKS IN RESPONSE TO ROS MESSAGES + +// > For the Battery Voltage +void CoordinatorRow::batteryVoltageCallback(const std_msgs::Float32& msg) +{ + setBatteryVoltageTextAndImage( msg.data ); +} + + +void CoordinatorRow::batteryStateChangedCallback(const std_msgs::Int32& msg) +{ + //ROS_INFO_STEAM("[Coordinator Row GUI] Battery State Changed Callback called for agentID = " << my_agentID); + setBatteryState( msg.data ); +} +#endif + + + +// PRIVATE METHODS FOR SETTING PROPERTIES + +// > For updating the battery state +void CoordinatorRow::setBatteryState(int new_battery_state) +{ + // LOCK THE MUTEX FOR THE WHOLE SWITCH CASE STATEMENT + my_battery_state_mutex.lock(); + // Switch depending the the new battery state provided + switch(new_battery_state) + { + case BATTERY_STATE_LOW: + { + // MAKE UNAVAILABLE THE BUTTONS FOR ENABLING AND DISABLING FLIGHT + disableFlyingStateButtons(); + + // SET THE CLASS VARIABLE FOR TRACKING THE BATTERY STATE + my_battery_state = BATTERY_STATE_LOW; + break; + } + + case BATTERY_STATE_NORMAL: + { + // MAKE UNAVAILABLE THE BUTTONS FOR ENABLING AND DISABLING FLIGHT + enableFlyingStateButtons(); + + // SET THE CLASS VARIABLE FOR TRACKING THE BATTERY STATE + my_battery_state = BATTERY_STATE_NORMAL; + break; + } + + default: + break; + } + // UNLOCK THE MUTEX + my_battery_state_mutex.unlock(); +} + +// > For the battery voltage label and image +void CoordinatorRow::setBatteryVoltageTextAndImage(float battery_voltage) +{ + setBatteryVoltageText( battery_voltage ); + setBatteryVoltageImage( battery_voltage ); +} + +// > For updating the battery voltage shown in the UI elements of "battery_voltage_lineEdit" +void CoordinatorRow::setBatteryVoltageText(float battery_voltage) +{ + // Lock the mutex + my_battery_voltage_lineEdit_mutex.lock(); + // Construct the text string + QString qstr = ""; + qstr.append(QString::number(battery_voltage, 'f', 2)); + qstr.append(" V"); + // Set the text to the battery voltage line edit + ui->battery_voltage_lineEdit->setText(qstr); + // Unlock the mutex + my_battery_voltage_lineEdit_mutex.unlock(); +} + +// > For updating the battery voltage shown in the UI elements of "battery_status_label" +void CoordinatorRow::setBatteryVoltageImage(float battery_voltage) +{ + // COMPUTE THE BATTERY VOLTAGE AS A PERCENTAGE + float battery_voltage_percentage = fromVoltageToPercent(battery_voltage); + + // CONVERT THE VOLTAGE PERCENTAGE TO AN INDEX OF WHICH BATTERY LEVEL IMAGE TO DISPLAY + // > Initialise a local variable that will be set in the switch case below + int new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_UNKNOWN; + // > Initialise a local variable for the string of which image to use + QString qstr_new_image = ""; + qstr_new_image.append(":/images/"); + // > Get the value of the "my_battery_state" variable into a local variable + my_battery_state_mutex.lock(); + int local_copy_of_my_battery_state = my_battery_state; + my_battery_state_mutex.unlock(); + // > Switch based on the current battery state, first locking the mutex for accessing + // both "my_battery_status_label_image_current_index" and "ui->battery_status_label" + my_battery_status_label_mutex.lock(); + switch(local_copy_of_my_battery_state) + { + // WHEN THE BATTERY IS IN A LOW STATE + case BATTERY_STATE_LOW: + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_EMPTY; + qstr_new_image.append("battery_empty.png"); + break; + } + + // WHEN THE BATTERY IS IN A NORMAL STATE + case BATTERY_STATE_NORMAL: + { + + if ( + ((my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_EMPTY) && (battery_voltage_percentage <= 0.0f)) + || + ((my_battery_status_label_image_current_index == BATTERY_LABEL_IMAGE_INDEX_EMPTY) && (battery_voltage_percentage <= 2.0f)) + ) + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_EMPTY; + qstr_new_image.append("battery_empty.png"); + } + else if ( + ((my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_20) && (battery_voltage_percentage <= 20.0f)) + || + ((my_battery_status_label_image_current_index == BATTERY_LABEL_IMAGE_INDEX_20) && (battery_voltage_percentage <= 22.0f)) + ) + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_20; + qstr_new_image.append("battery_20.png"); + } + else if ( + ((my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_40) && (battery_voltage_percentage <= 40.0f)) + || + ((my_battery_status_label_image_current_index == BATTERY_LABEL_IMAGE_INDEX_40) && (battery_voltage_percentage <= 42.0f)) + ) + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_40; + qstr_new_image.append("battery_40.png"); + } + else if ( + ((my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_60) && (battery_voltage_percentage <= 60.0f)) + || + ((my_battery_status_label_image_current_index == BATTERY_LABEL_IMAGE_INDEX_60) && (battery_voltage_percentage <= 62.0f)) + ) + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_60; + qstr_new_image.append("battery_60.png"); + } + else if ( + ((my_battery_status_label_image_current_index != BATTERY_LABEL_IMAGE_INDEX_80) && (battery_voltage_percentage <= 80.0f)) + || + ((my_battery_status_label_image_current_index == BATTERY_LABEL_IMAGE_INDEX_80) && (battery_voltage_percentage <= 82.0f)) + ) + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_80; + qstr_new_image.append("battery_80.png"); + } + else + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_FULL; + qstr_new_image.append("battery_full.png"); + } + break; + } + + default: + { + new_battery_label_image_index = BATTERY_LABEL_IMAGE_INDEX_UNKNOWN; + qstr_new_image.append("battery_unknown.png"); + break; + } + } + // UPDATE THE IMAGE DISPLAYED BASED ON THE "new index" + // > Only if it is different from the current index + if (my_battery_status_label_image_current_index != new_battery_label_image_index) + { + // SET THE IMAGE FOR THE BATTERY STATUS LABEL + ui->battery_status_label->clear(); + QPixmap battery_image_pixmap(qstr_new_image); + ui->battery_status_label->setPixmap(battery_image_pixmap); + ui->battery_status_label->setScaledContents(true); + my_battery_status_label_image_current_index = new_battery_label_image_index; + ui->battery_status_label->update(); + } + // Finally unlock the mutex + my_battery_status_label_mutex.unlock(); +} + + +// > For converting a voltage to a percentage, depending on the current "my_flying_state" value +float CoordinatorRow::fromVoltageToPercent(float voltage) +{ + // INITIALISE THE LOCAL VARIABLE FOR THE VOLTAGE WHEN FULL/EMPTY + float voltage_when_full; + float voltage_when_empty; + + // COMPUTE THE PERCENTAGE DIFFERENTLY DEPENDING ON + // THE CURRENT FLYING STATE + // > First lock the mutex before accessing the "my_flying_state" variable + my_flying_state_mutex.lock(); + if (my_flying_state == STATE_MOTORS_OFF) + { + // Voltage limits for a "standby" type of state + voltage_when_empty = battery_voltage_standby_empty; + voltage_when_full = battery_voltage_standby_full; + } + else + { + // Voltage limits for a "flying" type of state + voltage_when_empty = battery_voltage_flying_empty; + voltage_when_full = battery_voltage_flying_full; + } + // > Unlock the mutex + my_flying_state_mutex.unlock(); + + // COMPUTE THE PERCENTAGE + float percentage = 100.0f * (voltage-voltage_when_empty)/(voltage_when_full-voltage_when_empty); + + // CLIP THE PERCENTAGE TO BE BETWEEN [0,100] + // > This should not happen to often + if(percentage > 100.0f) + { + percentage = 100.0f; + } + if(percentage < 0.0f) + { + percentage = 0.0f; + } + + // RETURN THE PERCENTAGE + return percentage; +} + + + + +// RESPONDING TO CHANGES IN THE FLYING STATE +#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); + setFlyingState(msg.data); +} +#endif + +void CoordinatorRow::setFlyingState(int new_flying_state) +{ + // PUT THE CURRENT STATE INTO THE CLASS VARIABLE + my_flying_state_mutex.lock(); + my_flying_state = new_flying_state; + my_flying_state_mutex.unlock(); + + // UPDATE THE LABEL TO DISPLAY THE FLYING STATE + switch(new_flying_state) + { + case STATE_MOTORS_OFF: + { + // SET THE APPROPRIATE IMAGE FOR THE FLYING STATE LABEL + QPixmap flying_state_off_pixmap(":/images/flying_state_off.png"); + ui->flying_state_label->setPixmap(flying_state_off_pixmap); + ui->flying_state_label->setScaledContents(true); + break; + } + + case STATE_TAKE_OFF: + { + // SET THE APPROPRIATE IMAGE FOR THE FLYING STATE LABEL + QPixmap flying_state_enabling_pixmap(":/images/flying_state_enabling.png"); + ui->flying_state_label->setPixmap(flying_state_enabling_pixmap); + ui->flying_state_label->setScaledContents(true); + break; + } + + case STATE_FLYING: + { + // SET THE APPROPRIATE IMAGE FOR THE FLYING STATE LABEL + QPixmap flying_state_flying_pixmap(":/images/flying_state_flying.png"); + ui->flying_state_label->setPixmap(flying_state_flying_pixmap); + ui->flying_state_label->setScaledContents(true); + break; + } + + case STATE_LAND: + { + //qstr.append("Land"); + // SET THE APPROPRIATE IMAGE FOR THE FLYING STATE LABEL + QPixmap flying_state_disabling_pixmap(":/images/flying_state_disabling.png"); + ui->flying_state_label->setPixmap(flying_state_disabling_pixmap); + ui->flying_state_label->setScaledContents(true); + break; + } + + default: + { + // SET THE APPROPRIATE IMAGE FOR THE FLYING STATE LABEL + QPixmap flying_state_unknown_pixmap(":/images/flying_state_unknown.png"); + ui->flying_state_label->setPixmap(flying_state_unknown_pixmap); + ui->flying_state_label->setScaledContents(true); + break; + } + } +} + + +// RESPONDING TO CHANGES IN THE DATABASE +#ifdef CATKIN_MAKE +// > 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); + loadCrazyflieContext(); +} +#endif + +// > For loading the "context" for this agent, i.e., the {agentID,cfID,flying zone} tuple +void CoordinatorRow::loadCrazyflieContext() +{ + QString qstr_crazyflie_name = ""; +#ifdef CATKIN_MAKE + CMQuery contextCall; + contextCall.request.studentID = my_agentID; + //ROS_INFO_STREAM("StudentID:" << my_agentID); + + centralManager.waitForExistence(ros::Duration(-1)); + + if(centralManager.call(contextCall)) + { + my_context = contextCall.response.crazyflieContext; + ROS_INFO_STREAM("[Coordinator Row GUI] CrazyflieContext:\n" << my_context); + + qstr_crazyflie_name.append(QString::fromStdString(my_context.crazyflieName)); + } + else + { + ROS_ERROR_STREAM("[Coordinator Row GUI] Failed to load context for agentID = " << my_agentID); + } + // This updating of the radio only needs to be done by the actual agent's node + //ros::NodeHandle nh("CrazyRadio"); + //nh.setParam("crazyFlieAddress", m_context.crazyflieAddress); +#else + // Set the Crazyflie Name String to be a question mark + qstr_crazyflie_name.append("?"); +#endif + + // 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(qstr_crazyflie_name); + ui->shouldCoordinate_checkBox->setText(qstr_for_checkbox_label); + +} + + +#ifdef CATKIN_MAKE +// > 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); + setControllerEnabled(msg.data); +} +#endif + + +void CoordinatorRow::setControllerEnabled(int new_controller) +{ + switch(new_controller) + { + case SAFE_CONTROLLER: + { + ui->controller_enabled_label->setText("Safe"); + break; + } + case DEMO_CONTROLLER: + { + ui->controller_enabled_label->setText("Demo"); + break; + } + case STUDENT_CONTROLLER: + { + ui->controller_enabled_label->setText("Student"); + break; + } + case MPC_CONTROLLER: + { + ui->controller_enabled_label->setText("MPC"); + break; + } + case REMOTE_CONTROLLER: + { + ui->controller_enabled_label->setText("Remote"); + break; + } + case TUNING_CONTROLLER: + { + ui->controller_enabled_label->setText("Tuning"); + break; + } + default: + { + ui->controller_enabled_label->setText("Unknown"); + break; + } + } +} + + + + +// ------------------------------------------------------------------- // +// # RF Crazyradio Connect Disconnect +void CoordinatorRow::on_rf_connect_button_clicked() +{ +#ifdef CATKIN_MAKE + std_msgs::Int32 msg; + msg.data = CMD_RECONNECT; + this->crazyRadioCommandPublisher.publish(msg); + ROS_INFO("[FLYING AGENT GUI] Command to RF reconnect published"); +#endif +} + +void CoordinatorRow::on_rf_disconnect_button_clicked() +{ +#ifdef CATKIN_MAKE + std_msgs::Int32 msg; + msg.data = CMD_DISCONNECT; + this->crazyRadioCommandPublisher.publish(msg); + ROS_INFO("[FLYING AGENT GUI] Command to RF disconnect published"); +#endif +} + +// ------------------------------------------------------------------- // +// # Take off, land, motors off +void CoordinatorRow::on_enable_flying_button_clicked() +{ +#ifdef CATKIN_MAKE + std_msgs::Int32 msg; + msg.data = CMD_CRAZYFLY_TAKE_OFF; + this->PPSClientCommandPublisher.publish(msg); +#endif +} + +void CoordinatorRow::on_disable_flying_button_clicked() +{ +#ifdef CATKIN_MAKE + std_msgs::Int32 msg; + msg.data = CMD_CRAZYFLY_LAND; + this->PPSClientCommandPublisher.publish(msg); +#endif +} + +void CoordinatorRow::on_motors_off_button_clicked() +{ +#ifdef CATKIN_MAKE + std_msgs::Int32 msg; + msg.data = CMD_CRAZYFLY_MOTORS_OFF; + this->PPSClientCommandPublisher.publish(msg); +#endif +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..7e3dee64e552b25ff067659511ec957797aa06f1 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/enablecontrollerloadyamlbar.cpp @@ -0,0 +1,62 @@ +#include "enablecontrollerloadyamlbar.h" +#include "ui_enablecontrollerloadyamlbar.h" + +EnableControllerLoadYamlBar::EnableControllerLoadYamlBar(QWidget *parent) : + QWidget(parent), + ui(new Ui::EnableControllerLoadYamlBar) +{ + ui->setupUi(this); +} + +EnableControllerLoadYamlBar::~EnableControllerLoadYamlBar() +{ + delete ui; +} + + + + +// ENABLE CONTROLLER BUTTONS ON-CLICK CALLBACK + +void EnableControllerLoadYamlBar::on_enable_safe_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_enable_demo_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_enable_student_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_enable_mpc_button_clicked() +{ + +} + + +// LOAD YAML BUTTONS ON-CLICK CALLBACK + +void EnableControllerLoadYamlBar::on_load_yaml_safe_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_load_yaml_demo_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_load_yaml_student_button_clicked() +{ + +} + +void EnableControllerLoadYamlBar::on_load_yaml_mpc_button_clicked() +{ + +} diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/main.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4999c2c0ff6f96b8c2758573aeb11e8f38043779 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/main.cpp @@ -0,0 +1,56 @@ +// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// Main file of the Qt project for the Coordinator GUI. +// +// ---------------------------------------------------------------------------------- + + +#include "mainwindow.h" +#include "ui_mainwindow.h" // <-- this include is additional to the Qt default +#include <QApplication> + +int main(int argc, char *argv[]) +{ + + // ----------------------------------------------------------- // + // THE FOLLOWING IS THE DEFAULT PROVIDED BY QT: +// QApplication a(argc, argv); +// MainWindow w; +// w.show(); +// return a.exec(); + // ----------------------------------------------------------- // + + // ----------------------------------------------------------- // + // THE FOLLOWING IS A SLIGHT ADAPTATION FOR COMBING WITH ROS: + QApplication a(argc, argv); + MainWindow w(argc, argv); + w.show(); + a.exec(); + // ----------------------------------------------------------- // + +} diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/mainwindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/mainwindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4f6e850b2c440d0356051f3827d5dccab96c51ad --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/mainwindow.cpp @@ -0,0 +1,75 @@ +// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat +// +// This file is part of D-FaLL-System. +// +// D-FaLL-System is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// D-FaLL-System is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>. +// +// +// ---------------------------------------------------------------------------------- +// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M +// D D F aaa L L S Y Y S T E MM MM +// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M +// D D F a aa L L S Y S T E M M +// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M +// +// +// DESCRIPTION: +// Coordinator GUI main window. +// +// ---------------------------------------------------------------------------------- + +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(int argc, char **argv, QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ +#ifdef CATKIN_MAKE + m_rosNodeThread = new rosNodeThread(argc, argv, "coordinatorGUI"); +#endif + ui->setupUi(this); + + // ADD KEYBOARD SHORTCUTS + // > For "kill GUI node", press "CTRL+C" while the GUI window is the focus + m_close_GUI_shortcut = new QShortcut(QKeySequence(tr("CTRL+C")), this, SLOT(close())); + +#ifdef CATKIN_MAKE + m_rosNodeThread->init(); +#endif + +} + +MainWindow::~MainWindow() +{ + delete ui; +} + + +void MainWindow::on_actionShowHide_Coordinator_triggered() +{ + //ui->customWidget_enableControllerLoadYamlBar->setEnabled(false); + if ( ui->customWidget_coordinator->isHidden() ) + { + ui->customWidget_coordinator->show(); + QString qstr = "Hide Coordinator"; + ui->actionShowHide_Coordinator->setText(qstr); + } + else + { + ui->customWidget_coordinator->hide(); + QString qstr = "Show Coordinator"; + ui->actionShowHide_Coordinator->setText(qstr); + } +} diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/safecontrollertab.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/safecontrollertab.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ddfc3d77f9f30bb360d3649eb932c6780688022f --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/safecontrollertab.cpp @@ -0,0 +1,14 @@ +#include "safecontrollertab.h" +#include "ui_safecontrollertab.h" + +SafeControllerTab::SafeControllerTab(QWidget *parent) : + QWidget(parent), + ui(new Ui::SafeControllerTab) +{ + ui->setupUi(this); +} + +SafeControllerTab::~SafeControllerTab() +{ + delete ui; +} diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/topbanner.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/topbanner.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c71863d655ad45dbeb0b04fe641ac24fc8bd7a7 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/src/topbanner.cpp @@ -0,0 +1,14 @@ +#include "topbanner.h" +#include "ui_topbanner.h" + +TopBanner::TopBanner(QWidget *parent) : + QWidget(parent), + ui(new Ui::TopBanner) +{ + ui->setupUi(this); +} + +TopBanner::~TopBanner() +{ + delete ui; +}