diff --git a/pps_ws/src/d_fall_pps/CMakeLists.txt b/pps_ws/src/d_fall_pps/CMakeLists.txt index c3232780433151e3bfd1c33b1aaf9e9fb501165f..5aa50bc4856fa4dab2fffd64ce14337e8eedbc44 100755 --- a/pps_ws/src/d_fall_pps/CMakeLists.txt +++ b/pps_ws/src/d_fall_pps/CMakeLists.txt @@ -237,6 +237,7 @@ set(MY_CPP_SOURCES # compilation of sources ${MY_LIB_PATH_SRC}/rosNodeThread.cpp ${MY_LIB_PATH_SRC}/crazyFly.cpp ${MY_LIB_PATH_SRC}/CFLinker.cpp + ${MY_LIB_PATH_SRC}/addressLUT.cpp ) diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/CrazyFlyGUI.pro.user b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/CrazyFlyGUI.pro.user index 9fc84e79a3ebadc9c491925d7a896051d5374fe9..ebe2fd318daacb38ff1ff2efeefde05df86d619b 100755 --- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/CrazyFlyGUI.pro.user +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/CrazyFlyGUI.pro.user @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 4.0.2, 2017-05-26T12:05:49. --> +<!-- Written by QtCreator 4.0.2, 2017-08-15T15:30:19. --> <qtcreator> <data> <variable>EnvironmentId</variable> diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/addressLUT.h b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/addressLUT.h new file mode 100644 index 0000000000000000000000000000000000000000..ac92f8715c3d6b34d2008604190ce6e2ccefea42 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/addressLUT.h @@ -0,0 +1,10 @@ +#ifndef ADDRESSLUT_H +#define ADDRESSLUT_H + +#include <string> +#include <map> + + +extern std::map<std::string, std::string> address_LUT; + +#endif diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/mainguiwindow.h b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/mainguiwindow.h index 4606b0ce8784d98719572df1dff92a0f58530083..b0914b963bdbbedf52f0f1610659e1c6f59b3a22 100755 --- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/mainguiwindow.h +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/include/mainguiwindow.h @@ -128,6 +128,8 @@ private slots: void setTabIndex(int index); void doTabClosed(int tab_index); + void on_comboBoxCFs_currentTextChanged(const QString &arg1); + private: Ui::MainGUIWindow *ui; diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/addressLUT.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/addressLUT.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6210de02b031a960f34a4e5ae139e20ef3ff79a3 --- /dev/null +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/addressLUT.cpp @@ -0,0 +1,9 @@ +#include "addressLUT.h" + + +std::map<std::string, std::string> address_LUT +{ + {"CF1", "A12D2"}, + {"CF2", "E341E"}, + {"CF3", "4E21A"}, +}; diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp index 0821c00161ccfa50a3956d041232e0fa5428af34..606e543242b472c0e424a4f9c8bc4bde85afc8cd 100755 --- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp @@ -3,6 +3,7 @@ #include "crazyFlyZoneTab.h" #include "myGraphicsScene.h" #include "myGraphicsView.h" +#include "addressLUT.h" #include <QObject> #include <QDoubleSpinBox> @@ -124,6 +125,13 @@ void MainGUIWindow::_init() // ui->err_message_cf_zone->hide(); // ui->err_message_student_id->hide(); + ui->radioAddress_text->setReadOnly(true); + + QPalette *palette = new QPalette(); + palette->setColor(QPalette::Base,Qt::lightGray); + palette->setColor(QPalette::Text,Qt::darkGray); + ui->radioAddress_text->setPalette(*palette); + ui->err_message_cf->setStyleSheet("QLabel { color : red; }"); ui->err_message_cf_zone->setStyleSheet("QLabel { color : red; }"); ui->err_message_student_id->setStyleSheet("QLabel { color : red; }"); @@ -872,3 +880,19 @@ void MainGUIWindow::on_load_from_DB_button_clicked() ROS_ERROR("Failed to read DB"); } } + +void MainGUIWindow::on_comboBoxCFs_currentTextChanged(const QString &arg1) +{ + std::string key = arg1.toStdString(); + auto it = address_LUT.find(key); + if(it != address_LUT.end()) + { + std::string found = it->second; + QString found_qstr = QString::fromStdString(found); + ui->radioAddress_text->setText(found_qstr); + } + else + { + ROS_INFO("name not found in LUT"); + } +} diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui index c3bfaa5bcee255e6de99190411362e4bdab153ff..13c41f36f05c8e9ea8d7472064f0d81367e5a6fd 100755 --- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.ui @@ -422,7 +422,14 @@ </widget> </item> <item row="10" column="6"> - <widget class="QLineEdit" name="radioAddress_text"/> + <widget class="QLineEdit" name="radioAddress_text"> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="clearButtonEnabled"> + <bool>false</bool> + </property> + </widget> </item> <item row="11" column="6"> <widget class="QLabel" name="err_message_radio_address"> diff --git a/pps_ws/src/d_fall_pps/param/Crazyflie.db b/pps_ws/src/d_fall_pps/param/Crazyflie.db index 454f843a71d648b94b8dd6671c738a636974775e..2c6f791e7c89155cf4035ced199a06a8c8a0580f 100644 --- a/pps_ws/src/d_fall_pps/param/Crazyflie.db +++ b/pps_ws/src/d_fall_pps/param/Crazyflie.db @@ -1,2 +1,3 @@ -2,CF1,1,0,0.52,0.41,-0.2,1.56,1.55,2 -1,CF2,2,1,-1.62398,-1.65338,-0.2,1.70872,0.674222,2 +1,CF1,A12D2,0,0.180387,0.712283,-0.2,1.77763,1.34043,2 +2,CF2,E341E,1,-0.628728,-0.48753,-0.2,0.971272,0.52247,2 +3,CF3,4E21A,2,0.425248,-1.49146,-0.2,1.66704,-0.577371,2