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 index 07c4fbced43644193b0a431f2cf4d0b465220a11..dba7e18673861d78224996dd92f6b51e785c3802 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/flyingAgentGUI.pro @@ -39,7 +39,8 @@ HEADERS += include/mainwindow.h \ include/coordinatorrow.h \ include/studentcontrollertab.h \ include/defaultcontrollertab.h \ - include/pickercontrollertab.h + include/pickercontrollertab.h \ + include/Constants_for_Qt_compile.h FORMS += forms/mainwindow.ui \ forms/topbanner.ui \ 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 index c08c3341678b5e68eb2f9d7738f786fb1a9be3c2..c2e783dfbcf44a2540084eee19ebddcbe62996df 100644 --- 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 @@ -22,19 +22,19 @@ <item row="0" column="0"> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> - <number>6</number> + <number>12</number> </property> <property name="leftMargin"> <number>6</number> </property> <property name="topMargin"> - <number>6</number> + <number>0</number> </property> <property name="rightMargin"> <number>6</number> </property> <property name="bottomMargin"> - <number>6</number> + <number>0</number> </property> <item> <widget class="QPushButton" name="rf_disconnect_button"> @@ -113,6 +113,9 @@ </item> <item> <widget class="QLineEdit" name="battery_voltage_lineEdit"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -144,6 +147,9 @@ <property name="alignment"> <set>Qt::AlignCenter</set> </property> + <property name="readOnly"> + <bool>true</bool> + </property> </widget> </item> <item> @@ -172,7 +178,7 @@ </widget> </item> <item> - <widget class="QPushButton" name="take_off_button"> + <widget class="QPushButton" name="enable_flying_button"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -197,7 +203,7 @@ </widget> </item> <item> - <widget class="QPushButton" name="land_button"> + <widget class="QPushButton" name="disable_flying_button"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui index 06003ef3968d18a8ac3fd736d1c772483e489187..ffb245eb7c6a132d6864b0834654903ec88f434f 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/coordinatorrow.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>660</width> + <width>740</width> <height>45</height> </rect> </property> @@ -193,6 +193,9 @@ <property name="text"> <string>-.-- V</string> </property> + <property name="readOnly"> + <bool>true</bool> + </property> </widget> </item> <item> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui index 80d40b200a37aa380a48a97c367e3b3c25d12eb4..704e95abc4d213f955f9206470a1883505749bdd 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/enablecontrollerloadyamlbar.ui @@ -27,6 +27,9 @@ <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> <layout class="QGridLayout" name="gridLayout_3"> + <property name="spacing"> + <number>12</number> + </property> <item row="0" column="4"> <widget class="QPushButton" name="enable_safe_button"> <property name="sizePolicy"> @@ -38,13 +41,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>70</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>70</height> </size> </property> <property name="font"> @@ -61,21 +64,21 @@ <item row="0" column="0"> <widget class="QLabel" name="enable_controller_label"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>60</width> - <height>20</height> + <width>0</width> + <height>70</height> </size> </property> <property name="maximumSize"> <size> - <width>180</width> - <height>20</height> + <width>16777215</width> + <height>70</height> </size> </property> <property name="font"> @@ -103,13 +106,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>70</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>70</height> </size> </property> <property name="font"> @@ -126,21 +129,21 @@ <item row="1" column="0"> <widget class="QLabel" name="load_yaml_label"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>60</width> - <height>20</height> + <width>0</width> + <height>50</height> </size> </property> <property name="maximumSize"> <size> - <width>180</width> - <height>20</height> + <width>16777215</width> + <height>50</height> </size> </property> <property name="font"> @@ -168,13 +171,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>50</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>50</height> </size> </property> <property name="text"> @@ -193,13 +196,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>50</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>50</height> </size> </property> <property name="text"> @@ -218,13 +221,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>50</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>50</height> </size> </property> <property name="text"> @@ -243,13 +246,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>70</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>70</height> </size> </property> <property name="font"> @@ -274,13 +277,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>70</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>70</height> </size> </property> <property name="font"> @@ -305,13 +308,13 @@ <property name="minimumSize"> <size> <width>60</width> - <height>40</height> + <height>50</height> </size> </property> <property name="maximumSize"> <size> <width>180</width> - <height>40</height> + <height>50</height> </size> </property> <property name="text"> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui index a30186338b9f7bbc2662b49126ad166e42ee7bbb..28300e78fefb18b780f6578086da3d01e8ffc06e 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/forms/mainwindow.ui @@ -73,20 +73,44 @@ </property> <item> <widget class="TopBanner" name="customWidget_topBanner" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> <property name="maximumSize"> <size> <width>16777215</width> - <height>100</height> + <height>16777215</height> </size> </property> </widget> </item> <item> <widget class="ConnectStartStopBar" name="customWidget_connectStartStopBar" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> <property name="maximumSize"> <size> <width>16777215</width> - <height>80</height> + <height>16777215</height> </size> </property> </widget> @@ -97,7 +121,7 @@ <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -111,7 +135,7 @@ <property name="maximumSize"> <size> <width>16777215</width> - <height>100</height> + <height>16777215</height> </size> </property> </widget> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/Constants_for_Qt_compile.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/Constants_for_Qt_compile.h new file mode 100644 index 0000000000000000000000000000000000000000..ac3ecb916be33a14eac4881c7415b5f3cec6cf16 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/Constants_for_Qt_compile.h @@ -0,0 +1,229 @@ +// 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: +// Constants that are used across multiple files +// +// ---------------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------------- +// U U +// U U +// U U +// U U +// UUU +// ---------------------------------------------------------------------------------- + + +// Conversions between degrees and radians +#define RAD2DEG 180.0/PI +#define DEG2RAD PI/180.0 + +// PI +#define PI 3.141592653589 + + + + +// Types PPS firmware +#define CF_COMMAND_TYPE_MOTORS 6 +#define CF_COMMAND_TYPE_RATE 7 +#define CF_COMMAND_TYPE_ANGLE 8 + +// Types of controllers 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 +#define PICKER_CONTROLLER 7 + +// The constants that "command" changes in the +// operation state of this agent +#define CMD_USE_SAFE_CONTROLLER 1 +#define CMD_USE_DEMO_CONTROLLER 2 +#define CMD_USE_STUDENT_CONTROLLER 3 +#define CMD_USE_MPC_CONTROLLER 4 +#define CMD_USE_REMOTE_CONTROLLER 5 +#define CMD_USE_TUNING_CONTROLLER 6 +#define CMD_USE_PICKER_CONTROLLER 7 + + +#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 + + +// Commands for CrazyRadio +#define CMD_RECONNECT 0 +#define CMD_DISCONNECT 1 + + +// CrazyRadio states: +#define CRAZY_RADIO_STATE_CONNECTED 0 +#define CRAZY_RADIO_STATE_CONNECTING 1 +#define CRAZY_RADIO_STATE_DISCONNECTED 2 + + + + +// ---------------------------------------------------------------------------------- +// BBBB A TTTTT TTTTT EEEEE RRRR Y Y +// B B A A T T E R R Y Y +// BBBB A A T T EEE RRRR Y +// B B AAAAA T T E R R Y +// BBBB A A T T EEEEE R R Y +// ---------------------------------------------------------------------------------- + +// Battery levels +#define BATTERY_LEVEL_000 0 +#define BATTERY_LEVEL_010 1 +#define BATTERY_LEVEL_020 2 +#define BATTERY_LEVEL_030 3 +#define BATTERY_LEVEL_040 4 +#define BATTERY_LEVEL_050 5 +#define BATTERY_LEVEL_060 6 +#define BATTERY_LEVEL_070 7 +#define BATTERY_LEVEL_080 8 +#define BATTERY_LEVEL_090 9 +#define BATTERY_LEVEL_100 10 +#define BATTERY_LEVEL_UNAVAILABLE -1 + +// Battery states +#define BATTERY_STATE_NORMAL 0 +#define BATTERY_STATE_LOW 1 + + + + + +// ---------------------------------------------------------------------------------- +// Y Y A M M L +// Y Y A A MM MM L +// Y A A M M M L +// Y AAAAA M M L +// Y A A M M LLLLL +// ---------------------------------------------------------------------------------- + +// For where to load the yaml file from +#define LOAD_YAML_FROM_AGENT 1 +#define LOAD_YAML_FROM_COORDINATOR 2 + + + + + + +// The types, i.e., agent or coordinator +#define TYPE_INVALID -1 +#define TYPE_COORDINATOR 1 +#define TYPE_AGENT 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// OLD STUFF FOR LOADING YAML FILES +// For which controller parameters to load from file +#define LOAD_YAML_SAFE_CONTROLLER_AGENT 1 +#define LOAD_YAML_DEMO_CONTROLLER_AGENT 2 +#define LOAD_YAML_STUDENT_CONTROLLER_AGENT 3 +#define LOAD_YAML_MPC_CONTROLLER_AGENT 4 +#define LOAD_YAML_REMOTE_CONTROLLER_AGENT 5 +#define LOAD_YAML_TUNING_CONTROLLER_AGENT 6 +#define LOAD_YAML_PICKER_CONTROLLER_AGENT 7 + +#define LOAD_YAML_SAFE_CONTROLLER_COORDINATOR 11 +#define LOAD_YAML_DEMO_CONTROLLER_COORDINATOR 12 +#define LOAD_YAML_STUDENT_CONTROLLER_COORDINATOR 13 +#define LOAD_YAML_MPC_CONTROLLER_COORDINATOR 14 +#define LOAD_YAML_REMOTE_CONTROLLER_COORDINATOR 15 +#define LOAD_YAML_TUNING_CONTROLLER_COORDINATOR 16 +#define LOAD_YAML_PICKER_CONTROLLER_COORDINATOR 17 + + +// For sending commands to the controller node informing +// which parameters to fetch +// > NOTE: these are identical to the #defines above, but +// used because they have the name distinguishes +// between: +// - "loading" a yaml file into ram +// - "fetching" the values that were loaded into ram +#define FETCH_YAML_SAFE_CONTROLLER_FROM_OWN_AGENT 1 +#define FETCH_YAML_DEMO_CONTROLLER_FROM_OWN_AGENT 2 +#define FETCH_YAML_STUDENT_CONTROLLER_FROM_OWN_AGENT 3 +#define FETCH_YAML_MPC_CONTROLLER_FROM_OWN_AGENT 4 +#define FETCH_YAML_REMOTE_CONTROLLER_FROM_OWN_AGENT 5 +#define FETCH_YAML_TUNING_CONTROLLER_FROM_OWN_AGENT 6 +#define FETCH_YAML_PICKER_CONTROLLER_FROM_OWN_AGENT 7 + +#define FETCH_YAML_SAFE_CONTROLLER_FROM_COORDINATOR 11 +#define FETCH_YAML_DEMO_CONTROLLER_FROM_COORDINATOR 12 +#define FETCH_YAML_STUDENT_CONTROLLER_FROM_COORDINATOR 13 +#define FETCH_YAML_MPC_CONTROLLER_FROM_COORDINATOR 14 +#define FETCH_YAML_REMOTE_CONTROLLER_FROM_COORDINATOR 15 +#define FETCH_YAML_TUNING_CONTROLLER_FROM_COORDINATOR 16 +#define FETCH_YAML_PICKER_CONTROLLER_FROM_COORDINATOR 17 \ No newline at end of file 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 index fbfd8c7136fc4a76228581b1e125fc0d25afc475..98ce01042b51908d1b86bbe7a8785cf08c51afa2 100644 --- 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 @@ -26,6 +26,11 @@ // SPECIFY THE PACKAGE NAMESPACE //using namespace d_fall_pps; + +#else +// Include the shared definitions +#include "include/Constants_for_Qt_compile.h" + #endif // BATTERY LABEL IMAGE INDEX diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h index f80eb8ba8feaca692c1298a86665c768015e5f19..f8e8b749958bd9dbf1e7fcff9017ecfd3844e4ac 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/coordinatorrow.h @@ -58,6 +58,11 @@ // SPECIFY THE PACKAGE NAMESPACE using namespace d_fall_pps; + +#else +// Include the shared definitions +#include "include/Constants_for_Qt_compile.h" + #endif // BATTERY LABEL IMAGE INDEX diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h index b42d1186f727df998d345dd45b2b2c83f58fcc04..5c239d184998b27daf54233c55b1b87adb754110 100644 --- a/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/flyingAgentGUI/include/enablecontrollerloadyamlbar.h @@ -25,6 +25,11 @@ #include "nodes/Constants.h" // using namespace d_fall_pps; + +#else +// Include the shared definitions +#include "include/Constants_for_Qt_compile.h" + #endif 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 index c9f071fa0ae89a3eaa73b97dc4fbbf01389c4c1f..baeea54bab1b3b5c6633d171e6863ebd6130e768 100644 --- 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 @@ -56,6 +56,10 @@ using namespace d_fall_pps; //using namespace std; +#else +// Include the shared definitions +#include "include/Constants_for_Qt_compile.h" + #endif 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 index ab73056511d3374832b201d9b7b87854c13f714a..9f699f92d6cd051acbe0b25531d3deef21a60efa 100644 --- 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 @@ -504,20 +504,24 @@ void ConnectStartStopBar::setFlyingState(int new_flying_state) void ConnectStartStopBar::on_rf_connect_button_clicked() { +#ifdef CATKIN_MAKE d_fall_pps::IntWithHeader msg; fillIntMessageHeader(msg); msg.data = CMD_RECONNECT; this->crazyRadioCommandPublisher.publish(msg); ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Safe Controller"); +#endif } void ConnectStartStopBar::on_rf_disconnect_button_clicked() { +#ifdef CATKIN_MAKE d_fall_pps::IntWithHeader msg; fillIntMessageHeader(msg); msg.data = CMD_DISCONNECT; this->crazyRadioCommandPublisher.publish(msg); ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Safe Controller"); +#endif } void ConnectStartStopBar::on_enable_flying_button_clicked() @@ -693,4 +697,4 @@ bool ConnectStartStopBar::getTypeAndIDParameters() // Return return return_was_successful; } -#endif \ No newline at end of file +#endif