diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/remotecontrollertab.ui b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/remotecontrollertab.ui index 9c66d492b4d7d3c36650f98f0cfb76e31f94b287..221c78678dadf65f08ca1bfb44a653476eed6bbe 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/remotecontrollertab.ui +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/remotecontrollertab.ui @@ -56,7 +56,7 @@ <property name="bottomMargin"> <number>6</number> </property> - <item row="0" column="3"> + <item row="1" column="3"> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -69,21 +69,8 @@ </property> </spacer> </item> - <item row="0" column="1"> - <widget class="QPushButton" name="custom_button_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Button 2</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QPushButton" name="custom_button_3"> + <item row="1" column="2"> + <widget class="QPushButton" name="activate_button"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -91,12 +78,12 @@ </sizepolicy> </property> <property name="text"> - <string>Button 3</string> + <string>Activate</string> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QPushButton" name="custom_button_1"> + <item row="1" column="0"> + <widget class="QPushButton" name="subscribe_button"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -104,11 +91,11 @@ </sizepolicy> </property> <property name="text"> - <string>Button 1</string> + <string>Subscribe</string> </property> </widget> </item> - <item row="1" column="2"> + <item row="2" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="leftMargin"> <number>0</number> @@ -116,25 +103,9 @@ <property name="rightMargin"> <number>0</number> </property> - <item> - <widget class="QLineEdit" name="lineEdit_custom_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> </layout> </item> - <item row="1" column="1"> + <item row="2" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_3"> <property name="leftMargin"> <number>0</number> @@ -142,25 +113,9 @@ <property name="rightMargin"> <number>0</number> </property> - <item> - <widget class="QLineEdit" name="lineEdit_custom_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> </layout> </item> - <item row="1" column="0"> + <item row="2" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_4"> <property name="leftMargin"> <number>0</number> @@ -169,7 +124,7 @@ <number>0</number> </property> <item> - <widget class="QLineEdit" name="lineEdit_custom_1"> + <widget class="QLineEdit" name="remote_object_name"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -186,6 +141,42 @@ </item> </layout> </item> + <item row="0" column="0"> + <widget class="QPushButton" name="unsubscribe_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Unsubscribe</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="deactivate_button"> + <property name="text"> + <string>Deactivate</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </item> <item row="1" column="0"> @@ -197,7 +188,88 @@ </item> <item row="0" column="0"> <layout class="QGridLayout" name="gridLayout"> - <item row="3" column="3"> + <item row="1" column="3"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Setpoint</string> + </property> + </widget> + </item> + <item row="7" column="5"> + <widget class="QPushButton" name="default_setpoint_button"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="text"> + <string>Default</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QFrame" name="red_frame_position_left"> + <property name="maximumSize"> + <size> + <width>10</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:red;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_measured_title_line2"> + <property name="text"> + <string>Position</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="red_frame_position_right"> + <property name="maximumSize"> + <size> + <width>10</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:red;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="5"> <widget class="QLineEdit" name="lineEdit_setpoint_new_y"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -224,7 +296,7 @@ </property> </widget> </item> - <item row="1" column="3"> + <item row="1" column="5"> <widget class="QLabel" name="label_new_title_line2"> <property name="text"> <string>Setpoint</string> @@ -234,7 +306,7 @@ </property> </widget> </item> - <item row="5" column="2"> + <item row="5" column="4"> <widget class="QLineEdit" name="lineEdit_setpoint_current_yaw"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -274,7 +346,7 @@ </property> </widget> </item> - <item row="0" column="3"> + <item row="0" column="5"> <widget class="QLabel" name="label_new_title"> <property name="font"> <font> @@ -290,7 +362,7 @@ </property> </widget> </item> - <item row="0" column="4"> + <item row="0" column="6"> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -303,7 +375,7 @@ </property> </spacer> </item> - <item row="3" column="2"> + <item row="3" column="4"> <widget class="QLineEdit" name="lineEdit_setpoint_current_y"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -349,7 +421,7 @@ </property> </widget> </item> - <item row="4" column="3"> + <item row="4" column="5"> <widget class="QLineEdit" name="lineEdit_setpoint_new_z"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -376,7 +448,7 @@ </property> </widget> </item> - <item row="4" column="2"> + <item row="4" column="4"> <widget class="QLineEdit" name="lineEdit_setpoint_current_z"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -416,61 +488,6 @@ </property> </widget> </item> - <item row="1" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <property name="spacing"> - <number>0</number> - </property> - <item> - <widget class="QFrame" name="red_frame_position_left"> - <property name="maximumSize"> - <size> - <width>10</width> - <height>16777215</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background-color:red;</string> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_measured_title_line2"> - <property name="text"> - <string>Position</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QFrame" name="red_frame_position_right"> - <property name="maximumSize"> - <size> - <width>10</width> - <height>16777215</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background-color:red;</string> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - </widget> - </item> - </layout> - </item> <item row="4" column="1"> <widget class="QLabel" name="label_row_z"> <property name="text"> @@ -481,7 +498,7 @@ </property> </widget> </item> - <item row="2" column="2"> + <item row="2" column="4"> <widget class="QLineEdit" name="lineEdit_setpoint_current_x"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -511,7 +528,7 @@ </property> </widget> </item> - <item row="5" column="3"> + <item row="5" column="5"> <widget class="QLineEdit" name="lineEdit_setpoint_new_yaw"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -548,7 +565,7 @@ </property> </widget> </item> - <item row="6" column="3"> + <item row="6" column="5"> <widget class="QPushButton" name="set_setpoint_button"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -567,7 +584,7 @@ </property> </widget> </item> - <item row="0" column="2"> + <item row="0" column="4"> <widget class="QLabel" name="label_current_title"> <property name="font"> <font> @@ -593,7 +610,7 @@ </property> </widget> </item> - <item row="2" column="3"> + <item row="2" column="5"> <widget class="QLineEdit" name="lineEdit_setpoint_new_x"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> @@ -620,7 +637,7 @@ </property> </widget> </item> - <item row="1" column="2"> + <item row="1" column="4"> <widget class="QLabel" name="label_current_title_line2"> <property name="text"> <string>Setpoint</string> @@ -630,25 +647,6 @@ </property> </widget> </item> - <item row="6" column="2"> - <widget class="QPushButton" name="default_setpoint_button"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>180</width> - <height>60</height> - </size> - </property> - <property name="text"> - <string>Default</string> - </property> - </widget> - </item> <item row="7" column="1"> <widget class="QLabel" name="label_row_roll"> <property name="text"> @@ -863,6 +861,280 @@ </item> </layout> </item> + <item row="0" column="3"> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Remote</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QLineEdit" name="remote_setpoint_z"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="3"> + <widget class="QLineEdit" name="remote_setpoint_yaw"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="6" column="3"> + <widget class="QLineEdit" name="remote_setpoint_pitch"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QFrame" name="red_frame_remote"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:red;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item row="7" column="3"> + <widget class="QLineEdit" name="remote_setpoint_roll"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_3"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Measured</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Remote</string> + </property> + </widget> + </item> + <item row="7" column="2"> + <widget class="QLineEdit" name="remote_data_roll"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QLineEdit" name="remote_data_pitch"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QLineEdit" name="remote_data_yaw"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLineEdit" name="remote_data_z"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>180</width> + <height>60</height> + </size> + </property> + <property name="font"> + <font> + <family>Courier</family> + </font> + </property> + <property name="text"> + <string>xx.xx</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> </layout> </item> </layout> diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/remotecontrollertab.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/remotecontrollertab.h index 831aef9a7ecf35a0e98d37c372827cb27ddc105b..686b250bf9369825a0fff7141f0475c5c461cbc7 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/remotecontrollertab.h +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/remotecontrollertab.h @@ -115,10 +115,10 @@ private slots: // COPIED FROM PREVIOUS REMOTE CONTROLLER GUI -// void on_subscribe_button_clicked(); -// void on_unsubscribe_button_clicked(); -// void on_activate_button_clicked(); -// void on_deactivate_button_clicked(); + void on_subscribe_button_clicked(); + void on_unsubscribe_button_clicked(); + void on_activate_button_clicked(); + void on_deactivate_button_clicked(); diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/remotecontrollertab.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/remotecontrollertab.cpp index d0e0060a5400873da3b127ff5a1cf06718d6ea64..b4dc5ecf60259e0a9be8cffe732188ef9516dfa9 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/remotecontrollertab.cpp +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/remotecontrollertab.cpp @@ -47,6 +47,10 @@ RemoteControllerTab::RemoteControllerTab(QWidget *parent) : ui->red_frame_position_left->setVisible(false); ui->red_frame_position_right->setVisible(false); + ui->red_frame_remote->setVisible(false); + + ui->remote_object_name->setText("DFALL_REMOTE01"); + #ifdef CATKIN_MAKE @@ -151,57 +155,70 @@ RemoteControllerTab::~RemoteControllerTab() // COPIED FROM PREVIOUS REMOTE CONTROLLER GUI // # Custom buttons for the REMOTE controller service -//void RemoteControllerTab::on_remote_subscribe_button_clicked() -//{ -// // Initialise the message -// ViconSubscribeObjectName msg; -// // Set the subscribe flag -// msg.shouldSubscribe = true; -// // Set the object name -// msg.objectName = (ui->remote_object_name->text()).toUtf8().constData(); -// // Publish the message -// this->remoteSubscribePublisher.publish(msg); -//} - -//void RemoteControllerTab::on_remote_unsubscribe_button_clicked() -//{ -// // Initialise the message -// ViconSubscribeObjectName msg; -// // Set the subscribe flag -// msg.shouldSubscribe = false; -// // Set the object name -// msg.objectName = (ui->remote_object_name->text()).toUtf8().constData(); -// // Publish the message -// this->remoteSubscribePublisher.publish(msg); -//} - -//void RemoteControllerTab::on_remote_activate_button_clicked() -//{ -// // Initialise the message -// std_msgs::Int32 msg; -// // Set the msg data -// msg.data = 1; -// // Publish the message -// this->remoteActivatePublisher.publish(msg); -//} - -//void RemoteControllerTab::on_remote_deactivate_button_clicked() -//{ -// // Initialise the message -// std_msgs::Int32 msg; -// // Set the msg data -// msg.data = 0; -// // Publish the message -// this->remoteActivatePublisher.publish(msg); -//} +void RemoteControllerTab::on_subscribe_button_clicked() +{ +#ifdef CATKIN_MAKE + // Initialise the message + dfall_pkg::ViconSubscribeObjectName msg; + // Set the subscribe flag + msg.shouldSubscribe = true; + // Set the object name + msg.objectName = (ui->remote_object_name->text()).toUtf8().constData(); + // Publish the message + this->remoteSubscribePublisher.publish(msg); +#endif +} + +void RemoteControllerTab::on_unsubscribe_button_clicked() +{ +#ifdef CATKIN_MAKE + // Initialise the message + dfall_pkg::ViconSubscribeObjectName msg; + // Set the subscribe flag + msg.shouldSubscribe = false; + // Set the object name + msg.objectName = (ui->remote_object_name->text()).toUtf8().constData(); + // Publish the message + this->remoteSubscribePublisher.publish(msg); +#endif +} + +void RemoteControllerTab::on_activate_button_clicked() +{ +#ifdef CATKIN_MAKE + // Initialise the message + std_msgs::Int32 msg; + // Set the msg data + msg.data = 1; + // Publish the message + this->remoteActivatePublisher.publish(msg); +#endif +} + +void RemoteControllerTab::on_deactivate_button_clicked() +{ +#ifdef CATKIN_MAKE + // Initialise the message + std_msgs::Int32 msg; + // Set the msg data + msg.data = 0; + // Publish the message + this->remoteActivatePublisher.publish(msg); +#endif +} #ifdef CATKIN_MAKE void RemoteControllerTab::remoteDataCallback(const dfall_pkg::CrazyflieData& objectData) { -// // Check if the object is occluded -// if (objectData.occluded) -// { + // Check if the object is occluded + if (objectData.occluded) + { + + // Make visible the red frames to indicate occluded + if ( !(ui->red_frame_remote->isVisible()) ) + ui->red_frame_remote->setVisible(true); + // // Set the column heading label to have a red background // // > IMPORTANT: Set the background auto fill property to true // ui->remote_data_label->setAutoFillBackground(true); @@ -211,14 +228,19 @@ void RemoteControllerTab::remoteDataCallback(const dfall_pkg::CrazyflieData& obj // pal.setColor(QPalette::Window, QColor(Qt::red)); // // > Update the palette for the label // ui->remote_data_label->setPalette(pal); -// } -// else -// { -// // Put the roll, pitch, yaw, and z data into the appropriate fields -// ui->remote_data_roll ->setText(QString::number( objectData.roll * RAD2DEG, 'f', 1)); -// ui->remote_data_pitch->setText(QString::number( objectData.pitch * RAD2DEG, 'f', 1)); -// ui->remote_data_yaw ->setText(QString::number( objectData.yaw * RAD2DEG, 'f', 1)); -// ui->remote_data_z ->setText(QString::number( objectData.z, 'f', 2)); + } + else + { + // Put the roll, pitch, yaw, and z data into the appropriate fields + ui->remote_data_roll ->setText(QString::number( objectData.roll * RAD2DEG, 'f', 1)); + ui->remote_data_pitch->setText(QString::number( objectData.pitch * RAD2DEG, 'f', 1)); + ui->remote_data_yaw ->setText(QString::number( objectData.yaw * RAD2DEG, 'f', 1)); + ui->remote_data_z ->setText(QString::number( objectData.z, 'f', 2)); + + + // Ensure the red frames are not visible + if ( ui->red_frame_remote->isVisible() ) + ui->red_frame_remote->setVisible(false); // // Set the column heading label to have a "normal" background // // > IMPORTANT: Set the background auto fill property to true @@ -227,7 +249,7 @@ void RemoteControllerTab::remoteDataCallback(const dfall_pkg::CrazyflieData& obj // QPalette pal = ui->remote_roll_label->palette(); // // > Update the palette for the column heading label // ui->remote_data_label->setPalette(pal); -// } + } } #endif @@ -235,10 +257,10 @@ void RemoteControllerTab::remoteDataCallback(const dfall_pkg::CrazyflieData& obj #ifdef CATKIN_MAKE void RemoteControllerTab::remoteControlSetpointCallback(const dfall_pkg::CrazyflieData& setpointData) { -// ui->remote_setpoint_roll ->setText(QString::number( setpointData.roll * RAD2DEG, 'f', 1)); -// ui->remote_setpoint_pitch->setText(QString::number( setpointData.pitch * RAD2DEG, 'f', 1)); -// ui->remote_setpoint_yaw ->setText(QString::number( setpointData.yaw * RAD2DEG, 'f', 1)); -// ui->remote_setpoint_z ->setText(QString::number( setpointData.z, 'f', 2)); + ui->remote_setpoint_roll ->setText(QString::number( setpointData.roll * RAD2DEG, 'f', 1)); + ui->remote_setpoint_pitch->setText(QString::number( setpointData.pitch * RAD2DEG, 'f', 1)); + ui->remote_setpoint_yaw ->setText(QString::number( setpointData.yaw * RAD2DEG, 'f', 1)); + ui->remote_setpoint_z ->setText(QString::number( setpointData.z, 'f', 2)); } #endif @@ -277,21 +299,21 @@ void RemoteControllerTab::publish_custom_button_command(int button_index , QLine void RemoteControllerTab::on_custom_button_1_clicked() { #ifdef CATKIN_MAKE - publish_custom_button_command(1,ui->lineEdit_custom_1); + //publish_custom_button_command(1,ui->lineEdit_custom_1); #endif } void RemoteControllerTab::on_custom_button_2_clicked() { #ifdef CATKIN_MAKE - publish_custom_button_command(2,ui->lineEdit_custom_2); + //publish_custom_button_command(2,ui->lineEdit_custom_2); #endif } void RemoteControllerTab::on_custom_button_3_clicked() { #ifdef CATKIN_MAKE - publish_custom_button_command(3,ui->lineEdit_custom_3); + //publish_custom_button_command(3,ui->lineEdit_custom_3); #endif }