pull/32/head
pvqf6mep3 3 years ago
commit a1726087de

@ -132,7 +132,10 @@ set(SOURCES
src/ui/mainwindow.hpp
src/ui/mainwindow.ui
)
QT5_add_resources(qrc_Files src/resources/images.qrc)
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
@ -141,7 +144,7 @@ include_directories(
${OpenCV_INCLUDE_DIRS}
)
add_executable(Air_Ground_CEC ${SOURCES})
add_executable(Air_Ground_CEC ${SOURCES} ${qrc_Files})
target_link_libraries(Air_Ground_CEC
Qt5::Widgets
${catkin_LIBRARIES}

@ -22,3 +22,6 @@ int main(int argc, char** argv)
/*
* find . "(" -name "*.cpp" -or -name "*.h" -or -name "*.hpp" -or -name "*.qrc" ")" -print | xargs wc -l
*/

@ -9,6 +9,7 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
{
qnode.init();
ui->setupUi(this);
setBtnStates();
connections();
}
@ -52,36 +53,75 @@ void MainWindow::slot_keyboard_control(){
}
void MainWindow::setBtnStates(){
ui->pushButton_Forward->setShortcut(Qt::Key_8);
ui->pushButton_Forward->setStyleSheet(
"QPushButton{border-image: url(://images/up.png)}"
"QPushButton{border:none}"
"QPushButton:pressed{border-image: url(://images/up_2.png)}");
ui->pushButton_Forward->setFlat(true);
ui->pushButton_Back->setShortcut(Qt::Key_2);
ui->pushButton_Back->setStyleSheet(
"QPushButton{border-image: url(://images/up.png)}"
"QPushButton{border:none}"
"QPushButton:pressed{border-image: url(://images/up_2.png)}");
ui->pushButton_Back->setFlat(true);
ui->pushButton_Left->setShortcut(Qt::Key_4);
ui->pushButton_Left->setStyleSheet("border:none");
ui->pushButton_Left->setFlat(true);
ui->pushButton_Right->setShortcut(Qt::Key_6);
ui->pushButton_Right->setStyleSheet("border:none");
ui->pushButton_Right->setFlat(true);
ui->pushButton_Left_Forward->setShortcut(Qt::Key_7);
ui->pushButton_Left_Forward->setStyleSheet("border:none");
ui->pushButton_Left_Forward->setFlat(true);
ui->pushButton_Right_Forward->setShortcut(Qt::Key_9);
ui->pushButton_Right_Forward->setStyleSheet("border:none");
ui->pushButton_Right_Forward->setFlat(true);
ui->pushButton_Left_Back->setShortcut(Qt::Key_1);
ui->pushButton_Left_Back->setStyleSheet("border:none");
ui->pushButton_Left_Back->setFlat(true);
ui->pushButton_Right_Back->setShortcut(Qt::Key_3);
ui->pushButton_Right_Back->setStyleSheet("border:none");
ui->pushButton_Right_Back->setFlat(true);
}
void MainWindow::connections(){
//绑定速度控制按钮
// 8 -> Forward:↑
ui->pushButton_Forward->setShortcut(Qt::Key_8);
connect(ui->pushButton_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Back->setShortcut(Qt::Key_2);
connect(ui->pushButton_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Left->setShortcut(Qt::Key_4);
connect(ui->pushButton_Left, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Right->setShortcut(Qt::Key_6);
connect(ui->pushButton_Right, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Left_Forward->setShortcut(Qt::Key_7);
connect(ui->pushButton_Left_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Right_Forward->setShortcut(Qt::Key_9);
connect(ui->pushButton_Right_Forward, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Left_Back->setShortcut(Qt::Key_1);
connect(ui->pushButton_Left_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_Right_Back->setShortcut(Qt::Key_3);
connect(ui->pushButton_Right_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
connect(ui->pushButton_Right_Back, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
ui->pushButton_shift->setShortcut(Qt::ShiftModifier);
connect(ui->pushButton_shift, SIGNAL(clicked()), this, SLOT(slot_keyboard_control()));
//绑定slider的函数
connect(ui->horizontalSlider_raw, SIGNAL(valueChanged(int)), this,

@ -0,0 +1,20 @@
<RCC>
<qresource prefix="/">
<file>images/down.png</file>
<file>images/down_2.png</file>
<file>images/down_left.png</file>
<file>images/down_left_2.png</file>
<file>images/down_right.png</file>
<file>images/down_right_2.png</file>
<file>images/left.png</file>
<file>images/left_2.png</file>
<file>images/right.png</file>
<file>images/right_2.png</file>
<file>images/up.png</file>
<file>images/up_2.png</file>
<file>images/up_left.png</file>
<file>images/up_left_2.png</file>
<file>images/up_right.png</file>
<file>images/up_right_2.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -20,6 +20,8 @@ public:
explicit MainWindow(int argc, char **argv, QWidget *parent = 0);
~MainWindow();
public slots:
void slot_keyboard_control();
//void slot_command_control(int linear, int angular);
@ -30,6 +32,7 @@ public slots:
private:
Ui::MainWindow *ui;
void setBtnStates();
void connections();
QNode qnode;

@ -6,140 +6,41 @@
<rect>
<x>0</x>
<y>0</y>
<width>1600</width>
<height>900</height>
<width>1440</width>
<height>810</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>502</width>
<height>654</height>
<x>510</x>
<y>40</y>
<width>446</width>
<height>543</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="UAV_Vedio">
<property name="minimumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>UAV_VEDIO</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="UAV_Path">
<property name="minimumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="text">
<string>PATH</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton_shift">
<property name="geometry">
<rect>
<x>760</x>
<y>70</y>
<width>100</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>加速</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>1020</x>
<y>271</y>
<width>316</width>
<height>172</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_Forward">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pushButton_Left_Forward">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -148,22 +49,22 @@
</font>
</property>
<property name="text">
<string></string>
<string></string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_Right">
<item>
<widget class="QPushButton" name="pushButton_Forward">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -171,23 +72,26 @@
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{border-image: url(://images/up.png);}</string>
</property>
<property name="text">
<string>→</string>
<string></string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_Left">
<item>
<widget class="QPushButton" name="pushButton_Right_Forward">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -196,22 +100,26 @@
</font>
</property>
<property name="text">
<string></string>
<string></string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButton_Back">
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QPushButton" name="pushButton_Left">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -220,46 +128,44 @@
</font>
</property>
<property name="text">
<string></string>
<string></string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Left_Forward">
<item>
<widget class="QCheckBox" name="checkBox_use_all">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>90</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>90</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>↖</string>
<string>全向模式k</string>
</property>
<property name="shortcut">
<string>K</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Right_Forward">
<item>
<widget class="QPushButton" name="pushButton_Right">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -267,23 +173,30 @@
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>↗</string>
<string></string>
</property>
</widget>
</item>
<item row="2" column="0">
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QPushButton" name="pushButton_Left_Back">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -296,18 +209,18 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton_Right_Back">
<item>
<widget class="QPushButton" name="pushButton_Back">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
@ -315,32 +228,37 @@
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{border-image: url(://images/down.png);}
QPushButton{border:none;}
QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
</property>
<property name="text">
<string>↘</string>
<string></string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox">
<item>
<widget class="QPushButton" name="pushButton_Right_Back">
<property name="minimumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>狂暴模式</string>
<string></string>
</property>
</widget>
</item>
@ -411,15 +329,109 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="JoyStick_widget" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_25"/>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>385</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>🔗断开</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton_back">
<property name="geometry">
<rect>
<x>210</x>
<y>430</y>
<width>64</width>
<height>64</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{border-image: url(://images/down.png);}
QPushButton{border:none;}
QPushButton:pressed{border-image: url(://images/down_2.png);}</string>
</property>
<property name="text">
<string>,</string>
</property>
<property name="shortcut">
<string>,</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1600</width>
<width>1440</width>
<height>22</height>
</rect>
</property>

Loading…
Cancel
Save