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

Added GUI DroneX Tab

Added necessary files for DroneX Controller
parent 63e4a175
Pipeline #7518 failed with stages
in 26 seconds
// 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);
......
......@@ -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/>.
//
//
//
// ----------------------------------------------------------------------------------
// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M
......@@ -307,6 +307,10 @@ void viconCallback(const ViconData& viconData)
case PICKER_CONTROLLER:
success = pickerController.call(controllerCall);
break;
//TODO
case DRONEX_CONTROLLER:
success = droneXController.call(controllerCall);
break;
default:
ROS_ERROR("[PPS CLIENT] the current controller was not recognised");
break;
......@@ -326,7 +330,7 @@ void viconCallback(const ViconData& viconData)
ROS_INFO_STREAM("[PPS CLIENT] safety check failed, switching to safe controller");
}
}
// SAFE_CONTROLLER and state is different from flying
else
......@@ -473,6 +477,11 @@ void commandCallback(const std_msgs::Int32& commandMsg) {
setControllerUsed(PICKER_CONTROLLER);
break;
//TODO
case CMD_USE_DRONEX_CONTROLLER:
ROS_INFO("[PPS CLIENT] USE_DRONEX_CONTROLLER Command received");
setControllerUsed(DRONEX_CONTROLLER);
break;
case CMD_CRAZYFLY_TAKE_OFF:
if(flying_state == STATE_MOTORS_OFF)
{
......@@ -564,7 +573,7 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
// Switch between fetching for the different controllers and from different locations
switch(controller_to_fetch_yaml)
{
// > FOR FETCHING FROM THE AGENT'S OWN PARAMETER SERVICE
case FETCH_YAML_SAFE_CONTROLLER_FROM_OWN_AGENT:
{
......@@ -763,7 +772,7 @@ void CFBatteryCallback(const std_msgs::Float32& msg)
setBatteryStateTo(BATTERY_STATE_LOW);
ROS_INFO("[PPS CLIENT] low level battery triggered");
}
}
else
{
......@@ -895,6 +904,22 @@ void loadPickerController()
ROS_INFO_STREAM("[PPS CLIENT] Loaded picker controller " << pickerController.getService());
}
// TODO
void loadDroneXController(){
ros::NodeHandle nodeHandle("~");
std::string droneXControllerName;
if(!nodeHandle.getParam("droneXController", droneXControllerName))
{
ROS_ERROR("[PPS CLIENT] Failed to get droneX controller name");
return;
}
droneXController = ros::service::createClient<Controller>(droneXControllerName, true);
ROS_INFO_STREAM("[PPS CLIENT] Loaded droneX controller " << droneXController.getService());
}
void sendMessageUsingController(int controller)
{
// send a message in topic for the studentGUI to read it
......@@ -929,6 +954,8 @@ void setInstantController(int controller) //for right now, temporal use
case PICKER_CONTROLLER:
loadPickerController();
break;
case DRONEX_CONTROLLER:
loadDroneXController();
default:
break;
}
......@@ -1106,7 +1133,7 @@ int main(int argc, char* argv[])
ros::Subscriber CFBatterySubscriber = namespaceNodeHandle.subscribe("CrazyRadio/CFBattery", 1, CFBatteryCallback);
// INITIALISE THE BATTERY VOLTAGE TO SOMETHING CLOSE TO FULL
// > This is used to prevent the "Low Battery" being trigged when the
// > This is used to prevent the "Low Battery" being trigged when the
// first battery voltage data is received
m_battery_voltage = 4.2f;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment