diff --git a/CMakeLists.txt b/CMakeLists.txt index 30cdc30..42f69d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,12 +123,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES src/include/qnode.hpp - + src/include/joystick.h src/main/main.cpp src/main/mainwindow.cpp src/main/qnode.cpp - + src/main/joystick.cpp src/ui/mainwindow.hpp src/ui/mainwindow.ui diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index eb92692..d1bcb35 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -168,6 +168,15 @@ void MainWindow::slot_rockKeyChange(int key){ } void MainWindow::connections(){ + QObject::connect(ui->btn_main, &QPushButton::clicked, this, [=](){ + ui->stackedWidget_main->setCurrentIndex(0); + }); + QObject::connect(ui->btn_uav, &QPushButton::clicked, this, [=](){ + ui->stackedWidget_main->setCurrentIndex(1); + }); + QObject::connect(ui->btn_ugv, &QPushButton::clicked, this, [=](){ + ui->stackedWidget_main->setCurrentIndex(2); + }); /* * 绑定速度控制按钮 */ diff --git a/src/main/qnode.cpp b/src/main/qnode.cpp index 4db1038..7afa84b 100644 --- a/src/main/qnode.cpp +++ b/src/main/qnode.cpp @@ -33,9 +33,9 @@ void QNode::SubAndPubTopic(){ void QNode::KeyboardMove(char key, float speed_linear, float speed_trun){ std::map> moveBindings { // {'key', {x, y, z, th}} - {'7', {1, 1, 0, 0}}, {'8', {1, 0, 0, 0}}, {'9', {1, -1, 0, 0}}, + {'7', {1, 1, 0, 1}}, {'8', {1, 0, 0, 0}}, {'9', {1, -1, 0, -1}}, {'4', {0, 0, 0, 1}}, {'5', {0, 0, 0, 0}}, {'6', {0, 0, 0, -1}}, - {'1', {-1, 1, 0, 0}}, {'2', {-1, 0, 0, 0}}, {'3', {-1, -1, 0, 0}} + {'1', {-1, 1, 0, 1}}, {'2', {-1, 0, 0, 0}}, {'3', {-1, -1, 0, -1}} }; float x = moveBindings[key][0]; diff --git a/src/ui/mainwindow.ui b/src/ui/mainwindow.ui index 0e24c79..ac45aed 100644 --- a/src/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -17,492 +17,740 @@ - - - - 1045 - 160 - 387 - 566 - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - QPushButton{border-image: url(://images/up.png);} - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 90 - 64 - - - - - 90 - 64 - - - - 全向模式(k) - - - K - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - QPushButton{border-image: url(://images/down.png);} + + + + + 2 + + + + + + 780 + 200 + 311 + 151 + + + + Main Widget + + + + + + + + 830 + 280 + 271 + 121 + + + + UAV Widget + + + + + + + + 1000 + 80 + 387 + 566 + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + QPushButton{border-image: url(://images/up.png);} + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 90 + 64 + + + + + 90 + 64 + + + + 全向模式(k) + + + K + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + QPushButton{border-image: url(://images/down.png);} QPushButton{border:none;} QPushButton:pressed{border-image: url(://images/down_2.png);} - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - 15 - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - - 线速度(cm/s): - - + + + + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + 15 + + + + + + + + - - - 100 + + + Qt::Vertical - - 1 + + QSizePolicy::Fixed - - 50 + + + 20 + 20 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 线速度(cm/s): + + + + + + + 100 + + + 1 + + + 50 + + + Qt::Horizontal + + + + + + + 50 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + 角速度(cm/s): + + + + + + + 100 + + + 100 + + + Qt::Horizontal + + + + + + + 100 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + - + - - - 50 + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 86 + 20 + + + + + + + + + 200 + 200 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + + Qt::Vertical - + + + 385 + 21 + + + - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - 角速度(cm/s): - - - - - - - 100 - - - 100 - - - Qt::Horizontal - - - - - - - 100 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 86 - 20 - - - - - - - - - 200 - 200 - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 385 - 21 - - - - - - - - - - - 0 - 0 - 1440 - 22 - - + + + + + + + + 0 + + + + + + 0 + 60 + + + + QPushButton:hover{ +background-color:rgb(186, 189, 182); +border-bottom:2px solid rgb(67, 154, 246); +} +QPushButton:checked{ +background-color:cyan; +border-bottom:2px solid white +} +QPushButton:pressed{ +background-color:rgb(67, 154, 246) +} +QPushButton{ +background-color:rgb(238, 238, 236); +border:none; +padding:0px 0px 0px 0px; +margin:0px 0px 0px 0px; +} + + + + + + + 32 + 32 + + + + + + + + + 0 + 60 + + + + QPushButton:hover{ +background-color:rgb(186, 189, 182); +border-bottom:2px solid rgb(67, 154, 246); +} +QPushButton:checked{ +background-color:cyan; +border-bottom:2px solid white +} +QPushButton:pressed{ +background-color:rgb(67, 154, 246) +} +QPushButton{ +background-color:rgb(238, 238, 236); +border:none; +padding:0px 0px 0px 0px; +margin:0px 0px 0px 0px; +} + + + + + + + 32 + 32 + + + + + + + + + 0 + 60 + + + + PointingHandCursor + + + QPushButton:hover{ +background-color:rgb(186, 189, 182); +border-bottom:2px solid rgb(67, 154, 246); +} +QPushButton:checked{ +background-color:cyan; +border-bottom:2px solid white +} +QPushButton:pressed{ +background-color:rgb(67, 154, 246) +} +QPushButton{ +background-color:rgb(238, 238, 236); +border:none; +padding:0px 0px 0px 0px; +margin:0px 0px 0px 0px; +} + + + + + + + ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + + + + 32 + 32 + + + + + + + + + 0 + 60 + + + + PointingHandCursor + + + QPushButton:hover{ +background-color:rgb(186, 189, 182); +border-bottom:2px solid rgb(67, 154, 246); +} +QPushButton:checked{ +background-color:cyan; +border-bottom:2px solid white +} +QPushButton:pressed{ +background-color:rgb(67, 154, 246) +} +QPushButton{ +background-color:rgb(238, 238, 236); +border:none; +padding:0px 0px 0px 0px; +margin:0px 0px 0px 0px; +} + + + + + + + ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + + + + 32 + 32 + + + + + + + + + 0 + 60 + + + + PointingHandCursor + + + QPushButton:hover{ +background-color:rgb(186, 189, 182); +border-bottom:2px solid rgb(67, 154, 246); +} +QPushButton:checked{ +background-color:cyan; +border-bottom:2px solid white +} +QPushButton:pressed{ +background-color:rgb(67, 154, 246) +} +QPushButton{ +background-color:rgb(238, 238, 236); +border:none; +padding:0px 0px 0px 0px; +margin:0px 0px 0px 0px; +} + + + + + + + ../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui../../../../../catkin_ws/src/Ros_Qt5_Gui_App/ui + + + + 32 + 32 + + + + + + + -