add xtdgroundcontrol c++

This commit is contained in:
robin_shaun 2021-03-30 23:19:39 +08:00
parent d3f51db7b3
commit 9ef55e94bd
53 changed files with 73 additions and 80 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
iris_num=6
typhoon_h480_num=0
iris_num=3
typhoon_h480_num=2
solo_num=0
plane_num=0
rover_num=0

View File

@ -3,7 +3,7 @@
##############################################################################
cmake_minimum_required(VERSION 2.8.0)
project(xtdrone_qt)
project(xtdgroundcontrol)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/opt/ros/melodic/")
##############################################################################
@ -37,7 +37,7 @@ catkin_package()
file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/xtdrone_qt/*.hpp *.h)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/xtdgroundcontrol/*.hpp *.h)
QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
@ -53,7 +53,7 @@ file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINK
# Binaries
##############################################################################
add_executable(xtdrone_qt ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(xtdrone_qt ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS xtdrone_qt RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
add_executable(xtdgroundcontrol ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(xtdgroundcontrol ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS xtdgroundcontrol RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

View File

@ -1,5 +1,5 @@
#ifndef xtdrone_qt_FORM_H
#define xtdrone_qt_FORM_H
#ifndef xtdgroundcontrol_FORM_H
#define xtdgroundcontrol_FORM_H
#include <QWidget>

View File

@ -18,6 +18,8 @@ public:
private slots:
void on_button_image_cancel_clicked();
void on_button_image_ok_clicked();
void slot_btn_addtopic_clicked();
void slot_btn_other_clicked();
signals:
void rviz_to_main(QString);

View File

@ -1,12 +1,12 @@
/**
* @file /include/xtdrone_qt/main_window.hpp
* @file /include/xtdgroundcontrol/main_window.hpp
*
* @brief Qt based gui for xtdrone_qt.
* @brief Qt based gui for xtdgroundcontrol.
*
* @date November 2010
**/
#ifndef xtdrone_qt_MAIN_WINDOW_H
#define xtdrone_qt_MAIN_WINDOW_H
#ifndef xtdgroundcontrol_MAIN_WINDOW_H
#define xtdgroundcontrol_MAIN_WINDOW_H
/*****************************************************************************
** Includes
@ -32,7 +32,7 @@
** Namespace
*****************************************************************************/
namespace xtdrone_qt {
namespace xtdgroundcontrol {
/*****************************************************************************
** Interface [MainWindow]
@ -141,7 +141,7 @@ public Q_SLOTS:
void slot_display_Pose(int);
void slot_btn_add_click(bool);
void slot_addrviz(QString);
void slot_btn_estimate_click(bool);
// void slot_btn_estimate_click(bool);
void slot_btn_goal_click(bool);
void slot_rviz_control();
private:
@ -151,6 +151,6 @@ private:
qrviz* my_rviz;
};
} // namespace xtdrone_qt
} // namespace xtdgroundcontrol
#endif // xtdrone_qt_MAIN_WINDOW_H
#endif // xtdgroundcontrol_MAIN_WINDOW_H

View File

@ -1,5 +1,5 @@
/**
* @file /include/xtdrone_qt/qnode.hpp
* @file /include/xtdgroundcontrol/qnode.hpp
*
* @brief Communications central!
*
@ -9,8 +9,8 @@
** Ifdefs
*****************************************************************************/
#ifndef xtdrone_qt_QNODE_HPP_
#define xtdrone_qt_QNODE_HPP_
#ifndef xtdgroundcontrol_QNODE_HPP_
#define xtdgroundcontrol_QNODE_HPP_
/*****************************************************************************
** Includes
@ -41,7 +41,7 @@
** Namespaces
*****************************************************************************/
namespace xtdrone_qt {
namespace xtdgroundcontrol {
/*****************************************************************************
** Class
@ -133,6 +133,6 @@ private:
};
} // namespace xtdrone_qt
} // namespace xtdgroundcontrol
#endif /* xtdrone_qt_QNODE_HPP_ */
#endif /* xtdgroundcontrol_QNODE_HPP_ */

View File

@ -20,7 +20,7 @@ public:
void Display_LaserScan(QString laser_topic, bool enable);
void Display_Image(QString Image_topic, bool enable, int num);
void Display_Pose(QString pose_topic, QString pose_shape, QColor color, bool enable, int num);
void Set_start_pose();
// void Set_start_pose();
void Set_goal_pose();
private:
rviz::RenderPanel* render_panel;

View File

@ -2,7 +2,7 @@
\mainpage
\htmlinclude manifest.html
\b xtdrone_qt is ...
\b xtdgroundcontrol is ...
<!--
Provide an overview of your package.

View File

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<package>
<name>xtdrone_qt</name>
<name>xtdgroundcontrol</name>
<version>0.1.0</version>
<description>
xtdrone_qt
XTDGroundControl
</description>
<maintainer email="robin@gmail.com">robin</maintainer>

View File

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 310 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,4 +1,4 @@
#include "../include/xtdrone_qt/form.h"
#include "../include/xtdgroundcontrol/form.h"
#include "ui_form.h"
Form::Form(QWidget *parent) :

View File

@ -1,4 +1,4 @@
#include "../include/xtdrone_qt/formrviz.h"
#include "../include/xtdgroundcontrol/formrviz.h"
#include "ui_formrviz.h"
FormRviz::FormRviz(QWidget *parent) :
@ -6,6 +6,11 @@ FormRviz::FormRviz(QWidget *parent) :
ui(new Ui::FormRviz)
{
ui->setupUi(this);
ui->edit_addtopic->setReadOnly(true);
connect(ui->button_image_addtopic,SIGNAL(clicked()),this,SLOT(slot_btn_addtopic_clicked()));
connect(ui->button_image_tf,SIGNAL(clicked()),this,SLOT(slot_btn_other_clicked()));
connect(ui->button_image_camera,SIGNAL(clicked()),this,SLOT(slot_btn_other_clicked()));
connect(ui->button_image_laser,SIGNAL(clicked()),this,SLOT(slot_btn_other_clicked()));
}
FormRviz::~FormRviz()
@ -47,3 +52,11 @@ void FormRviz::on_button_image_ok_clicked()
}
void FormRviz::slot_btn_addtopic_clicked()
{
ui->edit_addtopic->setReadOnly(false);
}
void FormRviz::slot_btn_other_clicked()
{
ui->edit_addtopic->setReadOnly(true);
}

View File

@ -11,7 +11,7 @@
#include <QtGui>
#include <QApplication>
#include "../include/xtdrone_qt/main_window.hpp"
#include "../include/xtdgroundcontrol/main_window.hpp"
/*****************************************************************************
** Main
@ -23,7 +23,7 @@ int main(int argc, char **argv) {
** Qt
**********************/
QApplication app(argc, argv);
xtdrone_qt::MainWindow w(argc,argv);
xtdgroundcontrol::MainWindow w(argc,argv);
w.show();
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
int result = app.exec();

View File

@ -12,7 +12,7 @@
#include <QtGui>
#include <QMessageBox>
#include <iostream>
#include "../include/xtdrone_qt/main_window.hpp"
#include "../include/xtdgroundcontrol/main_window.hpp"
#include "QDebug"
//#include <sstream>
//#include <string>
@ -22,7 +22,7 @@
** Namespaces
*****************************************************************************/
namespace xtdrone_qt {
namespace xtdgroundcontrol {
using namespace Qt;
@ -186,7 +186,7 @@ void MainWindow::updateLoggingView() {
*****************************************************************************/
void MainWindow::ReadSettings() {
QSettings settings("Qt-Ros Package", "xtdrone_qt");
QSettings settings("Qt-Ros Package", "xtdgroundcontrol");
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
connect(ui.button_run,SIGNAL(clicked(bool)),this,SLOT(slot_btn_run_click(bool)));
@ -211,13 +211,13 @@ void MainWindow::ReadSettings() {
connect(ui.comboBox_maps,SIGNAL(currentTextChanged(const QString)),this,SLOT(slot_box_maps_change(const QString)));
connect(&qnode, SIGNAL(uavposition(float, float)),this,SLOT(slot_update_plot(float, float)));
connect(ui.button_add, SIGNAL(clicked(bool)),this,SLOT(slot_btn_add_click(bool)));
connect(ui.button_estimate, SIGNAL(clicked(bool)),this,SLOT(slot_btn_estimate_click(bool)));
// connect(ui.button_estimate, SIGNAL(clicked(bool)),this,SLOT(slot_btn_estimate_click(bool)));
connect(ui.button_goal, SIGNAL(clicked(bool)),this,SLOT(slot_btn_goal_click(bool)));
connect(&qnode, SIGNAL(rvizsetgoal()),this,SLOT(slot_rviz_control()));
}
void MainWindow::WriteSettings() {
QSettings settings("Qt-Ros Package", "xtdrone_qt");
QSettings settings("Qt-Ros Package", "xtdgroundcontrol");
//settings.setValue("topic_name",ui.line_edit_topic->text());
// settings.setValue("use_environment_variables",QVariant(ui.checkbox_use_environment->isChecked()));
settings.setValue("geometry", saveGeometry());
@ -267,6 +267,8 @@ void MainWindow::init_uisettings()
ui.checkBox_quadplane->setCheckable(false);
ui.checkBox_tiltrotor->setCheckable(false);
ui.checkBox_tailsitter->setCheckable(false);
ui.button_goal->setEnabled(false);
// ui.button_add->setChecked(false);
// ui.button_add->setEnabled(false);
@ -433,6 +435,7 @@ void MainWindow::slot_btn_run_click(bool)
} else {
ui.button_run->setEnabled(false);
ui.button_control->setEnabled(true);
my_rviz = new qrviz(ui.verticalLayout_rviz);
ui.treeWidget->setEnabled(true);
// ui.button_add->setEnabled(true);
@ -461,6 +464,7 @@ void MainWindow::slot_btn_control_click(bool)
ui.box_left_and_right_2->setReadOnly(false);
ui.box_orientation->setReadOnly(false);
ui.button_stop->setEnabled(true);
ui.button_goal->setEnabled(true);
}
}
@ -916,10 +920,10 @@ void MainWindow::slot_addrviz(QString value)
}
}
void MainWindow::slot_btn_estimate_click(bool)
{
my_rviz->Set_start_pose();
}
//void MainWindow::slot_btn_estimate_click(bool)
//{
// my_rviz->Set_start_pose();
//}
void MainWindow::slot_btn_goal_click(bool)
{
@ -932,4 +936,4 @@ void MainWindow::slot_rviz_control()
ui.box_left_and_right_2->setProperty("value", 0.0);
ui.box_orientation->setProperty("value", 0.0);
}
} // namespace xtdrone_qt
} // namespace xtdgroundcontrol

View File

@ -15,7 +15,7 @@
#include <string>
#include <std_msgs/String.h>
#include <sstream>
#include "../include/xtdrone_qt/qnode.hpp"
#include "../include/xtdgroundcontrol/qnode.hpp"
//#include <boost/bind.hpp>
#include "QDebug"
#include <math.h>
@ -27,7 +27,7 @@ typedef QList<geometry_msgs::Pose> LISTPOSE;
** Namespaces
*****************************************************************************/
namespace xtdrone_qt {
namespace xtdgroundcontrol {
/*****************************************************************************
** Implementation
@ -64,8 +64,8 @@ void odm_groundtruth_callback(const geometry_msgs::PoseStamped::ConstPtr& msg, i
*****************************************************************************/
//bool QNode::init() {
// ros::init("xtdrone_qt");
// ros::init(init_argc,init_argv,"xtdrone_qt");
// ros::init("xtdgroundcontrol");
// ros::init(init_argc,init_argv,"xtdgroundcontrol");
// if ( ! ros::master::check() ) {
// return false;
// }
@ -79,7 +79,7 @@ void odm_groundtruth_callback(const geometry_msgs::PoseStamped::ConstPtr& msg, i
//}
bool QNode::init(const LISTINT multi_select, const int *multi_num, const LISTSTR multi_type, std::string q_control_type) {
// ros::init("xtdrone_qt");
// ros::init("xtdgroundcontrol");
int leng_select = multi_select.size();
int counnnt = 0;
int counnnnnt = 0;
@ -108,7 +108,7 @@ bool QNode::init(const LISTINT multi_select, const int *multi_num, const LISTSTR
vel[i].angular.y = 0.0;
cmd[i].data = "";
}
ros::init(init_argc,init_argv,"xtdrone_qt");
ros::init(init_argc,init_argv,"xtdgroundcontrol");
if ( ! ros::master::check() ) {
return false;
}
@ -538,4 +538,4 @@ double QNode::pos2ang(double xa, double ya, double xb, double yb)
angle = angle + 2 * 3.1415926;
return angle;
}
} // namespace xtdrone_qt
} // namespace xtdgroundcontrol

View File

@ -1,4 +1,4 @@
#include "../include/xtdrone_qt/qrviz.hpp"
#include "../include/xtdgroundcontrol/qrviz.hpp"
#include <QDebug>
qrviz::qrviz(QVBoxLayout* layout)
@ -101,11 +101,11 @@ void qrviz::Display_Image(QString Image_topic, bool enable, int num)
ROS_ASSERT(Image[num]!=NULL);
manager->startUpdate();
}
void qrviz::Set_start_pose()
{
rviz::Tool* current_tool = tool_manager->addTool("rviz/SetInitialPose");
tool_manager->setCurrentTool(current_tool);
}
//void qrviz::Set_start_pose()
//{
// rviz::Tool* current_tool = tool_manager->addTool("rviz/SetInitialPose");
// tool_manager->setCurrentTool(current_tool);
//}
void qrviz::Set_goal_pose()
{
rviz::Tool* current_tool = tool_manager->addTool("rviz/SetGoal");

View File

@ -1706,32 +1706,6 @@ font: 57 12pt &quot;Ubuntu&quot;;</string>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QPushButton" name="button_estimate">
<property name="styleSheet">
<string notr="true">font: 57 12pt &quot;Ubuntu&quot;;
color: rgb(32, 74, 135);
border-bottom-color: rgb(186, 189, 182);
</string>
</property>
<property name="text">
<string>2D pose Estimate</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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="QPushButton" name="button_goal">
<property name="styleSheet">

View File

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 310 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB