To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 3cdac115 authored by pragash1's avatar pragash1
Browse files

Added GUI DroneX Tab

Added necessary files for DroneX Controller
parent 63e4a175
// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat, Angel Romero
//
// 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
......@@ -55,6 +55,7 @@
#define REMOTE_CONTROLLER 5
#define TUNING_CONTROLLER 6
#define PICKER_CONTROLLER 7
#define DRONEX_CONTROLLER 8
// Commands for CrazyRadio
......@@ -77,6 +78,7 @@
#define CMD_USE_REMOTE_CONTROLLER 5
#define CMD_USE_TUNING_CONTROLLER 6
#define CMD_USE_PICKER_CONTROLLER 7
#define CMD_USE_DRONEX_CONTROLLER 8
#define CMD_CRAZYFLY_TAKE_OFF 11
#define CMD_CRAZYFLY_LAND 12
......@@ -109,6 +111,7 @@
#define LOAD_YAML_REMOTE_CONTROLLER_AGENT 5
#define LOAD_YAML_TUNING_CONTROLLER_AGENT 6
#define LOAD_YAML_PICKER_CONTROLLER_AGENT 7
#define LOAD_YAML_DRONEX_CONTROLLER_AGENT 8
#define LOAD_YAML_SAFE_CONTROLLER_COORDINATOR 11
#define LOAD_YAML_DEMO_CONTROLLER_COORDINATOR 12
......@@ -117,6 +120,8 @@
#define LOAD_YAML_REMOTE_CONTROLLER_COORDINATOR 15
#define LOAD_YAML_TUNING_CONTROLLER_COORDINATOR 16
#define LOAD_YAML_PICKER_CONTROLLER_COORDINATOR 17
#define LOAD_YAML_DRONEX_CONTROLLER_COORDINATOR 18
// FOR WHICH BUTTON WAS PRESSED IN THE PICKER CONTOLLER
......@@ -188,7 +193,7 @@ private slots:
void on_enable_tuning_controller_clicked();
void on_enable_picker_controller_clicked();
void on_demoButton_1_clicked();
void on_demoButton_2_clicked();
......@@ -235,6 +240,11 @@ private slots:
// > For the dial
void on_picker_yaw_dial_valueChanged(int value);
// Interationswith the DroneX controller tab
void on_dronex_take_off_button_clicked();
void on_dronex_land_button_clicked();
......@@ -322,6 +332,10 @@ private:
ros::Publisher tuningVerticalGainPublisher;
ros::Publisher tuningHeadingGainPublisher;
// > For the DRONEX CONTROLLER
ros::Publisher droneXSetpointPublisher;
ros::Subscriber droneXSetpointSubscriber;
// > For the PICKER CONTROLLER
......@@ -370,7 +384,7 @@ private:
void studentSetpointCallback(const Setpoint& newSetpoint);
void mpcSetpointCallback(const Setpoint& newSetpoint);
void pickerSetpointCallback(const Setpoint& newSetpoint);
void remoteDataCallback(const CrazyflieData& objectData);
void remoteControlSetpointCallback(const CrazyflieData& setpointData);
......@@ -378,7 +392,7 @@ private:
// > For actually sending the button message
void send_picker_button_clicked_message(int button_index);
void DBChangedCallback(const std_msgs::Int32& msg);
......@@ -390,7 +404,7 @@ private:
void remoteYamlFileTimerCallback(const ros::TimerEvent&);
void tuningYamlFileTimerCallback(const ros::TimerEvent&);
void pickerYamlFileTimerCallback(const ros::TimerEvent&);
void requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::Int32& msg);
......
// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat, Angel Romero
//
// 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
......@@ -109,6 +109,13 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
pickerSetpointSubscriber = nodeHandle.subscribe("PickerControllerService/Setpoint", 1, &MainWindow::pickerSetpointCallback, this);
pickerSetpointToGUISubscriber = nodeHandle.subscribe("PickerControllerService/SetpointToGUI", 1, &MainWindow::pickerSetpointCallback, this);
//TODO add Publisher and Subscriber for DroneX
// SET ALL SLIDERS AND DIALS TO DEFAULT VALUES
ui->picker_z_slider->setValue( 40 );
ui->picker_mass_slider->setValue( 29 );
......@@ -141,7 +148,7 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
//ros::NodeHandle nh_PPSClient(m_ros_namespace + "/PPSClient");
ros::NodeHandle nh_PPSClient("PPSClient");
crazyRadioCommandPublisher = nh_PPSClient.advertise<std_msgs::Int32>("crazyRadioCommand", 1);
PPSClientCommandPublisher = nh_PPSClient.advertise<std_msgs::Int32>("Command", 1);
PPSClientCommandPublisher = nh_PPSClient.advertise<std_msgs::Int32>("Command", 1);
// > For publishing a message that requests the
......@@ -231,6 +238,8 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
initialize_student_setpoint();
initialize_mpc_setpoint();
initialize_picker_setpoint();
//TODO add initialize_dronex_setpoint();
}
......@@ -265,6 +274,7 @@ void MainWindow::highlightSafeControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightPickerControllerTab()
{
......@@ -275,6 +285,7 @@ void MainWindow::highlightPickerControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightDemoControllerTab()
{
......@@ -285,6 +296,7 @@ void MainWindow::highlightDemoControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightStudentControllerTab()
{
......@@ -295,6 +307,7 @@ void MainWindow::highlightStudentControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightMpcControllerTab()
{
......@@ -305,6 +318,7 @@ void MainWindow::highlightMpcControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::green);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightRemoteControllerTab()
{
......@@ -315,6 +329,7 @@ void MainWindow::highlightRemoteControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::green);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightTuningControllerTab()
{
......@@ -325,8 +340,19 @@ void MainWindow::highlightTuningControllerTab()
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::green);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::black);
}
void MainWindow::highlightDroneXControllerTab()
{
ui->tabWidget->tabBar()->setTabTextColor(0, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(1, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(2, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(3, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(4, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(5, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(6, Qt::black);
ui->tabWidget->tabBar()->setTabTextColor(7, Qt::green);
}
void MainWindow::DBChangedCallback(const std_msgs::Int32& msg)
{
......@@ -359,6 +385,8 @@ void MainWindow::controllerUsedChangedCallback(const std_msgs::Int32& msg)
case PICKER_CONTROLLER:
highlightPickerControllerTab();
break;
case DRONEX_CONTROLLER:
highlightDroneXControllerTab();
default:
break;
}
......@@ -410,7 +438,7 @@ void MainWindow::pickerSetpointCallback(const Setpoint& newSetpoint)
// here we get the new setpoint, need to update it in GUI
ui->picker_z_slider->setValue( int(newSetpoint.z*100.0) );
ui->picker_yaw_dial->setValue( int(newSetpoint.yaw * RAD2DEG) );
}
void MainWindow::flyingStateChangedCallback(const std_msgs::Int32& msg)
......@@ -1180,7 +1208,7 @@ void MainWindow::on_load_student_yaml_button_clicked()
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
ros::NodeHandle nodeHandle("~");
m_timer_yaml_file_for_student_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::studentYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_student_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::studentYamlFileTimerCallback, this, true);
}
void MainWindow::studentYamlFileTimerCallback(const ros::TimerEvent&)
......@@ -1349,7 +1377,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_demo_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::demoYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_demo_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::demoYamlFileTimerCallback, this, true);
break;
......@@ -1364,7 +1392,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_student_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::studentYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_student_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::studentYamlFileTimerCallback, this, true);
break;
......@@ -1379,7 +1407,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_mpc_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::mpcYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_mpc_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::mpcYamlFileTimerCallback, this, true);
break;
......@@ -1394,7 +1422,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_remote_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::remoteYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_remote_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::remoteYamlFileTimerCallback, this, true);
break;
......@@ -1409,7 +1437,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_tuning_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::tuningYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_tuning_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::tuningYamlFileTimerCallback, this, true);
break;
......@@ -1424,7 +1452,7 @@ void MainWindow::requestLoadControllerYaml_from_my_GUI_Callback(const std_msgs::
// to the local variable of the agent.
// > Thus we use this timer to prevent the user from clicking the
// button in the GUI repeatedly.
m_timer_yaml_file_for_picker_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::pickerYamlFileTimerCallback, this, true);
m_timer_yaml_file_for_picker_controller = nodeHandle.createTimer(ros::Duration(1.5), &MainWindow::pickerYamlFileTimerCallback, this, true);
break;
......@@ -1490,6 +1518,26 @@ void MainWindow::on_enable_picker_controller_clicked()
// TODO
// # Custom command buttons - FOR DRONEX CONTROLLER
void MainWindow::on_dronex_take_off_button_clicked(){
ROS_INFO("DroneX: Take off from DroneX! - Please upgrade my function in MainWindow.cpp!!!!!!!!!!!!!!!!!!!");
}
void MainWindow::on_dronex_land_button_clicked(){
ROS_INFO("DroneX: Land on DroneX - Please upgrade my function in MainWindow.cpp!!!!!!!!!!!!!!!!!!!");
}
// # Custom command buttons - FOR DEMO CONTROLLER
void MainWindow::on_demoButton_1_clicked()
{
......@@ -1910,6 +1958,3 @@ void MainWindow::on_picker_yaw_dial_valueChanged(int value)
// Publish the message
this->pickerYawSetpointPublisher.publish(msg);
}
......@@ -391,7 +391,7 @@
</font>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -399,6 +399,35 @@
<property name="tabsClosable">
<bool>false</bool>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Page</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_21">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QPushButton" name="take_off_mothership_button">
<property name="text">
<string>Take off from Mothership</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="land_on_mothership_button">
<property name="text">
<string>Land on Mothership</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_safe">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
......@@ -4006,6 +4035,48 @@
<property name="bottomMargin">
<number>6</number>
</property>
<item row="1" column="2">
<widget class="QLabel" name="label_22">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<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="1" column="1">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="Line" name="line_20">
<property name="orientation">
......@@ -4418,41 +4489,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_22">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<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="5" column="1">
<widget class="Line" name="line_4">
<property name="orientation">
......@@ -4467,13 +4503,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="Line" name="line_5">
<property name="orientation">
......@@ -4659,7 +4688,7 @@
<x>0</x>
<y>0</y>
<width>1500</width>
<height>25</height>
<height>22</height>
</rect>
</property>
</widget>
......
// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat, Angel Romero, Cyrill Burgener, Marco Mueller, Philipp Friedli
//
// 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
......@@ -90,6 +90,7 @@
#define REMOTE_CONTROLLER 5
#define TUNING_CONTROLLER 6
#define PICKER_CONTROLLER 7
#define DRONEX_CONTROLLER 8
// The constants that "command" changes in the
// operation state of this agent
......@@ -100,6 +101,7 @@
#define CMD_USE_REMOTE_CONTROLLER 5
#define CMD_USE_TUNING_CONTROLLER 6
#define CMD_USE_PICKER_CONTROLLER 7
#define CMD_USE_DRONEX_CONTROLLER 8
#define CMD_CRAZYFLY_TAKE_OFF 11
......@@ -162,6 +164,9 @@ ros::ServiceClient remoteController;
ros::ServiceClient tuningController;
// The Picker controller specified in the ClientConfig.yaml
ros::ServiceClient pickerController;
// The DroneX controller specified in the ClientConfig.yaml
//TODO
ros::ServiceClient dronexController;
//values for safteyCheck
......@@ -308,14 +313,10 @@ void loadMpcController();
void loadRemoteController();
void loadTuningController();
void loadPickerController();
void loadDroneXController();
void sendMessageUsingController(int controller);
void setInstantController(int controller);
int getInstantController();
void setControllerUsed(int controller);
int getControllerUsed();
......@@ -5,6 +5,7 @@ mpcController: "MpcControllerService/MpcController"
remoteController: "RemoteControllerService/RemoteController"
tuningController: "TuningControllerService/TuningController"
pickerController: "PickerControllerService/PickerController"
droneXController: "DroneXControllerService/DroneXController"
strictSafety: false
angleMargin: 0.8
......@@ -12,4 +13,3 @@ angleMargin: 0.8
battery_threshold_while_flying: 2.60 # in V
battery_threshold_while_motors_off: 3.30 # in V
battery_polling_period: 200 # in ms
4,PPS_CF03,0/16/2M/E7E7E7E703,0,0.345924,-1.31629,-0.2,4.30616,1.15886,1.2
// Copyright (C) 2017, ETH Zurich, D-ITET, Paul Beuchat, Angel Romero, Cyrill Burgener, Marco Mueller, Philipp Friedli
//
// 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/>.