Merge branch 'xiaojinchi_branch'

xiaojinchi_branch
xiao 1 year ago
commit 875a8db3be

@ -0,0 +1,51 @@
#include "Setting.h"
#include <QTcpServer>
#include <QTcpSocket>
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
Setting::Setting(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
/*float longitude = ui.longitude->text().toFloat();
float latitude = ui.latitude->text().toFloat();
int hours = ui.hours->text().toInt();
int minutes = ui.minutes->text().toInt();
int seconds = ui.seconds->text().toInt();*/
tcpsocket = new QTcpSocket(this);
tcpsocket->connectToHost("192.168.8.100", 9090);
connect(ui.finished, &QPushButton::clicked, this, &Setting::on_finished_button);
}
Setting::~Setting()
{
}
void Setting::on_finished_button() {
float longitude = ui.longitude->text().toFloat();
float latitude = ui.latitude->text().toFloat();
int hours = ui.hours->text().toInt();
int minutes = ui.minutes->text().toInt();
int seconds = ui.seconds->text().toInt();
int x = ui.x->text().toInt();
int y = ui.y->text().toInt();
int z = ui.z->text().toInt();
QJsonObject msg;
msg.insert("type", "Set");
msg.insert("lon", longitude);
msg.insert("lat", latitude);
msg.insert("hours", hours);
msg.insert("minutes", minutes);
msg.insert("seconds", seconds);
msg.insert("x", x);
msg.insert("y", y);
msg.insert("z", z);
QJsonDocument jsonDocument;
jsonDocument.setObject(msg);
QByteArray dataArray = jsonDocument.toJson();
if (tcpsocket->write(dataArray) == -1) {
qDebug() << "send TCP data package failed!";
}
qDebug() << "sent!";
}

@ -0,0 +1,23 @@
#pragma once
#include <QMainWindow>
#include "ui_Setting.h"
#include <QTcpServer>
#include <QTcpSocket>
class Setting : public QMainWindow
{
Q_OBJECT
public:
Setting(QWidget *parent = nullptr);
~Setting();
QTcpServer* tcpserver;
QTcpSocket* tcpsocket;
private:
Ui::SettingClass ui;
private slots:
void on_finished_button();
};

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingClass</class>
<widget class="QMainWindow" name="SettingClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>871</width>
<height>571</height>
</rect>
</property>
<property name="windowTitle">
<string>Setting</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>451</width>
<height>241</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="Start_Timer">
<property name="text">
<string>出发时间:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLineEdit" name="seconds">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>秒</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="hours">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>时</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="longitude">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>经度</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="minutes">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>分</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="latitude">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>纬度</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Speed_Lable">
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>目的地</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>x,y,z</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="x">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="y">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="z">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>0</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="finished">
<property name="geometry">
<rect>
<x>180</x>
<y>290</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>完成</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>871</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

Binary file not shown.

@ -0,0 +1,83 @@
#include "UAV_UI_new.h"
#include "Setting.h"
#include <opencv2/opencv.hpp>
#include <string.h>
#include <qlabel.h>
#include <qdebug.h>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
using namespace cv;
using namespace std;
VideoCapture cap;
//const string VideoCaptureAdress = "http://admin:admin@192.168.8.126:8081";
const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/375897"; //热成像
//const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/165506"; //nomal
//const string VideoCaptureAdress = "C:\\Users\\87334\\Videos\\Captures\\Fast_sent.mp4";
UAV_UI_new::UAV_UI_new(QWidget* parent)
: QMainWindow(parent)
{
ui.setupUi(this);
timer = new QTimer(this);
ui.display->setStyleSheet("border:1px solid black ");
ui.play_tag->setStyleSheet("background-color:white");
connect(ui.Settings, &QPushButton::clicked, this, &UAV_UI_new::onclick_Setting_button);
connect(ui.connection, &QPushButton::clicked, this, &UAV_UI_new::on_connection_button);
connect(ui.stop, &QPushButton::clicked, this, &UAV_UI_new::on_stop_button);
connect(ui.action, &QPushButton::clicked, this, &UAV_UI_new::on_action_button);
connect(timer, SIGNAL(timeout()), this, SLOT(importImage()));
tcpsocket = new QTcpSocket(this);
tcpsocket->connectToHost("192.168.8.100", 9090);
connect(tcpsocket, &QTcpSocket::connected, [=]() {
QMessageBox *tip = new QMessageBox(this);
//QLabel *tip = new QLabel(this);
tip->setText("连接成功");
tip->setInformativeText("connected successfully");
tip->setStandardButtons(QMessageBox::Ok);
tip->show();
});
connect(tcpsocket, &QTcpSocket::readyRead, [=]() {
QByteArray jsonData = tcpsocket->readAll(); // 接收 JSON 数据
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonData);
QJsonObject jsonObject = jsonDocument.object();
QString type = jsonObject.value("type").toString();
if (type == "Alarming") {
QMessageBox msgBox;
msgBox.setWindowTitle("Alarming");
msgBox.setText("Fire and Fire");
msgBox.show();
}
});
}
UAV_UI_new::~UAV_UI_new()
{}
void UAV_UI_new::on_connection_button() {
cap.open(VideoCaptureAdress);
timer->start(100);
};
void UAV_UI_new::onclick_Setting_button() {
Settings_UI.show();
}
void UAV_UI_new::importImage() {
Mat image;
cap >> image;
cvtColor(image, image, COLOR_BGR2RGB);
cv::resize(image, image, Size(640, 480));
QPixmap showimage = QPixmap::fromImage(QImage((const uchar*)(image.data),
image.cols,
image.rows,
image.step,
QImage::Format_RGB888));
ui.display->setPixmap(showimage);
}
void UAV_UI_new::on_stop_button() {
timer->stop();
cap.release();
ui.display->clear();
}
void UAV_UI_new::on_action_button() {
//放警报
}

@ -0,0 +1,35 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_UAV_UI_new.h"
#include "Setting.h"
#include <QTimer>
#include <qpushbutton.h>
#include <QPushbutton>
#include <opencv2/opencv.hpp>
#include <QTcpServer>
#include <QTcpSocket>
class UAV_UI_new : public QMainWindow
{
Q_OBJECT
public:
UAV_UI_new(QWidget *parent = nullptr);
~UAV_UI_new();
private:
Ui::UAV_UI_newClass ui;
QTimer* timer;
double rate;
QTcpServer* tcpserver;
QTcpSocket* tcpsocket;
Setting Settings_UI;
private slots:
void on_connection_button();
void on_stop_button();
void importImage();
void onclick_Setting_button();
void on_action_button();
};

@ -0,0 +1,4 @@
<RCC>
<qresource prefix="UAV_UI_new">
</qresource>
</RCC>

Binary file not shown.

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UAV_UI_newClass</class>
<widget class="QMainWindow" name="UAV_UI_newClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1159</width>
<height>682</height>
</rect>
</property>
<property name="windowTitle">
<string>UAV_UI_new</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>90</x>
<y>60</y>
<width>642</width>
<height>509</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="display">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>640</width>
<height>480</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="stop">
<property name="geometry">
<rect>
<x>820</x>
<y>140</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>stop</string>
</property>
</widget>
<widget class="QPushButton" name="connection">
<property name="geometry">
<rect>
<x>820</x>
<y>70</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>connection</string>
</property>
</widget>
<widget class="QLabel" name="play_tag">
<property name="geometry">
<rect>
<x>100</x>
<y>40</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>图像播放处</string>
</property>
</widget>
<widget class="QPushButton" name="Settings">
<property name="geometry">
<rect>
<x>1060</x>
<y>0</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
<widget class="QPushButton" name="action">
<property name="geometry">
<rect>
<x>820</x>
<y>200</y>
<width>93</width>
<height>29</height>
</rect>
</property>
<property name="text">
<string>出警</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1159</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="UAV_UI_new.qrc"/>
</resources>
<connections/>
</ui>

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FB496CF3-A3CE-4A50-BAC4-A9F43A71A5F9}</ProjectGuid>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0.22000.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0.22000.0</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
<QtInstall>6.2.4</QtInstall>
<QtModules>core;gui;network;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
<QtInstall>6.2.4</QtInstall>
<QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>release</QtBuildConfig>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>D:\OpenCV\opencv\build\include\opencv2;D:\OpenCV\opencv\build\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\OpenCV\opencv\build\x64\vc15\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalLibraryDirectories>D:\OpenCV\opencv\build\x64\vc15\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_world455d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
<ClCompile>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
<ClCompile>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>None</DebugInformationFormat>
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<QtRcc Include="UAV_UI_new.qrc" />
<QtUic Include="Setting.ui" />
<QtUic Include="tips.ui" />
<QtUic Include="UAV_UI_new.ui" />
<QtMoc Include="UAV_UI_new.h" />
<ClCompile Include="Setting.cpp" />
<ClCompile Include="tips.cpp" />
<ClCompile Include="UAV_UI_new.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="tips.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource1.h" />
<QtMoc Include="Setting.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UAV_UI_new1.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
</Filter>
<Filter Include="Translation Files">
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
<Extensions>ts</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<QtRcc Include="UAV_UI_new.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
<QtUic Include="UAV_UI_new.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtMoc Include="UAV_UI_new.h">
<Filter>Header Files</Filter>
</QtMoc>
<ClCompile Include="UAV_UI_new.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tips.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Setting.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="tips.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="Setting.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="tips.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="Setting.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource1.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UAV_UI_new1.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-05-21T16:36:10.6302989Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-05-21T16:36:10.6837787Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

Binary file not shown.

Binary file not shown.

@ -0,0 +1,17 @@
#include "UAV_UI_new.h"
#include <QtWidgets/QApplication>
#include <opencv2/opencv.hpp>
#include <string.h>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
UAV_UI_new w;
w.show();
/*VideoCapture cap;
const string VideoCaptureAdress = "rtsp://192.168.144.108:8000/165506";
cap.open(VideoCaptureAdress);*/
return a.exec();
}

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UAV_UI_new.rc
// 新对象的下一组默认值
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by UAV_UI_new1.rc
// 新对象的下一组默认值
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -0,0 +1,10 @@
#include "tips.h"
tips::tips(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
tips::~tips()
{}

@ -0,0 +1,16 @@
#pragma once
#include <QMainWindow>
#include "ui_tips.h"
class tips : public QMainWindow
{
Q_OBJECT
public:
tips(QWidget *parent = nullptr);
~tips();
private:
Ui::tipsClass ui;
};

@ -0,0 +1,22 @@
<UI version="4.0" >
<class>tipsClass</class>
<widget class="QMainWindow" name="tipsClass" >
<property name="objectName" >
<string notr="true">tipsClass</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
<string>tips</string>
</property> <widget class="QMenuBar" name="menuBar" /> <widget class="QToolBar" name="mainToolBar" /> <widget class="QWidget" name="centralWidget" /> <widget class="QStatusBar" name="statusBar" />
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<connections/>
</UI>

@ -0,0 +1,19 @@
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\moc\moc_uav_ui_new.cpp
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\moc\moc_tips.cpp
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\moc\moc_setting.cpp
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\rcc\qrc_uav_ui_new.cpp
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uic\ui_setting.h
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uic\ui_tips.h
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uic\ui_uav_ui_new.h
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\main.obj
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\tips.obj
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.obj
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\vc143.pdb
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\cl.command.1.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\moc.read.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\moc.write.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\rcc.read.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\rcc.write.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\uav_ui_new.write.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\uic.read.1u.tlog
d:\software\uav_ui\uav_ui_new\uav_ui_new\x64\debug\uav_ui_new.tlog\uic.write.1u.tlog

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>D:\software\UAV_UI\UAV_UI_new\x64\Debug\UAV_UI_new.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

@ -0,0 +1,25 @@
 uic Setting.ui
Setting.cpp
UAV_UI_new.cpp
main.cpp
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x1db 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x1dd 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x1de 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x1e0 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x630 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x631 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x632 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x637 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x73e 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x73f 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x741 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x748 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x74a 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0x74b 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0xbcb 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0xbce 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0xbcf 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
D:\software\UAV_UI\UAV_UI_new\UAV_UI_new\UAV_UI_new.cpp(1,1): warning C4828: 文件包含在偏移 0xbd0 处开始的字符,该字符在当前源字符集中无效(代码页 65001)。
moc_Setting.cpp
moc_UAV_UI_new.cpp
UAV_UI_new.vcxproj -> D:\software\UAV_UI\UAV_UI_new\x64\Debug\UAV_UI_new.exe

@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.35.32215:TargetPlatformVersion=10.0.22000.0:
Debug|x64|D:\software\UAV_UI\UAV_UI_new\|

Binary file not shown.

@ -0,0 +1,123 @@
/****************************************************************************
** Meta object code from reading C++ file 'Setting.h'
**
** Created by: The Qt Meta Object Compiler version 68 (Qt 6.2.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../../../Setting.h"
#include <QtGui/qtextcursor.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Setting.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 68
#error "This file was generated using the moc from 6.2.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_Setting_t {
const uint offsetsAndSize[6];
char stringdata0[28];
};
#define QT_MOC_LITERAL(ofs, len) \
uint(offsetof(qt_meta_stringdata_Setting_t, stringdata0) + ofs), len
static const qt_meta_stringdata_Setting_t qt_meta_stringdata_Setting = {
{
QT_MOC_LITERAL(0, 7), // "Setting"
QT_MOC_LITERAL(8, 18), // "on_finished_button"
QT_MOC_LITERAL(27, 0) // ""
},
"Setting\0on_finished_button\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Setting[] = {
// content:
10, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags, initial metatype offsets
1, 0, 20, 2, 0x08, 1 /* Private */,
// slots: parameters
QMetaType::Void,
0 // eod
};
void Setting::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<Setting *>(_o);
(void)_t;
switch (_id) {
case 0: _t->on_finished_button(); break;
default: ;
}
}
(void)_a;
}
const QMetaObject Setting::staticMetaObject = { {
QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
qt_meta_stringdata_Setting.offsetsAndSize,
qt_meta_data_Setting,
qt_static_metacall,
nullptr,
qt_incomplete_metaTypeArray<qt_meta_stringdata_Setting_t
, QtPrivate::TypeAndForceComplete<Setting, std::true_type>
, QtPrivate::TypeAndForceComplete<void, std::false_type>
>,
nullptr
} };
const QMetaObject *Setting::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Setting::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Setting.stringdata0))
return static_cast<void*>(this);
return QMainWindow::qt_metacast(_clname);
}
int Setting::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
_id -= 1;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

@ -0,0 +1,141 @@
/****************************************************************************
** Meta object code from reading C++ file 'UAV_UI_new.h'
**
** Created by: The Qt Meta Object Compiler version 68 (Qt 6.2.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../../../UAV_UI_new.h"
#include <QtGui/qtextcursor.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'UAV_UI_new.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 68
#error "This file was generated using the moc from 6.2.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_UAV_UI_new_t {
const uint offsetsAndSize[14];
char stringdata0[100];
};
#define QT_MOC_LITERAL(ofs, len) \
uint(offsetof(qt_meta_stringdata_UAV_UI_new_t, stringdata0) + ofs), len
static const qt_meta_stringdata_UAV_UI_new_t qt_meta_stringdata_UAV_UI_new = {
{
QT_MOC_LITERAL(0, 10), // "UAV_UI_new"
QT_MOC_LITERAL(11, 20), // "on_connection_button"
QT_MOC_LITERAL(32, 0), // ""
QT_MOC_LITERAL(33, 14), // "on_stop_button"
QT_MOC_LITERAL(48, 11), // "importImage"
QT_MOC_LITERAL(60, 22), // "onclick_Setting_button"
QT_MOC_LITERAL(83, 16) // "on_action_button"
},
"UAV_UI_new\0on_connection_button\0\0"
"on_stop_button\0importImage\0"
"onclick_Setting_button\0on_action_button"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_UAV_UI_new[] = {
// content:
10, // revision
0, // classname
0, 0, // classinfo
5, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags, initial metatype offsets
1, 0, 44, 2, 0x08, 1 /* Private */,
3, 0, 45, 2, 0x08, 2 /* Private */,
4, 0, 46, 2, 0x08, 3 /* Private */,
5, 0, 47, 2, 0x08, 4 /* Private */,
6, 0, 48, 2, 0x08, 5 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void UAV_UI_new::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<UAV_UI_new *>(_o);
(void)_t;
switch (_id) {
case 0: _t->on_connection_button(); break;
case 1: _t->on_stop_button(); break;
case 2: _t->importImage(); break;
case 3: _t->onclick_Setting_button(); break;
case 4: _t->on_action_button(); break;
default: ;
}
}
(void)_a;
}
const QMetaObject UAV_UI_new::staticMetaObject = { {
QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
qt_meta_stringdata_UAV_UI_new.offsetsAndSize,
qt_meta_data_UAV_UI_new,
qt_static_metacall,
nullptr,
qt_incomplete_metaTypeArray<qt_meta_stringdata_UAV_UI_new_t
, QtPrivate::TypeAndForceComplete<UAV_UI_new, std::true_type>
, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>
>,
nullptr
} };
const QMetaObject *UAV_UI_new::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *UAV_UI_new::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_UAV_UI_new.stringdata0))
return static_cast<void*>(this);
return QMainWindow::qt_metacast(_clname);
}
int UAV_UI_new::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 5)
qt_static_metacall(this, _c, _id, _a);
_id -= 5;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 5)
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
_id -= 5;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

@ -0,0 +1,98 @@
/****************************************************************************
** Meta object code from reading C++ file 'tips.h'
**
** Created by: The Qt Meta Object Compiler version 68 (Qt 6.2.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../../../tips.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'tips.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 68
#error "This file was generated using the moc from 6.2.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_tips_t {
const uint offsetsAndSize[2];
char stringdata0[5];
};
#define QT_MOC_LITERAL(ofs, len) \
uint(offsetof(qt_meta_stringdata_tips_t, stringdata0) + ofs), len
static const qt_meta_stringdata_tips_t qt_meta_stringdata_tips = {
{
QT_MOC_LITERAL(0, 4) // "tips"
},
"tips"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_tips[] = {
// content:
10, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void tips::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
(void)_o;
(void)_id;
(void)_c;
(void)_a;
}
const QMetaObject tips::staticMetaObject = { {
QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(),
qt_meta_stringdata_tips.offsetsAndSize,
qt_meta_data_tips,
qt_static_metacall,
nullptr,
qt_incomplete_metaTypeArray<qt_meta_stringdata_tips_t
, QtPrivate::TypeAndForceComplete<tips, std::true_type>
>,
nullptr
} };
const QMetaObject *tips::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *tips::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_tips.stringdata0))
return static_cast<void*>(this);
return QMainWindow::qt_metacast(_clname);
}
int tips::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

@ -0,0 +1,60 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Qt_DEFINES_>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB</Qt_DEFINES_>
<Qt_INCLUDEPATH_>C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;D:\QT111\6.2.4\msvc2019_64\include;D:\QT111\6.2.4\msvc2019_64\include\QtWidgets;D:\QT111\6.2.4\msvc2019_64\include\QtGui;D:\QT111\6.2.4\msvc2019_64\include\QtNetwork;D:\QT111\6.2.4\msvc2019_64\include\QtCore;C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;/include;D:\QT111\6.2.4\msvc2019_64\mkspecs\win32-msvc</Qt_INCLUDEPATH_>
<Qt_STDCPP_>stdcpp17</Qt_STDCPP_>
<Qt_RUNTIME_>MultiThreadedDebugDLL</Qt_RUNTIME_>
<Qt_CL_OPTIONS_>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8</Qt_CL_OPTIONS_>
<Qt_LIBS_>D:\QT111\6.2.4\msvc2019_64\lib\Qt6Widgetsd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Guid.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Networkd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Cored.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6EntryPointd.lib;shell32.lib</Qt_LIBS_>
<Qt_LINK_OPTIONS_>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"</Qt_LINK_OPTIONS_>
<QMake_QT_SYSROOT_></QMake_QT_SYSROOT_>
<QMake_QT_INSTALL_PREFIX_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_PREFIX_>
<QMake_QT_INSTALL_ARCHDATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_ARCHDATA_>
<QMake_QT_INSTALL_DATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_DATA_>
<QMake_QT_INSTALL_DOCS_>D:/QT111/Docs/Qt-6.2.4</QMake_QT_INSTALL_DOCS_>
<QMake_QT_INSTALL_HEADERS_>D:/QT111/6.2.4/msvc2019_64/include</QMake_QT_INSTALL_HEADERS_>
<QMake_QT_INSTALL_LIBS_>D:/QT111/6.2.4/msvc2019_64/lib</QMake_QT_INSTALL_LIBS_>
<QMake_QT_INSTALL_LIBEXECS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_INSTALL_LIBEXECS_>
<QMake_QT_INSTALL_BINS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_INSTALL_BINS_>
<QMake_QT_INSTALL_TESTS_>D:/QT111/6.2.4/msvc2019_64/tests</QMake_QT_INSTALL_TESTS_>
<QMake_QT_INSTALL_PLUGINS_>D:/QT111/6.2.4/msvc2019_64/plugins</QMake_QT_INSTALL_PLUGINS_>
<QMake_QT_INSTALL_QML_>D:/QT111/6.2.4/msvc2019_64/qml</QMake_QT_INSTALL_QML_>
<QMake_QT_INSTALL_TRANSLATIONS_>D:/QT111/6.2.4/msvc2019_64/translations</QMake_QT_INSTALL_TRANSLATIONS_>
<QMake_QT_INSTALL_CONFIGURATION_></QMake_QT_INSTALL_CONFIGURATION_>
<QMake_QT_INSTALL_EXAMPLES_>D:/QT111/Examples/Qt-6.2.4</QMake_QT_INSTALL_EXAMPLES_>
<QMake_QT_INSTALL_DEMOS_>D:/QT111/Examples/Qt-6.2.4</QMake_QT_INSTALL_DEMOS_>
<QMake_QT_HOST_PREFIX_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_HOST_PREFIX_>
<QMake_QT_HOST_DATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_HOST_DATA_>
<QMake_QT_HOST_BINS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_HOST_BINS_>
<QMake_QT_HOST_LIBEXECS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_HOST_LIBEXECS_>
<QMake_QT_HOST_LIBS_>D:/QT111/6.2.4/msvc2019_64/lib</QMake_QT_HOST_LIBS_>
<QMake_QMAKE_SPEC_>win32-msvc</QMake_QMAKE_SPEC_>
<QMake_QMAKE_XSPEC_>win32-msvc</QMake_QMAKE_XSPEC_>
<QMake_QMAKE_VERSION_>3.1</QMake_QMAKE_VERSION_>
<QMake_QT_VERSION_>6.2.4</QMake_QT_VERSION_>
<Qt_INCLUDEPATH_
>$(Qt_INCLUDEPATH_);x64\Debug\moc;x64\Debug\uic</Qt_INCLUDEPATH_>
<QtBkup_QtInstall
>6.2.4</QtBkup_QtInstall>
<QtBkup_QtModules
>core;gui;network;widgets</QtBkup_QtModules>
<QtBkup_QtPathBinaries
>bin</QtBkup_QtPathBinaries>
<QtBkup_QtPathLibraryExecutables
>bin</QtBkup_QtPathLibraryExecutables>
<QtBkup_QtHeaderSearchPath
></QtBkup_QtHeaderSearchPath>
<QtBkup_QtLibrarySearchPath
></QtBkup_QtLibrarySearchPath>
<QtBkup_QtVars
>DEFINES=/Project/ItemDefinitionGroup/ClCompile/PreprocessorDefinitions;INCLUDEPATH=/Project/ItemDefinitionGroup/ClCompile/AdditionalIncludeDirectories;STDCPP=/Project/ItemDefinitionGroup/ClCompile/LanguageStandard;RUNTIME=/Project/ItemDefinitionGroup/ClCompile/RuntimeLibrary;CL_OPTIONS=/Project/ItemDefinitionGroup/ClCompile/AdditionalOptions;LIBS=/Project/ItemDefinitionGroup/Link/AdditionalDependencies;LINK_OPTIONS=/Project/ItemDefinitionGroup/Link/AdditionalOptions</QtBkup_QtVars>
<QtBkup_QMakeCodeLines
></QtBkup_QMakeCodeLines>
<QtBkup_QtBuildConfig
>debug</QtBkup_QtBuildConfig>
<QtVersion>6.2.4</QtVersion>
<QtVersionMajor>6</QtVersionMajor>
<QtVersionMinor>2</QtVersionMinor>
<QtVersionPatch>4</QtVersionPatch>
</PropertyGroup>
</Project>

@ -0,0 +1,7 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
QMAKE_CXX.QMAKE_MSC_VER = 1935
QMAKE_CXX.QMAKE_MSC_FULL_VER = 193532216
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_MSC_VER \
QMAKE_MSC_FULL_VER

@ -0,0 +1 @@
C:\Users\87334\AppData\Local\Temp\iu4xqqk1.ygq.designtime.props

@ -0,0 +1 @@
This is a dummy file needed to create ./moc_predefs.h

@ -0,0 +1,25 @@
QT_SYSROOT:
QT_INSTALL_PREFIX:D:/QT111/6.2.4/msvc2019_64
QT_INSTALL_ARCHDATA:D:/QT111/6.2.4/msvc2019_64
QT_INSTALL_DATA:D:/QT111/6.2.4/msvc2019_64
QT_INSTALL_DOCS:D:/QT111/Docs/Qt-6.2.4
QT_INSTALL_HEADERS:D:/QT111/6.2.4/msvc2019_64/include
QT_INSTALL_LIBS:D:/QT111/6.2.4/msvc2019_64/lib
QT_INSTALL_LIBEXECS:D:/QT111/6.2.4/msvc2019_64/bin
QT_INSTALL_BINS:D:/QT111/6.2.4/msvc2019_64/bin
QT_INSTALL_TESTS:D:/QT111/6.2.4/msvc2019_64/tests
QT_INSTALL_PLUGINS:D:/QT111/6.2.4/msvc2019_64/plugins
QT_INSTALL_QML:D:/QT111/6.2.4/msvc2019_64/qml
QT_INSTALL_TRANSLATIONS:D:/QT111/6.2.4/msvc2019_64/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:D:/QT111/Examples/Qt-6.2.4
QT_INSTALL_DEMOS:D:/QT111/Examples/Qt-6.2.4
QT_HOST_PREFIX:D:/QT111/6.2.4/msvc2019_64
QT_HOST_DATA:D:/QT111/6.2.4/msvc2019_64
QT_HOST_BINS:D:/QT111/6.2.4/msvc2019_64/bin
QT_HOST_LIBEXECS:D:/QT111/6.2.4/msvc2019_64/bin
QT_HOST_LIBS:D:/QT111/6.2.4/msvc2019_64/lib
QMAKE_SPEC:win32-msvc
QMAKE_XSPEC:win32-msvc
QMAKE_VERSION:3.1
QT_VERSION:6.2.4

@ -0,0 +1 @@
Info: creating stash file C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl\.qmake.stash

@ -0,0 +1,2 @@
CONFIG += no_fixpath
QT += core gui network widgets

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid></ProjectGuid>
<RootNamespace>qtvars</RootNamespace>
<Keyword>Qt4VSv1.0</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;" Label="Configuration">
<PlatformToolset>v143</PlatformToolset>
<OutputDirectory>.\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<PrimaryOutput>qtvars</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">.\</OutDir>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">qtvars</TargetName>
<IgnoreImportLibrary Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">true</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">
<ClCompile>
<AdditionalIncludeDirectories>C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;D:\QT111\6.2.4\msvc2019_64\include;D:\QT111\6.2.4\msvc2019_64\include\QtWidgets;D:\QT111\6.2.4\msvc2019_64\include\QtGui;D:\QT111\6.2.4\msvc2019_64\include\QtNetwork;D:\QT111\6.2.4\msvc2019_64\include\QtCore;C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;/include;D:\QT111\6.2.4\msvc2019_64\mkspecs\win32-msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>.\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<LanguageStandard>stdcpp17</LanguageStandard>
<ObjectFileName>.\</ObjectFileName>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>D:\QT111\6.2.4\msvc2019_64\lib\Qt6Widgetsd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Guid.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Networkd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Cored.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6EntryPointd.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>&quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot; %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutputFile>$(OutDir)\qtvars.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<CustomBuild Include="moc_predefs.h.cbt">
<FileType>Document</FileType>
<AdditionalInputs Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">D:\QT111\6.2.4\msvc2019_64\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">cl -BxD:\QT111\6.2.4\msvc2019_64\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -Zi -MDd -std:c++17 -utf-8 -W0 -E D:\QT111\6.2.4\msvc2019_64\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;moc_predefs.h</Command>
<Message Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">Generate moc_predefs.h</Message>
<Outputs Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;Debug|x64&apos;">moc_predefs.h;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

@ -0,0 +1,60 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Qt_DEFINES_>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB</Qt_DEFINES_>
<Qt_INCLUDEPATH_>C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;D:\QT111\6.2.4\msvc2019_64\include;D:\QT111\6.2.4\msvc2019_64\include\QtWidgets;D:\QT111\6.2.4\msvc2019_64\include\QtGui;D:\QT111\6.2.4\msvc2019_64\include\QtNetwork;D:\QT111\6.2.4\msvc2019_64\include\QtCore;C:\Users\87334\AppData\Local\Temp\uu20lcg5.zbl;/include;D:\QT111\6.2.4\msvc2019_64\mkspecs\win32-msvc</Qt_INCLUDEPATH_>
<Qt_STDCPP_>stdcpp17</Qt_STDCPP_>
<Qt_RUNTIME_>MultiThreadedDebugDLL</Qt_RUNTIME_>
<Qt_CL_OPTIONS_>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8</Qt_CL_OPTIONS_>
<Qt_LIBS_>D:\QT111\6.2.4\msvc2019_64\lib\Qt6Widgetsd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Guid.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Networkd.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6Cored.lib;D:\QT111\6.2.4\msvc2019_64\lib\Qt6EntryPointd.lib;shell32.lib</Qt_LIBS_>
<Qt_LINK_OPTIONS_>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"</Qt_LINK_OPTIONS_>
<QMake_QT_SYSROOT_></QMake_QT_SYSROOT_>
<QMake_QT_INSTALL_PREFIX_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_PREFIX_>
<QMake_QT_INSTALL_ARCHDATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_ARCHDATA_>
<QMake_QT_INSTALL_DATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_INSTALL_DATA_>
<QMake_QT_INSTALL_DOCS_>D:/QT111/Docs/Qt-6.2.4</QMake_QT_INSTALL_DOCS_>
<QMake_QT_INSTALL_HEADERS_>D:/QT111/6.2.4/msvc2019_64/include</QMake_QT_INSTALL_HEADERS_>
<QMake_QT_INSTALL_LIBS_>D:/QT111/6.2.4/msvc2019_64/lib</QMake_QT_INSTALL_LIBS_>
<QMake_QT_INSTALL_LIBEXECS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_INSTALL_LIBEXECS_>
<QMake_QT_INSTALL_BINS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_INSTALL_BINS_>
<QMake_QT_INSTALL_TESTS_>D:/QT111/6.2.4/msvc2019_64/tests</QMake_QT_INSTALL_TESTS_>
<QMake_QT_INSTALL_PLUGINS_>D:/QT111/6.2.4/msvc2019_64/plugins</QMake_QT_INSTALL_PLUGINS_>
<QMake_QT_INSTALL_QML_>D:/QT111/6.2.4/msvc2019_64/qml</QMake_QT_INSTALL_QML_>
<QMake_QT_INSTALL_TRANSLATIONS_>D:/QT111/6.2.4/msvc2019_64/translations</QMake_QT_INSTALL_TRANSLATIONS_>
<QMake_QT_INSTALL_CONFIGURATION_></QMake_QT_INSTALL_CONFIGURATION_>
<QMake_QT_INSTALL_EXAMPLES_>D:/QT111/Examples/Qt-6.2.4</QMake_QT_INSTALL_EXAMPLES_>
<QMake_QT_INSTALL_DEMOS_>D:/QT111/Examples/Qt-6.2.4</QMake_QT_INSTALL_DEMOS_>
<QMake_QT_HOST_PREFIX_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_HOST_PREFIX_>
<QMake_QT_HOST_DATA_>D:/QT111/6.2.4/msvc2019_64</QMake_QT_HOST_DATA_>
<QMake_QT_HOST_BINS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_HOST_BINS_>
<QMake_QT_HOST_LIBEXECS_>D:/QT111/6.2.4/msvc2019_64/bin</QMake_QT_HOST_LIBEXECS_>
<QMake_QT_HOST_LIBS_>D:/QT111/6.2.4/msvc2019_64/lib</QMake_QT_HOST_LIBS_>
<QMake_QMAKE_SPEC_>win32-msvc</QMake_QMAKE_SPEC_>
<QMake_QMAKE_XSPEC_>win32-msvc</QMake_QMAKE_XSPEC_>
<QMake_QMAKE_VERSION_>3.1</QMake_QMAKE_VERSION_>
<QMake_QT_VERSION_>6.2.4</QMake_QT_VERSION_>
<Qt_INCLUDEPATH_
>$(Qt_INCLUDEPATH_);x64\Debug\moc;x64\Debug\uic</Qt_INCLUDEPATH_>
<QtBkup_QtInstall
>6.2.4</QtBkup_QtInstall>
<QtBkup_QtModules
>core;gui;network;widgets</QtBkup_QtModules>
<QtBkup_QtPathBinaries
>bin</QtBkup_QtPathBinaries>
<QtBkup_QtPathLibraryExecutables
>bin</QtBkup_QtPathLibraryExecutables>
<QtBkup_QtHeaderSearchPath
></QtBkup_QtHeaderSearchPath>
<QtBkup_QtLibrarySearchPath
></QtBkup_QtLibrarySearchPath>
<QtBkup_QtVars
>DEFINES=/Project/ItemDefinitionGroup/ClCompile/PreprocessorDefinitions;INCLUDEPATH=/Project/ItemDefinitionGroup/ClCompile/AdditionalIncludeDirectories;STDCPP=/Project/ItemDefinitionGroup/ClCompile/LanguageStandard;RUNTIME=/Project/ItemDefinitionGroup/ClCompile/RuntimeLibrary;CL_OPTIONS=/Project/ItemDefinitionGroup/ClCompile/AdditionalOptions;LIBS=/Project/ItemDefinitionGroup/Link/AdditionalDependencies;LINK_OPTIONS=/Project/ItemDefinitionGroup/Link/AdditionalOptions</QtBkup_QtVars>
<QtBkup_QMakeCodeLines
></QtBkup_QMakeCodeLines>
<QtBkup_QtBuildConfig
>debug</QtBkup_QtBuildConfig>
<QtVersion>6.2.4</QtVersion>
<QtVersionMajor>6</QtVersionMajor>
<QtVersionMinor>2</QtVersionMinor>
<QtVersionPatch>4</QtVersionPatch>
</PropertyGroup>
</Project>

@ -0,0 +1,449 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt VS Tools.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="QPropertyData&lt;*&gt;">
<DisplayString>{val}</DisplayString>
<Expand>
<Item Name="[value]">val</Item>
</Expand>
</Type>
<Type Name="QQuickItemPrivate">
<Intrinsic Name="_hasExtraData" Expression="extra.d.d != 0" />
<Intrinsic Name="_extraData" Expression="(*(ExtraData*)extra.d.d)" />
<Intrinsic Name="_objectName" Expression="(extraData-&gt;objectName).val.d.ptr" />
<DisplayString Condition="_hasExtraData()">{{ x = {x,g}, y = {y,g}, z = {_extraData().z,g}, width = {width,g}, height = {height,g} }}</DisplayString>
<DisplayString>{{ x = {x,g}, y = {y,g}, width = {width,g}, height = {height,g} }}</DisplayString>
<Expand>
<Item Name="x">x</Item>
<Item Name="y">y</Item>
<Item Name="z" Condition="_hasExtraData()">_extraData().z</Item>
<Item Name="scale" Condition="_hasExtraData()">_extraData().scale</Item>
<Item Name="rotation" Condition="_hasExtraData()">_extraData().rotation</Item>
<Item Name="opacity" Condition="_hasExtraData()">_extraData().opacity</Item>
<Item Name="width">width</Item>
<Item Name="height">height</Item>
<Item Name="implicitWidth">implicitWidth</Item>
<Item Name="implicitHeight">implicitHeight</Item>
<Item Name="visible">effectiveVisible</Item>
<Item Name="enabled">explicitEnable</Item>
<Item Name="objectName" Condition="_objectName() != 0">_objectName(),na</Item>
<Item Name="parentItem">parentItem</Item>
<Item Name="childItems">childItems, nr</Item>
</Expand>
</Type>
<Type Name="QQuickItem">
<DisplayString>{d_ptr.d,na}</DisplayString>
<Expand>
<ExpandedItem>d_ptr.d</ExpandedItem>
</Expand>
</Type>
<Type Name="QUuid">
<DisplayString>{{{data1,Xb}-{data2,Xb}-{data3,Xb}-{(data4[0]),nvoXb}{(data4[1]),nvoXb}-{(data4[2]),nvoXb}{(data4[3]),nvoXb}{(data4[4]),nvoXb}{(data4[5]),nvoXb}{(data4[6]),nvoXb}{(data4[7]),nvoXb}}}</DisplayString>
</Type>
<Type Name="QSpecialInteger&lt;*&gt;">
<DisplayString>{val}</DisplayString>
<Expand>
<Item Name="[value]">val</Item>
</Expand>
</Type>
<Type Name="QBasicAtomicInteger&lt;*&gt;">
<DisplayString>{_q_value}</DisplayString>
<Expand>
<Item Name="[value]">_q_value</Item>
</Expand>
</Type>
<Type Name="QBasicAtomicPointer&lt;*&gt;">
<Intrinsic Name="isNull" Expression="value()==0" />
<Intrinsic Name="value" Expression="_q_value.value()" />
<DisplayString Condition="isNull()">empty</DisplayString>
<DisplayString Condition="!isNull()">{_q_value}</DisplayString>
<Expand>
<Item Name=" " Condition="!isNull()">*value()</Item>
</Expand>
</Type>
<Type Name="QPoint">
<AlternativeType Name="QPointF"/>
<DisplayString>{{ x = {xp}, y = {yp} }}</DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
</Expand>
</Type>
<Type Name="QRect">
<DisplayString>{{ x = {x1}, y = {y1}, width = {x2 - x1 + 1}, height = {y2 - y1 + 1} }}</DisplayString>
<Expand>
<Item Name="[x]">x1</Item>
<Item Name="[y]">y1</Item>
<Item Name="[width]">x2 - x1 + 1</Item>
<Item Name="[height]">y2 - y1 + 1</Item>
</Expand>
</Type>
<Type Name="QRectF">
<DisplayString>{{ x = {xp}, y = {yp}, width = {w}, height = {h} }}</DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[width]">w</Item>
<Item Name="[height]">h</Item>
</Expand>
</Type>
<Type Name="QSize">
<AlternativeType Name="QSizeF"/>
<DisplayString>{{ width = {wd}, height = {ht} }}</DisplayString>
<Expand>
<Item Name="[width]">wd</Item>
<Item Name="[height]">ht</Item>
</Expand>
</Type>
<Type Name="QLine">
<AlternativeType Name="QLineF"/>
<DisplayString>{{ start point = {pt1}, end point = {pt2} }}</DisplayString>
<Expand>
<Synthetic Name="[start point]">
<DisplayString>{pt1}</DisplayString>
<Expand>
<ExpandedItem>pt1</ExpandedItem>
</Expand>
</Synthetic>
<Synthetic Name="[end point]">
<DisplayString>{pt2}</DisplayString>
<Expand>
<ExpandedItem>pt2</ExpandedItem>
</Expand>
</Synthetic>
</Expand>
</Type>
<Type Name="QPolygon">
<DisplayString>{{ size={d-&gt;size} }}</DisplayString>
<Expand>
<Item Name="[referenced]">d-&gt;ref.atomic._q_value</Item>
<ArrayItems>
<Size>d-&gt;size</Size>
<ValuePointer>(QPoint*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QPolygonF">
<DisplayString>{{ size={d-&gt;size} }}</DisplayString>
<Expand>
<Item Name="[closed]">
d-&gt;size &gt; 0
&amp;&amp; ((((QPointF*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)[0]).xp
== (((QPointF*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)[d-&gt;size - 1]).xp)
&amp;&amp; ((((QPointF*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)[0]).yp
== (((QPointF*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)[d-&gt;size - 1]).yp)
</Item>
<Item Name="[referenced]">d-&gt;ref.atomic._q_value</Item>
<ArrayItems>
<Size>d-&gt;size</Size>
<ValuePointer>(QPointF*)((reinterpret_cast&lt;char*&gt;(d)) + d-&gt;offset)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QVector2D">
<DisplayString>{{ x = {xp}, y = {yp} }}</DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
</Expand>
</Type>
<Type Name="QVector3D">
<DisplayString>{{ x = {xp}, y = {yp}, z = {zp} }}</DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[z]">zp</Item>
</Expand>
</Type>
<Type Name="QVector4D">
<DisplayString>{{ x = {xp}, y = {yp}, z = {zp}, w = {wp} }}</DisplayString>
<Expand>
<Item Name="[x]">xp</Item>
<Item Name="[y]">yp</Item>
<Item Name="[z]">zp</Item>
<Item Name="[w]">wp</Item>
</Expand>
</Type>
<Type Name="QMatrix">
<DisplayString>
{{ m11 = {_m11}, m12 = {_m12}, m21 = {_m21}, m22 = {_m22}, ... }}
</DisplayString>
<Expand>
<Item Name="[m11]">_m11</Item>
<Item Name="[m12]">_m12</Item>
<Item Name="[m21]">_m21</Item>
<Item Name="[m22]">_m22</Item>
<Item Name="[dx]">_dx</Item>
<Item Name="[dy]">_dy</Item>
</Expand>
</Type>
<Type Name="QMatrix4x4">
<DisplayString>
{{ m11 = {m[0][0]}, m12 = {m[1][0]}, m13 = {m[2][0]}, m14 = {m[3][0]}, ... }}
</DisplayString>
<Expand>
<Item Name="[m11]">m[0][0]</Item>
<Item Name="[m12]">m[1][0]</Item>
<Item Name="[m13]">m[2][0]</Item>
<Item Name="[m14]">m[3][0]</Item>
<Item Name="[m21]">m[0][1]</Item>
<Item Name="[m22]">m[1][1]</Item>
<Item Name="[m23]">m[2][1]</Item>
<Item Name="[m24]">m[3][1]</Item>
<Item Name="[m31]">m[0][2]</Item>
<Item Name="[m32]">m[1][2]</Item>
<Item Name="[m33]">m[2][2]</Item>
<Item Name="[m34]">m[3][2]</Item>
<Item Name="[m41]">m[0][3]</Item>
<Item Name="[m42]">m[1][3]</Item>
<Item Name="[m43]">m[2][3]</Item>
<Item Name="[m44]">m[3][3]</Item>
</Expand>
</Type>
<Type Name="QSizePolicy">
<DisplayString>
{{ horizontal = {static_cast&lt;Policy&gt;(bits.horPolicy)}, vertical = {static_cast&lt;Policy&gt;(bits.verPolicy)}, type = {ControlType(1 &lt;&lt; bits.ctype)} }}
</DisplayString>
<Expand>
<Synthetic Name="[vertical policy]">
<DisplayString>QSizePolicy::Policy::{static_cast&lt;Policy&gt;(bits.verPolicy)}</DisplayString>
</Synthetic>
<Synthetic Name="[horizontal policy]">
<DisplayString>QSizePolicy::Policy::{static_cast&lt;Policy&gt;(bits.horPolicy)}</DisplayString>
</Synthetic>
<Synthetic Name="[control type]">
<DisplayString>QSizePolicy::ControlType::{ControlType(1 &lt;&lt; bits.ctype)}</DisplayString>
</Synthetic>
<Synthetic Name="[expanding directions]">
<DisplayString
Condition="(static_cast&lt;Policy&gt;(bits.verPolicy) &amp; ExpandFlag)">
Qt::Vertical (2)
</DisplayString>
<DisplayString
Condition="(static_cast&lt;Policy&gt;(bits.horPolicy) &amp; ExpandFlag)">
Qt::Horizontal (1)
</DisplayString>
</Synthetic>
<Item Name="[vertical stretch]">static_cast&lt;int&gt;(bits.verStretch)</Item>
<Item Name="[horizontal stretch]">static_cast&lt;int&gt;(bits.horStretch)</Item>
<Item Name="[has height for width]">bits.hfw == 1</Item>
<Item Name="[has width for height]">bits.wfh == 1</Item>
</Expand>
</Type>
<Type Name="QChar">
<DisplayString>{ucs,c}</DisplayString>
<StringView>ucs,c</StringView>
<Expand>
<Item Name="[latin 1]">ucs > 0xff ? '\0' : char(ucs),c</Item>
<Item Name="[unicode]">ucs,c</Item>
</Expand>
</Type>
<Type Name="QString">
<DisplayString>&quot;{(reinterpret_cast&lt;unsigned short*&gt;(d.ptr)),sub}&quot;</DisplayString>
<StringView>(reinterpret_cast&lt;unsigned short*&gt;(d.ptr)),sub</StringView>
<Expand>
<Item Name="[size]">d.size</Item>
<ArrayItems>
<Size>d.size</Size>
<ValuePointer>d.ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QStringRef">
<DisplayString Condition="m_string == nullptr">{m_string,[m_size]} u""</DisplayString>
<DisplayString Condition="m_string != nullptr">{m_string-&gt;d.ptr+m_position,[m_size]}</DisplayString>
<StringView Condition="m_string == nullptr">""</StringView>
<StringView Condition="m_string != nullptr">m_string,[m_position+m_size]</StringView>
<Expand>
<Item Name="[position]" ExcludeView="simple">m_position</Item>
<Item Name="[size]" ExcludeView="simple">m_size</Item>
<ArrayItems Condition="m_string != nullptr">
<Size>m_size</Size>
<ValuePointer>m_string-&gt;d.ptr+m_position</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QStringView">
<DisplayString>{m_data,[m_size]}</DisplayString>
<StringView>m_data,[m_size]</StringView>
<Expand>
<Item Name="[size]" ExcludeView="simple">m_size</Item>
<ArrayItems>
<Size>m_size</Size>
<ValuePointer>m_data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QByteArray">
<DisplayString>&quot;{((reinterpret_cast&lt;char*&gt;(d.ptr))),sb}&quot;</DisplayString>
<StringView>((reinterpret_cast&lt;char*&gt;(d.ptr))),sb</StringView>
<Expand>
<Item Name="[size]">d.size</Item>
<ArrayItems>
<Size>d.size</Size>
<ValuePointer>d.ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QUrl">
<Intrinsic Name="isEmpty" Expression="size==0">
<Parameter Name="size" Type="int"/>
</Intrinsic>
<Intrinsic Name="memberOffset" Expression="sizeof(QAtomicInt) + sizeof(int) + (sizeof(QString) * count)">
<Parameter Name="count" Type="int"/>
</Intrinsic>
<Intrinsic Name="scheme" Expression="*((QString*)(((char*)(d) + memberOffset(0))))" />
<Intrinsic Name="username" Expression="*((QString*)(((char*)(d) + memberOffset(1))))" />
<Intrinsic Name="password" Expression="*((QString*)(((char*)(d) + memberOffset(2))))" />
<Intrinsic Name="host" Expression="*((QString*)(((char*)(d) + memberOffset(3))))" />
<Intrinsic Name="path" Expression="*((QString*)(((char*)(d) + memberOffset(4))))" />
<Intrinsic Name="query" Expression="*((QString*)(((char*)(d) + memberOffset(5))))" />
<Intrinsic Name="fragment" Expression="*((QString*)(((char*)(d) + memberOffset(6))))" />
<DisplayString Condition="!isEmpty(scheme().d-&gt;size)">{scheme()}://{host()}{path()}</DisplayString>
<DisplayString Condition="isEmpty(scheme().d-&gt;size)">{path()}</DisplayString>
<Expand>
<Item Name="[scheme]">scheme()</Item>
<Item Name="[username]">username()</Item>
<Item Name="[password]">password()</Item>
<Item Name="[host]">host()</Item>
<Item Name="[path]">path()</Item>
<Item Name="[query]">query()</Item>
<Item Name="[fragment]">fragment()</Item>
</Expand>
</Type>
<Type Name="QDate">
<DisplayString>{{ julian day = {jd} }}</DisplayString>
</Type>
<Type Name="QTime">
<Intrinsic Name="hour" Expression="mds / 3600000" />
<Intrinsic Name="minute" Expression="(mds % 3600000) / 60000" />
<Intrinsic Name="second" Expression="(mds / 1000) % 60" />
<Intrinsic Name="millisecond" Expression="mds % 1000" />
<DisplayString Condition="mds == 1">{{ millisecond = {mds} }}</DisplayString>
<DisplayString Condition="mds != 1">{{ milliseconds = {mds} }}</DisplayString>
<Expand>
<Item Name="[hour]"
Condition="(mds / 3600000) == 1">hour(), d</Item>
<Item Name="[hours]"
Condition="(mds / 3600000) != 1">hour(), d</Item>
<Item Name="[minute]"
Condition="((mds % 3600000) / 60000) == 1">minute(), d</Item>
<Item Name="[minutes]"
Condition="((mds % 3600000) / 60000) != 1">minute(), d</Item>
<Item Name="[second]"
Condition="((mds / 1000) % 60) == 1">second(), d</Item>
<Item Name="[seconds]"
Condition="((mds / 1000) % 60) != 1">second(), d</Item>
<Item Name="[millisecond]"
Condition="(mds % 1000) == 1">millisecond(), d</Item>
<Item Name="[milliseconds]"
Condition="(mds % 1000) != 1">millisecond(), d</Item>
</Expand>
</Type>
<Type Name="QPair&lt;*,*&gt;">
<DisplayString>({first}, {second})</DisplayString>
<Expand>
<Item Name="[first]">first</Item>
<Item Name="[second]">second</Item>
</Expand>
</Type>
<Type Name="QList&lt;*&gt;">
<AlternativeType Name="QVector&lt;*&gt;"/>
<DisplayString>{{ size={d.size} }}</DisplayString>
<Expand>
<ArrayItems>
<Size>d.size</Size>
<ValuePointer>reinterpret_cast&lt;$T1*&gt;(d.ptr)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QVarLengthArray&lt;*&gt;">
<DisplayString>{{ size={s} }}</DisplayString>
<Expand>
<Item Name="[capacity]">a</Item>
<ArrayItems>
<Size>s</Size>
<ValuePointer>ptr</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="QMap&lt;*,*&gt;">
<AlternativeType Name="QMultiMap&lt;*,*&gt;"/>
<DisplayString>{{ size={d.d-&gt;m._Mypair._Myval2._Myval2._Mysize} }}</DisplayString>
<Expand>
<Item Name="[std::map]">d.d-&gt;m</Item>
</Expand>
</Type>
<Type Name="QHash&lt;*,*&gt;">
<AlternativeType Name="QMultiHash&lt;*,*&gt;"/>
<DisplayString>{{ size = {d-&gt;size} }}</DisplayString>
<Expand>
<Item Name="[referenced]">d-&gt;ref.atomic._q_value</Item>
</Expand>
</Type>
</AutoVisualizer>

@ -0,0 +1,46 @@
/****************************************************************************
** Resource object code
**
** Created by: The Resource Compiler for Qt version 6.2.4
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#ifdef QT_NAMESPACE
# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
# define QT_RCC_MANGLE_NAMESPACE0(x) x
# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b
# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)
# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \
QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
#else
# define QT_RCC_PREPEND_NAMESPACE(name) name
# define QT_RCC_MANGLE_NAMESPACE(name) name
#endif
#ifdef QT_NAMESPACE
namespace QT_NAMESPACE {
#endif
#ifdef QT_NAMESPACE
}
#endif
int QT_RCC_MANGLE_NAMESPACE(qInitResources_UAV_UI_new)();
int QT_RCC_MANGLE_NAMESPACE(qInitResources_UAV_UI_new)()
{
return 1;
}
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_UAV_UI_new)();
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_UAV_UI_new)()
{
return 1;
}
namespace {
struct initializer {
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_UAV_UI_new)(); }
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_UAV_UI_new)(); }
} dummy;
}

Binary file not shown.

@ -0,0 +1,173 @@
/********************************************************************************
** Form generated from reading UI file 'Setting.ui'
**
** Created by: Qt User Interface Compiler version 6.2.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_SETTING_H
#define UI_SETTING_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_SettingClass
{
public:
QWidget *centralWidget;
QWidget *gridLayoutWidget;
QGridLayout *gridLayout;
QLabel *Start_Timer;
QLineEdit *seconds;
QLineEdit *hours;
QLineEdit *longitude;
QLineEdit *minutes;
QLineEdit *latitude;
QLabel *Speed_Lable;
QLabel *label;
QLineEdit *x;
QLineEdit *y;
QLineEdit *z;
QPushButton *finished;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *SettingClass)
{
if (SettingClass->objectName().isEmpty())
SettingClass->setObjectName(QString::fromUtf8("SettingClass"));
SettingClass->resize(871, 571);
centralWidget = new QWidget(SettingClass);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
gridLayoutWidget = new QWidget(centralWidget);
gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
gridLayoutWidget->setGeometry(QRect(20, 20, 451, 241));
gridLayout = new QGridLayout(gridLayoutWidget);
gridLayout->setSpacing(6);
gridLayout->setContentsMargins(11, 11, 11, 11);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->setContentsMargins(0, 0, 0, 0);
Start_Timer = new QLabel(gridLayoutWidget);
Start_Timer->setObjectName(QString::fromUtf8("Start_Timer"));
gridLayout->addWidget(Start_Timer, 2, 0, 1, 1);
seconds = new QLineEdit(gridLayoutWidget);
seconds->setObjectName(QString::fromUtf8("seconds"));
seconds->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(seconds, 2, 3, 1, 1);
hours = new QLineEdit(gridLayoutWidget);
hours->setObjectName(QString::fromUtf8("hours"));
hours->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(hours, 2, 1, 1, 1);
longitude = new QLineEdit(gridLayoutWidget);
longitude->setObjectName(QString::fromUtf8("longitude"));
longitude->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(longitude, 0, 1, 1, 1);
minutes = new QLineEdit(gridLayoutWidget);
minutes->setObjectName(QString::fromUtf8("minutes"));
minutes->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(minutes, 2, 2, 1, 1);
latitude = new QLineEdit(gridLayoutWidget);
latitude->setObjectName(QString::fromUtf8("latitude"));
latitude->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(latitude, 0, 2, 1, 1);
Speed_Lable = new QLabel(gridLayoutWidget);
Speed_Lable->setObjectName(QString::fromUtf8("Speed_Lable"));
Speed_Lable->setMaximumSize(QSize(80, 16777215));
gridLayout->addWidget(Speed_Lable, 0, 0, 1, 1);
label = new QLabel(gridLayoutWidget);
label->setObjectName(QString::fromUtf8("label"));
label->setMaximumSize(QSize(16777215, 20));
gridLayout->addWidget(label, 1, 0, 1, 1);
x = new QLineEdit(gridLayoutWidget);
x->setObjectName(QString::fromUtf8("x"));
x->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(x, 1, 1, 1, 1);
y = new QLineEdit(gridLayoutWidget);
y->setObjectName(QString::fromUtf8("y"));
y->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(y, 1, 2, 1, 1);
z = new QLineEdit(gridLayoutWidget);
z->setObjectName(QString::fromUtf8("z"));
z->setMaximumSize(QSize(150, 16777215));
gridLayout->addWidget(z, 1, 3, 1, 1);
finished = new QPushButton(centralWidget);
finished->setObjectName(QString::fromUtf8("finished"));
finished->setGeometry(QRect(180, 290, 93, 29));
SettingClass->setCentralWidget(centralWidget);
menuBar = new QMenuBar(SettingClass);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 871, 26));
SettingClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(SettingClass);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
SettingClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(SettingClass);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
SettingClass->setStatusBar(statusBar);
retranslateUi(SettingClass);
QMetaObject::connectSlotsByName(SettingClass);
} // setupUi
void retranslateUi(QMainWindow *SettingClass)
{
SettingClass->setWindowTitle(QCoreApplication::translate("SettingClass", "Setting", nullptr));
Start_Timer->setText(QCoreApplication::translate("SettingClass", "\345\207\272\345\217\221\346\227\266\351\227\264\357\274\232", nullptr));
seconds->setPlaceholderText(QCoreApplication::translate("SettingClass", "\347\247\222", nullptr));
hours->setPlaceholderText(QCoreApplication::translate("SettingClass", "\346\227\266", nullptr));
longitude->setPlaceholderText(QCoreApplication::translate("SettingClass", "\347\273\217\345\272\246", nullptr));
minutes->setPlaceholderText(QCoreApplication::translate("SettingClass", "\345\210\206", nullptr));
latitude->setPlaceholderText(QCoreApplication::translate("SettingClass", "\347\272\254\345\272\246", nullptr));
Speed_Lable->setText(QCoreApplication::translate("SettingClass", "\347\233\256\347\232\204\345\234\260", nullptr));
label->setText(QCoreApplication::translate("SettingClass", "x,y,z", nullptr));
x->setPlaceholderText(QCoreApplication::translate("SettingClass", "0", nullptr));
y->setPlaceholderText(QCoreApplication::translate("SettingClass", "0", nullptr));
z->setPlaceholderText(QCoreApplication::translate("SettingClass", "0", nullptr));
finished->setText(QCoreApplication::translate("SettingClass", "\345\256\214\346\210\220", nullptr));
} // retranslateUi
};
namespace Ui {
class SettingClass: public Ui_SettingClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_SETTING_H

@ -0,0 +1,116 @@
/********************************************************************************
** Form generated from reading UI file 'UAV_UI_new.ui'
**
** Created by: Qt User Interface Compiler version 6.2.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_UAV_UI_NEW_H
#define UI_UAV_UI_NEW_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_UAV_UI_newClass
{
public:
QWidget *centralWidget;
QWidget *verticalLayoutWidget;
QVBoxLayout *verticalLayout;
QLabel *display;
QPushButton *stop;
QPushButton *connection;
QLabel *play_tag;
QPushButton *Settings;
QPushButton *action;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *UAV_UI_newClass)
{
if (UAV_UI_newClass->objectName().isEmpty())
UAV_UI_newClass->setObjectName(QString::fromUtf8("UAV_UI_newClass"));
UAV_UI_newClass->resize(1159, 682);
centralWidget = new QWidget(UAV_UI_newClass);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
verticalLayoutWidget = new QWidget(centralWidget);
verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget"));
verticalLayoutWidget->setGeometry(QRect(90, 60, 642, 509));
verticalLayoutWidget->setMinimumSize(QSize(640, 480));
verticalLayout = new QVBoxLayout(verticalLayoutWidget);
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
display = new QLabel(verticalLayoutWidget);
display->setObjectName(QString::fromUtf8("display"));
display->setEnabled(true);
display->setMinimumSize(QSize(640, 480));
display->setMaximumSize(QSize(640, 480));
verticalLayout->addWidget(display);
stop = new QPushButton(centralWidget);
stop->setObjectName(QString::fromUtf8("stop"));
stop->setGeometry(QRect(820, 140, 93, 29));
connection = new QPushButton(centralWidget);
connection->setObjectName(QString::fromUtf8("connection"));
connection->setGeometry(QRect(820, 70, 93, 29));
play_tag = new QLabel(centralWidget);
play_tag->setObjectName(QString::fromUtf8("play_tag"));
play_tag->setGeometry(QRect(100, 40, 81, 31));
Settings = new QPushButton(centralWidget);
Settings->setObjectName(QString::fromUtf8("Settings"));
Settings->setGeometry(QRect(1060, 0, 93, 29));
action = new QPushButton(centralWidget);
action->setObjectName(QString::fromUtf8("action"));
action->setGeometry(QRect(820, 200, 93, 29));
UAV_UI_newClass->setCentralWidget(centralWidget);
menuBar = new QMenuBar(UAV_UI_newClass);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 1159, 26));
UAV_UI_newClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(UAV_UI_newClass);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
UAV_UI_newClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(UAV_UI_newClass);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
UAV_UI_newClass->setStatusBar(statusBar);
retranslateUi(UAV_UI_newClass);
QMetaObject::connectSlotsByName(UAV_UI_newClass);
} // setupUi
void retranslateUi(QMainWindow *UAV_UI_newClass)
{
UAV_UI_newClass->setWindowTitle(QCoreApplication::translate("UAV_UI_newClass", "UAV_UI_new", nullptr));
display->setText(QString());
stop->setText(QCoreApplication::translate("UAV_UI_newClass", "stop", nullptr));
connection->setText(QCoreApplication::translate("UAV_UI_newClass", "connection", nullptr));
play_tag->setText(QCoreApplication::translate("UAV_UI_newClass", "\345\233\276\345\203\217\346\222\255\346\224\276\345\244\204", nullptr));
Settings->setText(QCoreApplication::translate("UAV_UI_newClass", "Settings", nullptr));
action->setText(QCoreApplication::translate("UAV_UI_newClass", "\345\207\272\350\255\246", nullptr));
} // retranslateUi
};
namespace Ui {
class UAV_UI_newClass: public Ui_UAV_UI_newClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_UAV_UI_NEW_H

@ -0,0 +1,66 @@
/********************************************************************************
** Form generated from reading UI file 'tips.ui'
**
** Created by: Qt User Interface Compiler version 6.2.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_TIPS_H
#define UI_TIPS_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_tipsClass
{
public:
QMenuBar *menuBar;
QToolBar *mainToolBar;
QWidget *centralWidget;
QStatusBar *statusBar;
void setupUi(QMainWindow *tipsClass)
{
if (tipsClass->objectName().isEmpty())
tipsClass->setObjectName(QString::fromUtf8("tipsClass"));
tipsClass->resize(600, 400);
menuBar = new QMenuBar(tipsClass);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
tipsClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(tipsClass);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
tipsClass->addToolBar(mainToolBar);
centralWidget = new QWidget(tipsClass);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
tipsClass->setCentralWidget(centralWidget);
statusBar = new QStatusBar(tipsClass);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
tipsClass->setStatusBar(statusBar);
retranslateUi(tipsClass);
QMetaObject::connectSlotsByName(tipsClass);
} // setupUi
void retranslateUi(QMainWindow *tipsClass)
{
tipsClass->setWindowTitle(QCoreApplication::translate("tipsClass", "tips", nullptr));
} // retranslateUi
};
namespace Ui {
class tipsClass: public Ui_tipsClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_TIPS_H

@ -0,0 +1,624 @@
/***************************************************************************************************************************
* command_to_mavros.h
*
* Author: Qyp
*
* Update Time: 2020.08.12
*
* Introduction: Drone control command send class using Mavros package
* 1. Ref to the Mavros plugins (setpoint_raw, loca_position, imu and etc..)
* 2. Ref to the Offboard Flight task in PX4 code: https://github.com/PX4/Firmware/blob/master/src/lib/FlightTasks/tasks/Offboard/FlightTaskOffboard.cpp
* 3. Ref to the Mavlink module in PX4 code: https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_receiver.cpp
* 4. Ref to the position control module in PX4: https://github.com/PX4/Firmware/blob/master/src/modules/mc_pos_control
* 5. Ref to the attitude control module in PX4: https://github.com/PX4/Firmware/blob/master/src/modules/mc_att_control
* 6.
*
* prometheus_controlmavros
* 1prometheus_controlmavros
* 2mavrosPX4
* 3
***************************************************************************************************************************/
#ifndef COMMAND_TO_MAVROS_H
#define COMMAND_TO_MAVROS_H
#include <ros/ros.h>
#include <math_utils.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
#include <mavros_msgs/AttitudeTarget.h>
#include <mavros_msgs/PositionTarget.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/TwistStamped.h>
#include <mavros_msgs/ActuatorControl.h>
#include <mavros_msgs/MountControl.h>
#include <sensor_msgs/Imu.h>
#include <prometheus_msgs/DroneState.h>
#include <bitset>
#include <prometheus_msgs/AttitudeReference.h>
#include <prometheus_msgs/DroneState.h>
using namespace std;
class command_to_mavros
{
public:
//constructed function 1
command_to_mavros(void):
command_nh("~")
{
command_nh.param<string>("uav_name", uav_name, "/uav0");
if (uav_name == "/uav0")
{
uav_name = "";
}
pos_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
vel_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
accel_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
q_fcu_target = Eigen::Quaterniond(0.0,0.0,0.0,0.0);
euler_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
rates_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
Thrust_target = 0.0;
// 【订阅】无人机期望位置/速度/加速度 坐标系:ENU系
// 本话题来自飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp读取), 对应Mavlink消息为POSITION_TARGET_LOCAL_NED, 对应的飞控中的uORB消息为vehicle_local_position_setpoint.msg
position_target_sub = command_nh.subscribe<mavros_msgs::PositionTarget>(uav_name + "/mavros/setpoint_raw/target_local", 10, &command_to_mavros::pos_target_cb,this);
// 【订阅】无人机期望角度/角速度 坐标系:ENU系
// 本话题来自飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp读取), 对应Mavlink消息为ATTITUDE_TARGET (#83), 对应的飞控中的uORB消息为vehicle_attitude_setpoint.msg
attitude_target_sub = command_nh.subscribe<mavros_msgs::AttitudeTarget>(uav_name + "/mavros/setpoint_raw/target_attitude", 10, &command_to_mavros::att_target_cb,this);
// 【订阅】无人机底层控制量Mx My Mz 及 F [0][1][2][3]分别对应 roll pitch yaw控制量 及 油门推力
// 本话题来自飞控(通过Mavros功能包 /plugins/actuator_control.cpp读取), 对应Mavlink消息为ACTUATOR_CONTROL_TARGET, 对应的飞控中的uORB消息为actuator_controls.msg
actuator_target_sub = command_nh.subscribe<mavros_msgs::ActuatorControl>(uav_name + "/mavros/target_actuator_control", 10, &command_to_mavros::actuator_target_cb,this);
// 【发布】位置/速度/加速度期望值 坐标系 ENU系
// 本话题要发送至飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp发送), 对应Mavlink消息为SET_POSITION_TARGET_LOCAL_NED (#84), 对应的飞控中的uORB消息为position_setpoint_triplet.msg
setpoint_raw_local_pub = command_nh.advertise<mavros_msgs::PositionTarget>(uav_name + "/mavros/setpoint_raw/local", 10);
// 【发布】角度/角速度期望值 坐标系 ENU系
// 本话题要发送至飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp发送), 对应Mavlink消息为SET_ATTITUDE_TARGET (#82), 对应的飞控中的uORB消息为vehicle_attitude_setpoint.msg角度 或vehicle_rates_setpoint.msg角速度
setpoint_raw_attitude_pub = command_nh.advertise<mavros_msgs::AttitudeTarget>(uav_name + "/mavros/setpoint_raw/attitude", 10);
// 【发布】底层控制量Mx My Mz 及 F [0][1][2][3]分别对应 roll pitch yaw控制量 及 油门推力 注意 这里是NED系的
// 本话题要发送至飞控(通过Mavros功能包 /plugins/actuator_control.cpp发送), 对应Mavlink消息为SET_ACTUATOR_CONTROL_TARGET, 对应的飞控中的uORB消息为actuator_controls.msg
actuator_setpoint_pub = command_nh.advertise<mavros_msgs::ActuatorControl>(uav_name + "/mavros/actuator_control", 10);
// 本话题要发送至飞控(通过Mavros_extra功能包 /plugins/mount_control.cpp发送)
mount_control_pub = command_nh.advertise<mavros_msgs::MountControl>(uav_name + "/mavros/mount_control/command", 1);
// 【服务】解锁/上锁
// 本服务通过Mavros功能包 /plugins/command.cpp 实现
arming_client = command_nh.serviceClient<mavros_msgs::CommandBool>(uav_name + "/mavros/cmd/arming");
// 【服务】修改系统模式
// 本服务通过Mavros功能包 /plugins/command.cpp 实现
set_mode_client = command_nh.serviceClient<mavros_msgs::SetMode>(uav_name + "/mavros/set_mode");
}
//constructed function 2
command_to_mavros(string Uav_name):
command_nh("")
{
uav_name = Uav_name;
pos_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
vel_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
accel_drone_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
q_fcu_target = Eigen::Quaterniond(0.0,0.0,0.0,0.0);
euler_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
rates_fcu_target = Eigen::Vector3d(0.0,0.0,0.0);
Thrust_target = 0.0;
// 【订阅】无人机期望位置/速度/加速度 坐标系:ENU系
// 本话题来自飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp读取), 对应Mavlink消息为POSITION_TARGET_LOCAL_NED, 对应的飞控中的uORB消息为vehicle_local_position_setpoint.msg
position_target_sub = command_nh.subscribe<mavros_msgs::PositionTarget>(uav_name + "/mavros/setpoint_raw/target_local", 10, &command_to_mavros::pos_target_cb,this);
// 【订阅】无人机期望角度/角速度 坐标系:ENU系
// 本话题来自飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp读取), 对应Mavlink消息为ATTITUDE_TARGET (#83), 对应的飞控中的uORB消息为vehicle_attitude_setpoint.msg
attitude_target_sub = command_nh.subscribe<mavros_msgs::AttitudeTarget>(uav_name + "/mavros/setpoint_raw/target_attitude", 10, &command_to_mavros::att_target_cb,this);
// 【订阅】无人机底层控制量Mx My Mz 及 F [0][1][2][3]分别对应 roll pitch yaw控制量 及 油门推力
// 本话题来自飞控(通过Mavros功能包 /plugins/actuator_control.cpp读取), 对应Mavlink消息为ACTUATOR_CONTROL_TARGET, 对应的飞控中的uORB消息为actuator_controls.msg
actuator_target_sub = command_nh.subscribe<mavros_msgs::ActuatorControl>(uav_name + "/mavros/target_actuator_control", 10, &command_to_mavros::actuator_target_cb,this);
// 【发布】位置/速度/加速度期望值 坐标系 ENU系
// 本话题要发送至飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp发送), 对应Mavlink消息为SET_POSITION_TARGET_LOCAL_NED (#84), 对应的飞控中的uORB消息为position_setpoint_triplet.msg
setpoint_raw_local_pub = command_nh.advertise<mavros_msgs::PositionTarget>(uav_name + "/mavros/setpoint_raw/local", 10);
// 【发布】角度/角速度期望值 坐标系 ENU系
// 本话题要发送至飞控(通过Mavros功能包 /plugins/setpoint_raw.cpp发送), 对应Mavlink消息为SET_ATTITUDE_TARGET (#82), 对应的飞控中的uORB消息为vehicle_attitude_setpoint.msg角度 或vehicle_rates_setpoint.msg角速度
setpoint_raw_attitude_pub = command_nh.advertise<mavros_msgs::AttitudeTarget>(uav_name + "/mavros/setpoint_raw/attitude", 10);
// 【发布】底层控制量Mx My Mz 及 F [0][1][2][3]分别对应 roll pitch yaw控制量 及 油门推力 注意 这里是NED系的
// 本话题要发送至飞控(通过Mavros功能包 /plugins/actuator_control.cpp发送), 对应Mavlink消息为SET_ACTUATOR_CONTROL_TARGET, 对应的飞控中的uORB消息为actuator_controls.msg
actuator_setpoint_pub = command_nh.advertise<mavros_msgs::ActuatorControl>(uav_name + "/mavros/actuator_control", 10);
// 本话题要发送至飞控(通过Mavros_extra功能包 /plugins/mount_control.cpp发送)
mount_control_pub = command_nh.advertise<mavros_msgs::MountControl>(uav_name + "/mavros/mount_control/command", 1);
// 【服务】解锁/上锁
// 本服务通过Mavros功能包 /plugins/command.cpp 实现
arming_client = command_nh.serviceClient<mavros_msgs::CommandBool>(uav_name + "/mavros/cmd/arming");
// 【服务】修改系统模式
// 本服务通过Mavros功能包 /plugins/command.cpp 实现
set_mode_client = command_nh.serviceClient<mavros_msgs::SetMode>(uav_name + "/mavros/set_mode");
}
string uav_name;
//Target pos of the drone [from fcu]
Eigen::Vector3d pos_drone_fcu_target;
//Target vel of the drone [from fcu]
Eigen::Vector3d vel_drone_fcu_target;
//Target accel of the drone [from fcu]
Eigen::Vector3d accel_drone_fcu_target;
//Target att of the drone [from fcu]
Eigen::Quaterniond q_fcu_target;
Eigen::Vector3d euler_fcu_target;
Eigen::Vector3d rates_fcu_target;
//Target thrust of the drone [from fcu]
float Thrust_target;
mavros_msgs::ActuatorControl actuator_target;
//变量声明 - 服务
mavros_msgs::SetMode mode_cmd;
mavros_msgs::CommandBool arm_cmd;
ros::ServiceClient arming_client;
ros::ServiceClient set_mode_client;
//Idle. Do nothing.
void idle();
//px4 takeoff
void takeoff();
//px4 loiter
void loiter();
// px4 land
void land();
//发送位置期望值至飞控输入期望xyz,期望yaw
void send_pos_setpoint(const Eigen::Vector3d& pos_sp, float yaw_sp);
//发送速度期望值至飞控输入期望vxvyvz,期望yaw
void send_vel_setpoint(const Eigen::Vector3d& vel_sp, float yaw_sp);
//发送速度期望值至飞控输入期望vxvy z,期望yaw
void send_vel_xy_pos_z_setpoint(const Eigen::Vector3d& state_sp, float yaw_sp);
void send_vel_xy_pos_z_setpoint_yawrate(const Eigen::Vector3d& state_sp, float yaw_rate_sp);
//发送速度期望值至飞控机体系输入期望vxvyvz,期望yaw
void send_vel_setpoint_body(const Eigen::Vector3d& vel_sp, float yaw_sp);
void send_vel_setpoint_yaw_rate(const Eigen::Vector3d& vel_sp, float yaw_rate_sp);
// 发送位置+速度期望值至飞控机体系输入期望xyz + vxvyvz,期望yaw
void send_pos_vel_xyz_setpoint(const Eigen::Vector3d& pos_sp, const Eigen::Vector3d& vel_sp, float yaw_sp);
//发送加速度期望值至飞控输入期望axayaz,期望yaw
void send_acc_xyz_setpoint(const Eigen::Vector3d& accel_sp, float yaw_sp);
//发送角度期望值至飞控(输入:期望角度-四元数,期望推力)
//这是px4_pos_controller.cpp中目前使用的控制方式
void send_attitude_setpoint(const prometheus_msgs::AttitudeReference& _AttitudeReference);
//发送角度期望值至飞控(输入:期望角速度,期望推力)
void send_attitude_rate_setpoint(const Eigen::Vector3d& attitude_rate_sp, float thrust_sp);
void send_attitude_setpoint_yawrate(const prometheus_msgs::AttitudeReference& _AttitudeReference, float yaw_rate_sp);
//发送底层至飞控输入MxMyMz,期望推力)[Not recommanded. Because the high delay between the onboard computer and Pixhawk]
void send_actuator_setpoint(const Eigen::Vector4d& actuator_sp);
//发送云台控制指令
void send_mount_control_command(const Eigen::Vector3d& gimbal_att_sp);
private:
ros::NodeHandle command_nh;
ros::Subscriber position_target_sub;
ros::Subscriber attitude_target_sub;
ros::Subscriber actuator_target_sub;
ros::Publisher setpoint_raw_local_pub;
ros::Publisher setpoint_raw_attitude_pub;
ros::Publisher actuator_setpoint_pub;
ros::Publisher mount_control_pub;
void pos_target_cb(const mavros_msgs::PositionTarget::ConstPtr& msg)
{
pos_drone_fcu_target = Eigen::Vector3d(msg->position.x, msg->position.y, msg->position.z);
vel_drone_fcu_target = Eigen::Vector3d(msg->velocity.x, msg->velocity.y, msg->velocity.z);
accel_drone_fcu_target = Eigen::Vector3d(msg->acceleration_or_force.x, msg->acceleration_or_force.y, msg->acceleration_or_force.z);
}
void att_target_cb(const mavros_msgs::AttitudeTarget::ConstPtr& msg)
{
q_fcu_target = Eigen::Quaterniond(msg->orientation.w, msg->orientation.x, msg->orientation.y, msg->orientation.z);
//Transform the Quaternion to euler Angles
euler_fcu_target = quaternion_to_euler(q_fcu_target);
rates_fcu_target = Eigen::Vector3d(msg->body_rate.x, msg->body_rate.y, msg->body_rate.z);
Thrust_target = msg->thrust;
}
void actuator_target_cb(const mavros_msgs::ActuatorControl::ConstPtr& msg)
{
actuator_target = *msg;
}
};
void command_to_mavros::send_mount_control_command(const Eigen::Vector3d& gimbal_att_sp)
{
mavros_msgs::MountControl mount_setpoint;
//
mount_setpoint.mode = 2;
mount_setpoint.pitch = gimbal_att_sp[0]; // Gimbal Pitch
mount_setpoint.roll = gimbal_att_sp[1]; // Gimbal Yaw
mount_setpoint.yaw = gimbal_att_sp[2]; // Gimbal Yaw
mount_control_pub.publish(mount_setpoint);
}
void command_to_mavros::takeoff()
{
mavros_msgs::PositionTarget pos_setpoint;
//飞控如何接收该信号请见mavlink_receiver.cpp
//飞控如何执行该指令请见FlightTaskOffboard.cpp
//需要在QGC设置起飞高度
pos_setpoint.type_mask = 0x1000;
setpoint_raw_local_pub.publish(pos_setpoint);
}
void command_to_mavros::land()
{
mavros_msgs::PositionTarget pos_setpoint;
//飞控如何接收该信号请见mavlink_receiver.cpp
//飞控如何执行该指令请见FlightTaskOffboard.cpp
//需要在QGC设置降落速度
pos_setpoint.type_mask = 0x2000;
setpoint_raw_local_pub.publish(pos_setpoint);
}
void command_to_mavros::loiter()
{
mavros_msgs::PositionTarget pos_setpoint;
//飞控如何接收该信号请见mavlink_receiver.cpp
//飞控如何执行该指令请见FlightTaskOffboard.cpp
pos_setpoint.type_mask = 0x3000;
setpoint_raw_local_pub.publish(pos_setpoint);
}
void command_to_mavros::idle()
{
mavros_msgs::PositionTarget pos_setpoint;
//飞控如何接收该信号请见mavlink_receiver.cpp
//飞控如何执行该指令请见FlightTaskOffboard.cpp
pos_setpoint.type_mask = 0x4000;
setpoint_raw_local_pub.publish(pos_setpoint);
}
//发送位置期望值至飞控输入期望xyz,期望yaw
void command_to_mavros::send_pos_setpoint(const Eigen::Vector3d& pos_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
//Bitmask toindicate which dimensions should be ignored (1 means ignore,0 means not ignore; Bit 10 must set to 0)
//Bit 1:x, bit 2:y, bit 3:z, bit 4:vx, bit 5:vy, bit 6:vz, bit 7:ax, bit 8:ay, bit 9:az, bit 10:is_force_sp, bit 11:yaw, bit 12:yaw_rate
//Bit 10 should set to 0, means is not force sp
pos_setpoint.type_mask = 0b100111111000; // 100 111 111 000 xyz + yaw
pos_setpoint.coordinate_frame = 1;
pos_setpoint.position.x = pos_sp[0];
pos_setpoint.position.y = pos_sp[1];
pos_setpoint.position.z = pos_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Pos_target [X Y Z] : " << pos_drone_fcu_target[0] << " [ m ] "<< pos_drone_fcu_target[1]<<" [ m ] "<<pos_drone_fcu_target[2]<<" [ m ] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
//发送速度期望值至飞控输入期望vxvyvz,期望yaw
void command_to_mavros::send_vel_setpoint(const Eigen::Vector3d& vel_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
pos_setpoint.type_mask = 0b100111000111;
pos_setpoint.coordinate_frame = 1;
pos_setpoint.velocity.x = vel_sp[0];
pos_setpoint.velocity.y = vel_sp[1];
pos_setpoint.velocity.z = vel_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Vel_target [X Y Z] : " << vel_drone_fcu_target[0] << " [m/s] "<< vel_drone_fcu_target[1]<<" [m/s] "<<vel_drone_fcu_target[2]<<" [m/s] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
//发送速度期望值至飞控输入期望vxvyvz,期望yaw
void command_to_mavros::send_vel_setpoint_yaw_rate(const Eigen::Vector3d& vel_sp, float yaw_rate_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
//Bitmask toindicate which dimensions should be ignored (1 means ignore,0 means not ignore; Bit 10 must set to 0)
//Bit 1:x, bit 2:y, bit 3:z, bit 4:vx, bit 5:vy, bit 6:vz, bit 7:ax, bit 8:ay, bit 9:az, bit 10:is_force_sp, bit 11:yaw, bit 12:yaw_rate
//Bit 10 should set to 0, means is not force sp
pos_setpoint.type_mask = 0b010111000111;
pos_setpoint.coordinate_frame = 1;
pos_setpoint.velocity.x = vel_sp[0];
pos_setpoint.velocity.y = vel_sp[1];
pos_setpoint.velocity.z = vel_sp[2];
pos_setpoint.yaw_rate = yaw_rate_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Vel_target [X Y Z] : " << vel_drone_fcu_target[0] << " [m/s] "<< vel_drone_fcu_target[1]<<" [m/s] "<<vel_drone_fcu_target[2]<<" [m/s] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
//发送速度期望值至飞控机体系输入期望vxvyvz,期望yaw
void command_to_mavros::send_vel_setpoint_body(const Eigen::Vector3d& vel_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
pos_setpoint.type_mask = 0b100111000111;
//uint8 FRAME_LOCAL_NED = 1
//uint8 FRAME_BODY_NED = 8
pos_setpoint.coordinate_frame = 8;
pos_setpoint.position.x = vel_sp[0];
pos_setpoint.position.y = vel_sp[1];
pos_setpoint.position.z = vel_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// // 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Vel_target [X Y Z] : " << vel_drone_fcu_target[0] << " [m/s] "<< vel_drone_fcu_target[1]<<" [m/s] "<<vel_drone_fcu_target[2]<<" [m/s] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
void command_to_mavros::send_vel_xy_pos_z_setpoint(const Eigen::Vector3d& state_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
// 此处由于飞控暂不支持位置速度追踪的复合模式因此type_mask设定如下
pos_setpoint.type_mask = 0b100111000011; // 100 111 000 011 vx vy vz z + yaw
pos_setpoint.coordinate_frame = 1;
pos_setpoint.velocity.x = state_sp[0];
pos_setpoint.velocity.y = state_sp[1];
pos_setpoint.velocity.z = 0.0;
pos_setpoint.position.z = state_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Vel_target [X Y Z] : " << vel_drone_fcu_target[0] << " [m/s] "<< vel_drone_fcu_target[1]<<" [m/s] "<<vel_drone_fcu_target[2]<<" [m/s] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
void command_to_mavros::send_vel_xy_pos_z_setpoint_yawrate(const Eigen::Vector3d& state_sp, float yaw_rate_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
// 此处由于飞控暂不支持位置速度追踪的复合模式因此type_mask设定如下
pos_setpoint.type_mask = 0b010111000011; // 100 111 000 011 vx vy vz z + yawrate
pos_setpoint.coordinate_frame = 1;
pos_setpoint.velocity.x = state_sp[0];
pos_setpoint.velocity.y = state_sp[1];
pos_setpoint.velocity.z = 0.0;
pos_setpoint.position.z = state_sp[2];
pos_setpoint.yaw_rate = yaw_rate_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Vel_target [X Y Z] : " << vel_drone_fcu_target[0] << " [m/s] "<< vel_drone_fcu_target[1]<<" [m/s] "<<vel_drone_fcu_target[2]<<" [m/s] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
void command_to_mavros::send_pos_vel_xyz_setpoint(const Eigen::Vector3d& pos_sp, const Eigen::Vector3d& vel_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
// 速度作为前馈项, 参见FlightTaskOffboard.cpp
// 2. position setpoint + velocity setpoint (velocity used as feedforward)
// 控制方法请见 PositionControl.cpp
pos_setpoint.type_mask = 0b100111000000; // 100 111 000 000 vx vy vz x y z+ yaw
pos_setpoint.coordinate_frame = 1;
pos_setpoint.position.x = pos_sp[0];
pos_setpoint.position.y = pos_sp[1];
pos_setpoint.position.z = pos_sp[2];
pos_setpoint.velocity.x = vel_sp[0];
pos_setpoint.velocity.y = vel_sp[1];
pos_setpoint.velocity.z = vel_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
}
//发送加速度期望值至飞控输入期望axayaz,期望yaw
void command_to_mavros::send_acc_xyz_setpoint(const Eigen::Vector3d& accel_sp, float yaw_sp)
{
mavros_msgs::PositionTarget pos_setpoint;
pos_setpoint.type_mask = 0b100000111111;
pos_setpoint.coordinate_frame = 1;
pos_setpoint.acceleration_or_force.x = accel_sp[0];
pos_setpoint.acceleration_or_force.y = accel_sp[1];
pos_setpoint.acceleration_or_force.z = accel_sp[2];
pos_setpoint.yaw = yaw_sp;
setpoint_raw_local_pub.publish(pos_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Acc_target [X Y Z] : " << accel_drone_fcu_target[0] << " [m/s^2] "<< accel_drone_fcu_target[1]<<" [m/s^2] "<<accel_drone_fcu_target[2]<<" [m/s^2] "<<endl;
// cout << "Yaw_target : " << euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
}
//发送角度期望值至飞控(输入:期望角度-四元数,期望推力)
void command_to_mavros::send_attitude_setpoint(const prometheus_msgs::AttitudeReference& _AttitudeReference)
{
mavros_msgs::AttitudeTarget att_setpoint;
//Mappings: If any of these bits are set, the corresponding input should be ignored:
//bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude
att_setpoint.type_mask = 0b00000111;
att_setpoint.orientation.x = _AttitudeReference.desired_att_q.x;
att_setpoint.orientation.y = _AttitudeReference.desired_att_q.y;
att_setpoint.orientation.z = _AttitudeReference.desired_att_q.z;
att_setpoint.orientation.w = _AttitudeReference.desired_att_q.w;
att_setpoint.thrust = _AttitudeReference.desired_throttle;
setpoint_raw_attitude_pub.publish(att_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Att_target [R P Y] : " << euler_fcu_target[0] * 180/M_PI <<" [deg] "<<euler_fcu_target[1] * 180/M_PI << " [deg] "<< euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
// cout << "Thr_target [0 - 1] : " << Thrust_target <<endl;
}
//发送角度期望值至飞控(输入:期望角度-四元数,期望推力)
void command_to_mavros::send_attitude_setpoint_yawrate(const prometheus_msgs::AttitudeReference& _AttitudeReference, float yaw_rate_sp)
{
mavros_msgs::AttitudeTarget att_setpoint;
//Mappings: If any of these bits are set, the corresponding input should be ignored:
//bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude
att_setpoint.type_mask = 0b00000011;
att_setpoint.orientation.x = _AttitudeReference.desired_att_q.x;
att_setpoint.orientation.y = _AttitudeReference.desired_att_q.y;
att_setpoint.orientation.z = _AttitudeReference.desired_att_q.z;
att_setpoint.orientation.w = _AttitudeReference.desired_att_q.w;
att_setpoint.thrust = _AttitudeReference.desired_throttle;
att_setpoint.body_rate.x = 0.0;
att_setpoint.body_rate.y = 0.0;
att_setpoint.body_rate.z = yaw_rate_sp;
setpoint_raw_attitude_pub.publish(att_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Att_target [R P Y] : " << euler_fcu_target[0] * 180/M_PI <<" [deg] "<<euler_fcu_target[1] * 180/M_PI << " [deg] "<< euler_fcu_target[2] * 180/M_PI<<" [deg] "<<endl;
// cout << "Thr_target [0 - 1] : " << Thrust_target <<endl;
}
//发送角度期望值至飞控(输入:期望角速度,期望推力)
void command_to_mavros::send_attitude_rate_setpoint(const Eigen::Vector3d& attitude_rate_sp, float thrust_sp)
{
mavros_msgs::AttitudeTarget att_setpoint;
//Mappings: If any of these bits are set, the corresponding input should be ignored:
//bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude
// msg.type_mask = 128; // Ignore orientation messages
att_setpoint.type_mask = 0b10000000;
att_setpoint.body_rate.x = attitude_rate_sp[0];
att_setpoint.body_rate.y = attitude_rate_sp[1];
att_setpoint.body_rate.z = attitude_rate_sp[2];
att_setpoint.thrust = thrust_sp;
setpoint_raw_attitude_pub.publish(att_setpoint);
// 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// cout << "Att_rate_target [R P Y] : " << rates_fcu_target[0] * 180/M_PI <<" [deg/s] "<<rates_fcu_target[1] * 180/M_PI << " [deg/s] "<< rates_fcu_target[2] * 180/M_PI<<" [deg/s] "<<endl;
// cout << "Thr_target [0 - 1] : " << Thrust_target <<endl;
}
//发送底层至飞控输入MxMyMz,期望推力)
void command_to_mavros::send_actuator_setpoint(const Eigen::Vector4d& actuator_sp)
{
mavros_msgs::ActuatorControl actuator_setpoint;
actuator_setpoint.group_mix = 0;
actuator_setpoint.controls[0] = actuator_sp(0);
actuator_setpoint.controls[1] = actuator_sp(1);
actuator_setpoint.controls[2] = actuator_sp(2);
actuator_setpoint.controls[3] = actuator_sp(3);
actuator_setpoint.controls[4] = 0.0;
actuator_setpoint.controls[5] = 0.0;
actuator_setpoint.controls[6] = 0.0;
actuator_setpoint.controls[7] = 0.0;
actuator_setpoint_pub.publish(actuator_setpoint);
// // 检查飞控是否收到控制量
// cout <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>command_to_mavros<<<<<<<<<<<<<<<<<<<<<<<<<<<" <<endl;
// //ned to enu
// cout << "actuator_target [0 1 2 3] : " << actuator_target.controls[0] << " [ ] "<< -actuator_target.controls[1] <<" [ ] "<<-actuator_target.controls[2]<<" [ ] "<<actuator_target.controls[3] <<" [ ] "<<endl;
// cout << "actuator_target [4 5 6 7] : " << actuator_target.controls[4] << " [ ] "<< actuator_target.controls[5] <<" [ ] "<<actuator_target.controls[6]<<" [ ] "<<actuator_target.controls[7] <<" [ ] "<<endl;
}
#endif

@ -0,0 +1,290 @@
/***************************************************************************************************************************
* controller_test.h
*
* Author: Qyp
*
* Update Time: 2020.1.10
* Controller_Test8
* 1线
* 28
* 3
***************************************************************************************************************************/
#ifndef CONTROLLER_TEST_H
#define CONTROLLER_TEST_H
#include <Eigen/Eigen>
#include <math.h>
#include <math_utils.h>
#include <prometheus_control_utils.h>
#include <prometheus_msgs/PositionReference.h>
#include <geometry_msgs/PoseStamped.h>
#include <nav_msgs/Path.h>
using namespace std;
class Controller_Test
{
public:
//构造函数
Controller_Test(void):
Controller_Test_nh("~")
{
Controller_Test_nh.param<float>("Controller_Test/Circle/Center_x", circle_center[0], 0.0);
Controller_Test_nh.param<float>("Controller_Test/Circle/Center_y", circle_center[1], 0.0);
Controller_Test_nh.param<float>("Controller_Test/Circle/Center_z", circle_center[2], 1.0);
Controller_Test_nh.param<float>("Controller_Test/Circle/circle_radius", circle_radius, 2.0);
Controller_Test_nh.param<float>("Controller_Test/Circle/linear_vel", linear_vel, 0.5);
Controller_Test_nh.param<float>("Controller_Test/Circle/direction", direction, 1.0);
Controller_Test_nh.param<float>("Controller_Test/Eight/Center_x", eight_origin_[0], 0.0);
Controller_Test_nh.param<float>("Controller_Test/Eight/Center_y", eight_origin_[1], 0.0);
Controller_Test_nh.param<float>("Controller_Test/Eight/Center_z", eight_origin_[2], 1.0);
Controller_Test_nh.param<float>("Controller_Test/Eight/omega", eight_omega_, 0.5);
Controller_Test_nh.param<float>("Controller_Test/Eight/radial", radial, 2.0);
Controller_Test_nh.param<float>("Controller_Test/Step/step_length", step_length, 0.0);
Controller_Test_nh.param<float>("Controller_Test/Step/step_interval", step_interval, 0.0);
}
//Printf the Controller_Test parameter
void printf_param();
//Controller_Test Calculation [Input: time_from_start; Output: Circle_trajectory;]
prometheus_msgs::PositionReference Circle_trajectory_generation(float time_from_start);
prometheus_msgs::PositionReference Eight_trajectory_generation(float time_from_start);
prometheus_msgs::PositionReference Step_trajectory_generation(float time_from_start);
prometheus_msgs::PositionReference Line_trajectory_generation(float time_from_start);
private:
ros::NodeHandle Controller_Test_nh;
// Circle Parameter
Eigen::Vector3f circle_center;
float circle_radius;
float linear_vel;
float direction; //direction = 1 for CCW 逆时针, direction = -1 for CW 顺时针
// Eight Shape Parameter
Eigen::Vector3f eight_origin_;
float radial;
float eight_omega_;
// Step
float step_length;
float step_interval;
};
prometheus_msgs::PositionReference Controller_Test::Circle_trajectory_generation(float time_from_start)
{
prometheus_msgs::PositionReference Circle_trajectory;
float omega;
if( circle_radius != 0)
{
omega = direction * fabs(linear_vel / circle_radius);
}else
{
omega = 0.0;
}
const float angle = time_from_start * omega;
const float cos_angle = cos(angle);
const float sin_angle = sin(angle);
// cout << "omega : " << omega * 180/M_PI <<" [deg/s] " <<endl;
// cout << "angle : " << angle * 180/M_PI <<" [deg] " <<endl;
Circle_trajectory.header.stamp = ros::Time::now();
Circle_trajectory.time_from_start = time_from_start;
Circle_trajectory.Move_mode = prometheus_msgs::PositionReference::TRAJECTORY;
Circle_trajectory.position_ref[0] = circle_radius * cos_angle + circle_center[0];
Circle_trajectory.position_ref[1] = circle_radius * sin_angle + circle_center[1];
Circle_trajectory.position_ref[2] = circle_center[2];
Circle_trajectory.velocity_ref[0] = - circle_radius * omega * sin_angle;
Circle_trajectory.velocity_ref[1] = circle_radius * omega * cos_angle;
Circle_trajectory.velocity_ref[2] = 0;
Circle_trajectory.acceleration_ref[0] = - circle_radius * pow(omega, 2.0) * cos_angle;
Circle_trajectory.acceleration_ref[1] = - circle_radius * pow(omega, 2.0) * sin_angle;
Circle_trajectory.acceleration_ref[2] = 0;
// Circle_trajectory.jerk_ref[0] = circle_radius * pow(omega, 3.0) * sin_angle;
// Circle_trajectory.jerk_ref[1] = - circle_radius * pow(omega, 3.0) * cos_angle;
// Circle_trajectory.jerk_ref[2] = 0;
// Circle_trajectory.snap_ref[0] = circle_radius * pow(omega, 4.0) * cos_angle;
// Circle_trajectory.snap_ref[1] = circle_radius * pow(omega, 4.0) * sin_angle;
// Circle_trajectory.snap_ref[2] = 0;
Circle_trajectory.yaw_ref = 0;
// Circle_trajectory.yaw_rate_ref = 0;
// Circle_trajectory.yaw_acceleration_ref = 0;
return Circle_trajectory;
}
prometheus_msgs::PositionReference Controller_Test::Line_trajectory_generation(float time_from_start)
{
prometheus_msgs::PositionReference Line_trajectory;
float omega;
if( circle_radius != 0)
{
omega = direction * fabs(linear_vel / circle_radius);
}else
{
omega = 0.0;
}
const float angle = time_from_start * omega;
const float cos_angle = cos(angle);
const float sin_angle = sin(angle);
Line_trajectory.header.stamp = ros::Time::now();
Line_trajectory.time_from_start = time_from_start;
Line_trajectory.Move_mode = prometheus_msgs::PositionReference::TRAJECTORY;
Line_trajectory.position_ref[0] = 0.0;
Line_trajectory.position_ref[1] = circle_radius * sin_angle + circle_center[1];
Line_trajectory.position_ref[2] = circle_center[2];
Line_trajectory.velocity_ref[0] = 0.0;
Line_trajectory.velocity_ref[1] = circle_radius * omega * cos_angle;
Line_trajectory.velocity_ref[2] = 0;
Line_trajectory.acceleration_ref[0] = 0.0;
Line_trajectory.acceleration_ref[1] = - circle_radius * pow(omega, 2.0) * sin_angle;
Line_trajectory.acceleration_ref[2] = 0;
// Line_trajectory.jerk_ref[0] = circle_radius * pow(omega, 3.0) * sin_angle;
// Line_trajectory.jerk_ref[1] = - circle_radius * pow(omega, 3.0) * cos_angle;
// Line_trajectory.jerk_ref[2] = 0;
// Line_trajectory.snap_ref[0] = circle_radius * pow(omega, 4.0) * cos_angle;
// Line_trajectory.snap_ref[1] = circle_radius * pow(omega, 4.0) * sin_angle;
// Line_trajectory.snap_ref[2] = 0;
Line_trajectory.yaw_ref = 0;
// Line_trajectory.yaw_rate_ref = 0;
// Line_trajectory.yaw_acceleration_ref = 0;
return Line_trajectory;
}
prometheus_msgs::PositionReference Controller_Test::Eight_trajectory_generation(float time_from_start)
{
Eigen::Vector3f position;
Eigen::Vector3f velocity;
Eigen::Vector3f acceleration;
float angle = eight_omega_* time_from_start;
const float cos_angle = cos(angle);
const float sin_angle = sin(angle);
Eigen::Vector3f eight_radial_ ;
Eigen::Vector3f eight_axis_ ;
eight_radial_ << radial, 0.0, 0.0;
eight_axis_ << 0.0, 0.0, 2.0;
position = cos_angle * eight_radial_ + sin_angle * cos_angle * eight_axis_.cross(eight_radial_)
+ (1 - cos_angle) * eight_axis_.dot(eight_radial_) * eight_axis_ + eight_origin_;
velocity = eight_omega_ * (-sin_angle * eight_radial_ + (pow(cos_angle, 2) - pow(sin_angle, 2)) * eight_axis_.cross(eight_radial_)
+ (sin_angle) * eight_axis_.dot(eight_radial_) * eight_axis_);
acceleration << 0.0, 0.0, 0.0;
prometheus_msgs::PositionReference Eight_trajectory;
Eight_trajectory.header.stamp = ros::Time::now();
Eight_trajectory.time_from_start = time_from_start;
Eight_trajectory.Move_mode = prometheus_msgs::PositionReference::TRAJECTORY;
Eight_trajectory.position_ref[0] = position[0];
Eight_trajectory.position_ref[1] = position[1];
Eight_trajectory.position_ref[2] = position[2];
Eight_trajectory.velocity_ref[0] = velocity[0];
Eight_trajectory.velocity_ref[1] = velocity[1];
Eight_trajectory.velocity_ref[2] = velocity[2];
Eight_trajectory.acceleration_ref[0] = 0;
Eight_trajectory.acceleration_ref[1] = 0;
Eight_trajectory.acceleration_ref[2] = 0;
Eight_trajectory.yaw_ref = 0;
// to be continued...
return Eight_trajectory;
}
prometheus_msgs::PositionReference Controller_Test::Step_trajectory_generation(float time_from_start)
{
prometheus_msgs::PositionReference Step_trajectory;
Step_trajectory.header.stamp = ros::Time::now();
Step_trajectory.time_from_start = time_from_start;
Step_trajectory.Move_mode = prometheus_msgs::PositionReference::TRAJECTORY;
int i = time_from_start / step_interval;
if( i%2 == 0)
{
Step_trajectory.position_ref[0] = step_length;
}else
{
Step_trajectory.position_ref[0] = - step_length;
}
Step_trajectory.position_ref[1] = 0;
Step_trajectory.position_ref[2] = 1.0;
Step_trajectory.velocity_ref[0] = 0;
Step_trajectory.velocity_ref[1] = 0;
Step_trajectory.velocity_ref[2] = 0;
Step_trajectory.acceleration_ref[0] = 0;
Step_trajectory.acceleration_ref[1] = 0;
Step_trajectory.acceleration_ref[2] = 0;
Step_trajectory.yaw_ref = 0;
return Step_trajectory;
}
// 【打印参数函数】
void Controller_Test::printf_param()
{
cout <<">>>>>>>>>>>>>>>>>>>>>>>>>Controller_Test Parameter <<<<<<<<<<<<<<<<<<<<<<" <<endl;
cout <<"Circle Shape: " <<endl;
cout <<"circle_center : " << circle_center[0] <<" [m] "<< circle_center[1] <<" [m] "<< circle_center[2] <<" [m] "<<endl;
cout <<"circle_radius : "<< circle_radius <<" [m] " <<"linear_vel : "<< linear_vel <<" [m/s] "<<"direction : "<< direction << endl;
cout <<"Eight Shape: " <<endl;
cout <<"eight_origin_ : "<< eight_origin_[0] <<" [m] "<< eight_origin_[1] <<" [m] "<< eight_origin_[2] <<" [m] "<<endl;
cout <<"eight_omega_ : "<< eight_omega_ <<" [rad/s] " << "radial : "<< radial << endl;
cout <<"Step: " <<endl;
cout <<"step_length : "<< step_length << " [m] step_interval : "<< step_interval << " [s] "<<endl;
}
#endif

@ -0,0 +1,701 @@
/***************************************************************************************************************************
* px4_sender.cpp
*
* Author: Qyp
*
* Update Time: 2020.10.18
*
* Introduction: PX4 command sender using px4 default command
* 1. Subscribe command.msg from upper nodes
* 2. Subscribe drone_state msg from px4_pos_estimator.cpp
* 2. Send command using command_to_mavros.h
* 3. Command includes: (1)idle
* (2)takeoff
* (3)land
* (4)hold
* (5)disarm
* (6)move:
* 1. xyz_pos + yaw in ENU/Body frame
* 2. xyz_vel + yaw in ENU/Body frame
* 3. xy_vel_z_pos + yaw in ENU/Body frame
* 4. xyz_acc + yaw in ENU/Body frame
* 5. trajectory 使
***************************************************************************************************************************/
#include <ros/ros.h>
#include "state_from_mavros.h"
#include "command_to_mavros.h"
#include "prometheus_control_utils.h"
#include "message_utils.h"
#include "control_common.h"
#include "printf_utils.h"
#include "prometheus_station_utils.h"
#define NODE_NAME "px4_sender"
using namespace std;
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>变量声明<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
float cur_time; //程序运行时间
float Takeoff_height; //默认起飞高度
float Disarm_height; //自动上锁高度
float Land_speed; //降落速度
int Land_mode; //降落策略选择
bool quick_land = false;
//Geigraphical fence 地理围栏
Eigen::Vector2f geo_fence_x;
Eigen::Vector2f geo_fence_y;
Eigen::Vector2f geo_fence_z;
Eigen::Vector3d Takeoff_position; // 起飞位置
prometheus_msgs::DroneState _DroneState; //无人机状态量
prometheus_msgs::ControlCommand Command_Now; //无人机当前执行命令
prometheus_msgs::ControlCommand Command_Last; //无人机上一条执行命令
Eigen::Vector3d state_sp(0,0,0);
Eigen::Vector3d state_sp_extra(0,0,0);
double yaw_sp;
double yaw_rate_sp;
prometheus_msgs::Message message;
prometheus_msgs::LogMessageControl LogMessage;
//RVIZ显示期望位置
geometry_msgs::PoseStamped ref_pose_rviz;
float dt = 0;
ros::Publisher rivz_ref_pose_pub;
ros::Publisher message_pub;
ros::Publisher log_message_pub;
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>函数声明<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void printf_param();
int check_failsafe();
geometry_msgs::PoseStamped get_rviz_ref_posistion(const prometheus_msgs::ControlCommand& cmd);
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>回调函数<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void Command_cb(const prometheus_msgs::ControlCommand::ConstPtr& msg)
{
// CommandID必须递增才会被记录
if( msg->Command_ID > Command_Now.Command_ID )
{
Command_Now = *msg;
}else
{
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "Wrong Command ID.");
}
// 无人机一旦接受到Disarm指令则会屏蔽其他指令
if(Command_Last.Mode == prometheus_msgs::ControlCommand::Disarm)
{
Command_Now = Command_Last;
}
}
void station_command_cb(const prometheus_msgs::ControlCommand::ConstPtr& msg)
{
Command_Now = *msg;
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "Get a command from Prometheus Station.");
// 无人机一旦接受到Disarm指令则会屏蔽其他指令
if(Command_Last.Mode == prometheus_msgs::ControlCommand::Disarm)
{
Command_Now = Command_Last;
}
}
void drone_state_cb(const prometheus_msgs::DroneState::ConstPtr& msg)
{
_DroneState = *msg;
_DroneState.time_from_start = cur_time;
}
void timerCallback(const ros::TimerEvent& e)
{
cout << GREEN <<">>>>>>>>>>>>>>>>>>>>>>>> PX4 SENDER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << TAIL <<endl;
//固定的浮点显示
cout.setf(ios::fixed);
//setprecision(n) 设显示小数精度为n位
cout<<setprecision(2);
//左对齐
cout.setf(ios::left);
// 强制显示小数点
cout.setf(ios::showpoint);
// 强制显示符号
cout.setf(ios::showpos);
// 【打印】无人机状态,包括位置,速度等数据信息
prometheus_station_utils::prinft_drone_state(_DroneState);
// 【打印】来自上层的控制指令
prometheus_station_utils::printf_command_control(Command_Now);
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>主 函 数<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
int main(int argc, char **argv)
{
ros::init(argc, argv, "px4_sender");
ros::NodeHandle nh("~");
//【订阅】指令
// 本话题为任务模块生成的控制指令
ros::Subscriber Command_sub = nh.subscribe<prometheus_msgs::ControlCommand>("/prometheus/control_command", 10, Command_cb);
//【订阅】指令
// 本话题为Prometheus地面站发送的控制指令
ros::Subscriber station_command_sub = nh.subscribe<prometheus_msgs::ControlCommand>("/prometheus/control_command_station", 10, station_command_cb);
//【订阅】无人机状态
// 本话题来自px4_pos_estimator.cpp
ros::Subscriber drone_state_sub = nh.subscribe<prometheus_msgs::DroneState>("/prometheus/drone_state", 10, drone_state_cb);
//【发布】参考位姿 RVIZ显示用
rivz_ref_pose_pub = nh.advertise<geometry_msgs::PoseStamped>("/prometheus/control/ref_pose_rviz", 10);
// 【发布】用于地面站显示的提示消息
message_pub = nh.advertise<prometheus_msgs::Message>("/prometheus/message/main", 10);
// 【发布】用于log的消息
log_message_pub = nh.advertise<prometheus_msgs::LogMessageControl>("/prometheus/log/control", 10);
// 10秒定时打印以确保程序在正确运行
ros::Timer timer = nh.createTimer(ros::Duration(10.0), timerCallback);
// 参数读取
nh.param<float>("Takeoff_height", Takeoff_height, 1.0);
nh.param<float>("Disarm_height", Disarm_height, 0.15);
nh.param<float>("Land_speed", Land_speed, 0.2);
nh.param<int>("Land_mode",Land_mode,0);
nh.param<float>("geo_fence/x_min", geo_fence_x[0], -100.0);
nh.param<float>("geo_fence/x_max", geo_fence_x[1], 100.0);
nh.param<float>("geo_fence/y_min", geo_fence_y[0], -100.0);
nh.param<float>("geo_fence/y_max", geo_fence_y[1], 100.0);
nh.param<float>("geo_fence/z_min", geo_fence_z[0], -100.0);
nh.param<float>("geo_fence/z_max", geo_fence_z[1], 100.0);
// 设定起飞位置
Takeoff_position[0] = 0.0;
Takeoff_position[1] = 0.0;
Takeoff_position[2] = 0.15;
// 建议控制频率 10 - 50Hz, 控制频率取决于控制形式,若控制方式为速度或加速度应适当提高频率
ros::Rate rate(20.0);
// 用于与mavros通讯的类通过mavros发送控制指令至飞控【本程序->mavros->飞控】
command_to_mavros _command_to_mavros;
printf_param();
// 初始化命令-
// 默认设置Idle模式 电机怠速旋转 等待来自上层的控制指令
Command_Now.Mode = prometheus_msgs::ControlCommand::Idle;
Command_Now.Command_ID = 0;
Command_Now.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_Now.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_Now.Reference_State.position_ref[0] = 0;
Command_Now.Reference_State.position_ref[1] = 0;
Command_Now.Reference_State.position_ref[2] = 0;
Command_Now.Reference_State.velocity_ref[0] = 0;
Command_Now.Reference_State.velocity_ref[1] = 0;
Command_Now.Reference_State.velocity_ref[2] = 0;
Command_Now.Reference_State.acceleration_ref[0] = 0;
Command_Now.Reference_State.acceleration_ref[1] = 0;
Command_Now.Reference_State.acceleration_ref[2] = 0;
Command_Now.Reference_State.yaw_ref = 0;
// 记录启控时间
ros::Time begin_time = ros::Time::now();
float last_time = prometheus_control_utils::get_time_in_sec(begin_time);
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>主 循 环<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
while(ros::ok())
{
// 当前时间
cur_time = prometheus_control_utils::get_time_in_sec(begin_time);
dt = cur_time - last_time;
dt = constrain_function2(dt, 0.02, 0.1);
last_time = cur_time;
// 执行回调函数
ros::spinOnce();
// Check for geo fence: If drone is out of the geo fence, it will land now.
if(Command_Now.Mode !=prometheus_msgs::ControlCommand::Idle )
{
int safety_flag = check_failsafe();
if(safety_flag == 1)
{
Command_Now.Mode = prometheus_msgs::ControlCommand::Land;
}else if(safety_flag == 2)
{
// 快速降落
Land_speed = 0.8;
quick_land = true;
Command_Now.Mode = prometheus_msgs::ControlCommand::Land;
}
}
switch (Command_Now.Mode)
{
// 【Idle】 怠速旋转此时可以切入offboard模式但不会起飞。
case prometheus_msgs::ControlCommand::Idle:
_command_to_mavros.idle();
// 设定yaw_ref=999时切换offboard模式并解锁
if(Command_Now.Reference_State.yaw_ref == 999)
{
if(_DroneState.mode != "OFFBOARD")
{
_command_to_mavros.mode_cmd.request.custom_mode = "OFFBOARD";
_command_to_mavros.set_mode_client.call(_command_to_mavros.mode_cmd);
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "Setting to OFFBOARD Mode...");
}else
{
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "The Drone is in OFFBOARD Mode already...");
}
if(!_DroneState.armed)
{
_command_to_mavros.arm_cmd.request.value = true;
_command_to_mavros.arming_client.call(_command_to_mavros.arm_cmd);
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "Arming...");
}else
{
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "The Drone is armd already...");
}
}
break;
// 【Takeoff】 从摆放初始位置原地起飞至指定高度,偏航角也保持当前角度
case prometheus_msgs::ControlCommand::Takeoff:
// 不能多次起飞!
// 此处起飞有一个bug则是飞机起飞会有很严重的超调没发现具体导致的因素
// 设定起飞点
if (Command_Last.Mode != prometheus_msgs::ControlCommand::Takeoff)
{
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "Takeoff to the desired point.");
// 设定起飞位置
Takeoff_position[0] = _DroneState.position[0];
Takeoff_position[1] = _DroneState.position[1];
Takeoff_position[2] = _DroneState.position[2];
//
Command_Now.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_Now.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_Now.Reference_State.position_ref[0] = Takeoff_position[0];
Command_Now.Reference_State.position_ref[1] = Takeoff_position[1];
Command_Now.Reference_State.position_ref[2] = Takeoff_position[2] + Takeoff_height;
Command_Now.Reference_State.yaw_ref = _DroneState.attitude[2];
state_sp = Eigen::Vector3d(Takeoff_position[0],Takeoff_position[1],Takeoff_position[2] + Takeoff_height);
yaw_sp = _DroneState.attitude[2]; //rad
}
_command_to_mavros.send_pos_setpoint(state_sp, yaw_sp);
//_command_to_mavros.takeoff(); 无用,未知原因
break;
// 【Hold】 悬停。当前位置悬停
case prometheus_msgs::ControlCommand::Hold:
if (Command_Last.Mode != prometheus_msgs::ControlCommand::Hold)
{
Command_Now.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_Now.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1];
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2];
Command_Now.Reference_State.yaw_ref = _DroneState.attitude[2]; //rad
state_sp = Eigen::Vector3d(_DroneState.position[0],_DroneState.position[1],_DroneState.position[2]);
yaw_sp = _DroneState.attitude[2]; //rad
}
_command_to_mavros.send_pos_setpoint(state_sp, yaw_sp);
//_command_to_mavros.loiter(); 可用,但不启用
break;
// 【Land】 降落。两种降落方式: 只有加载了参数Land_mode为1时启用第二种降落方式默认启用第一种降落方式。
// 第一种当前位置原地降落降落后会自动上锁且切换为mannual模式
// 第二种当前位置原地降落降落中到达Disarm_height后切换为飞控中land模式
case prometheus_msgs::ControlCommand::Land:
if(quick_land)
{
// 紧急降落
state_sp << 0.0, 0.0, -Land_speed;
yaw_sp = _DroneState.attitude[2]; //rad
_command_to_mavros.send_vel_setpoint(state_sp,yaw_sp);
}else if(Land_mode == 1)
{
if (Command_Last.Mode != prometheus_msgs::ControlCommand::Land)
{
Command_Now.Reference_State.Move_mode = prometheus_msgs::PositionReference::XY_POS_Z_VEL;
Command_Now.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1];
Command_Now.Reference_State.yaw_ref = _DroneState.attitude[2]; //rad
}
//如果距离起飞高度小于30厘米则直接切换为land模式
if(_DroneState.position[2] <= Disarm_height)
{
if(_DroneState.mode != "AUTO.LAND") // 无效
{
//此处切换会manual模式是因为:PX4默认在offboard模式且有控制的情况下没法上锁,直接使用飞控中的land模式
_command_to_mavros.mode_cmd.request.custom_mode = "AUTO.LAND";
_command_to_mavros.set_mode_client.call(_command_to_mavros.mode_cmd);
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "LAND: inter AUTO LAND filght mode");
}
}
else if(_DroneState.position[2] > Disarm_height)
{
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1];
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] - Land_speed * dt ;
Command_Now.Reference_State.velocity_ref[0] = 0.0;
Command_Now.Reference_State.velocity_ref[1] = 0.0;
Command_Now.Reference_State.velocity_ref[2] = - Land_speed; //Land_speed
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
state_sp_extra = Eigen::Vector3d(0.0,0.0,Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = _DroneState.attitude[2];
_command_to_mavros.send_pos_vel_xyz_setpoint(state_sp,state_sp_extra,yaw_sp);
}
if(_DroneState.landed)
{
Command_Now.Mode = prometheus_msgs::ControlCommand::Idle;
}
}else{
if (Command_Last.Mode != prometheus_msgs::ControlCommand::Land)
{
Command_Now.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_Now.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1];
Command_Now.Reference_State.yaw_ref = _DroneState.attitude[2]; //rad
}
if(_DroneState.position[2] > Disarm_height)
{
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] - Land_speed * dt ;
Command_Now.Reference_State.velocity_ref[0] = 0.0;
Command_Now.Reference_State.velocity_ref[1] = 0.0;
Command_Now.Reference_State.velocity_ref[2] = - Land_speed; //Land_speed
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1], Command_Now.Reference_State.position_ref[2] );
state_sp_extra = Eigen::Vector3d(0.0, 0.0 , Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
_command_to_mavros.send_pos_vel_xyz_setpoint(state_sp, state_sp_extra, yaw_sp);
}else
{
//此处切换会manual模式是因为:PX4默认在offboard模式且有控制的情况下没法上锁,直接使用飞控中的land模式
_command_to_mavros.mode_cmd.request.custom_mode = "MANUAL";
_command_to_mavros.set_mode_client.call(_command_to_mavros.mode_cmd);
_command_to_mavros.arm_cmd.request.value = false;
_command_to_mavros.arming_client.call(_command_to_mavros.arm_cmd);
pub_message(message_pub, prometheus_msgs::Message::NORMAL, NODE_NAME, "Disarming...");
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "LAND: switch to MANUAL filght mode");
}
}
break;
case prometheus_msgs::ControlCommand::Move:
// PX4暂不支持轨迹模式
// PX4暂不支持位置速度复合模式详细见mavlink_receiver.cpp
if(Command_Now.Reference_State.Move_frame == prometheus_msgs::PositionReference::ENU_FRAME)
{
if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_POS )
{
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_VEL )
{
state_sp = Eigen::Vector3d(Command_Now.Reference_State.velocity_ref[0],Command_Now.Reference_State.velocity_ref[1],Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_VEL_Z_POS )
{
state_sp = Eigen::Vector3d(Command_Now.Reference_State.velocity_ref[0],Command_Now.Reference_State.velocity_ref[1],Command_Now.Reference_State.position_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_POS_Z_VEL )
{
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] + Command_Now.Reference_State.velocity_ref[2] * dt;
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
state_sp_extra = Eigen::Vector3d(0.0, 0.0 ,Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_ACC )
{
state_sp = Eigen::Vector3d(Command_Now.Reference_State.acceleration_ref[0],Command_Now.Reference_State.acceleration_ref[1],Command_Now.Reference_State.acceleration_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
}
}else
{
if( Command_Now.Command_ID > Command_Last.Command_ID)
{
if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_POS )
{
float d_pos_body[2] = {Command_Now.Reference_State.position_ref[0], Command_Now.Reference_State.position_ref[1]}; //the desired xy position in Body Frame
float d_pos_enu[2]; //the desired xy position in enu Frame (The origin point is the drone)
prometheus_control_utils::rotation_yaw(_DroneState.attitude[2], d_pos_body, d_pos_enu);
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0] + d_pos_enu[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1] + d_pos_enu[1];
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] + Command_Now.Reference_State.position_ref[2];
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
yaw_sp = _DroneState.attitude[2] + Command_Now.Reference_State.yaw_ref;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_VEL )
{
//xy velocity mode
float d_vel_body[2] = {Command_Now.Reference_State.velocity_ref[0], Command_Now.Reference_State.velocity_ref[1]}; //the desired xy velocity in Body Frame
float d_vel_enu[2]; //the desired xy velocity in NED Frame
//根据无人机当前偏航角进行坐标系转换
prometheus_control_utils::rotation_yaw(_DroneState.attitude[2], d_vel_body, d_vel_enu);
Command_Now.Reference_State.velocity_ref[0] = d_vel_enu[0];
Command_Now.Reference_State.velocity_ref[1] = d_vel_enu[1];
state_sp = Eigen::Vector3d(Command_Now.Reference_State.velocity_ref[0],Command_Now.Reference_State.velocity_ref[1],Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = _DroneState.attitude[2] + Command_Now.Reference_State.yaw_ref;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_VEL_Z_POS )
{
//xy velocity mode
float d_vel_body[2] = {Command_Now.Reference_State.velocity_ref[0], Command_Now.Reference_State.velocity_ref[1]}; //the desired xy velocity in Body Frame
float d_vel_enu[2]; //the desired xy velocity in NED Frame
//根据无人机当前偏航角进行坐标系转换
prometheus_control_utils::rotation_yaw(_DroneState.attitude[2], d_vel_body, d_vel_enu);
Command_Now.Reference_State.position_ref[0] = 0;
Command_Now.Reference_State.position_ref[1] = 0;
Command_Now.Reference_State.velocity_ref[0] = d_vel_enu[0];
Command_Now.Reference_State.velocity_ref[1] = d_vel_enu[1];
Command_Now.Reference_State.velocity_ref[2] = 0.0;
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] + Command_Now.Reference_State.position_ref[2];
// 高度锁定为给定值 2021.3.24 云台追踪控制修改
state_sp = Eigen::Vector3d(Command_Now.Reference_State.velocity_ref[0],Command_Now.Reference_State.velocity_ref[1],Command_Now.Reference_State.position_ref[2]);
if(Command_Now.Reference_State.Move_frame == prometheus_msgs::PositionReference::MIX_FRAME)
{
// 2021.6.30 for color_line_following
yaw_sp = _DroneState.attitude[2] + Command_Now.Reference_State.yaw_ref;
}else
{
// 偏航角更新为锁定 2021.3.24 云台追踪控制修改
yaw_sp = Command_Now.Reference_State.yaw_ref + _DroneState.attitude[2] ;
}
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_POS_Z_VEL )
{
float d_pos_body[2] = {Command_Now.Reference_State.position_ref[0], Command_Now.Reference_State.position_ref[1]}; //the desired xy position in Body Frame
float d_pos_enu[2]; //the desired xy position in enu Frame (The origin point is the drone)
prometheus_control_utils::rotation_yaw(_DroneState.attitude[2], d_pos_body, d_pos_enu);
Command_Now.Reference_State.position_ref[0] = _DroneState.position[0] + d_pos_enu[0];
Command_Now.Reference_State.position_ref[1] = _DroneState.position[1] + d_pos_enu[1];
Command_Now.Reference_State.position_ref[2] = _DroneState.position[2] + Command_Now.Reference_State.velocity_ref[2] * dt;
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
state_sp_extra = Eigen::Vector3d(0.0, 0.0 ,Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = _DroneState.attitude[2] + Command_Now.Reference_State.yaw_ref;
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_ACC )
{
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "Not Defined. Change to ENU frame");
}
}
}
if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_POS )
{
_command_to_mavros.send_pos_setpoint(state_sp, yaw_sp);
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_VEL )
{
if(Command_Now.Reference_State.Yaw_Rate_Mode)
{
yaw_rate_sp = Command_Now.Reference_State.yaw_rate_ref;
_command_to_mavros.send_vel_setpoint_yaw_rate(state_sp, yaw_rate_sp);
}else
{
_command_to_mavros.send_vel_setpoint(state_sp, yaw_sp);
}
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_VEL_Z_POS )
{
if(Command_Now.Reference_State.Yaw_Rate_Mode)
{
yaw_rate_sp = Command_Now.Reference_State.yaw_rate_ref;
_command_to_mavros.send_vel_xy_pos_z_setpoint_yawrate(state_sp, yaw_rate_sp);
}else
{
_command_to_mavros.send_vel_xy_pos_z_setpoint(state_sp, yaw_sp);
}
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_POS_Z_VEL )
{
// 特殊情况,一般也用不到
_command_to_mavros.send_pos_vel_xyz_setpoint(state_sp, state_sp_extra, yaw_sp);
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_ACC )
{
_command_to_mavros.send_acc_xyz_setpoint(state_sp, yaw_sp);
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::TRAJECTORY )
{
state_sp = Eigen::Vector3d(Command_Now.Reference_State.position_ref[0],Command_Now.Reference_State.position_ref[1],Command_Now.Reference_State.position_ref[2]);
state_sp_extra = Eigen::Vector3d(Command_Now.Reference_State.velocity_ref[0], Command_Now.Reference_State.velocity_ref[1] ,Command_Now.Reference_State.velocity_ref[2]);
yaw_sp = Command_Now.Reference_State.yaw_ref;
_command_to_mavros.send_pos_vel_xyz_setpoint(state_sp, state_sp_extra,yaw_sp);
}else
{
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "Not Defined. Hold there");
_command_to_mavros.loiter();
}
break;
// 【Disarm】 上锁
case prometheus_msgs::ControlCommand::Disarm:
pub_message(message_pub, prometheus_msgs::Message::WARN, NODE_NAME, "Disarm: switch to MANUAL flight mode");
if(_DroneState.mode == "OFFBOARD")
{
_command_to_mavros.mode_cmd.request.custom_mode = "MANUAL";
_command_to_mavros.set_mode_client.call(_command_to_mavros.mode_cmd);
}
if(_DroneState.armed)
{
_command_to_mavros.arm_cmd.request.value = false;
_command_to_mavros.arming_client.call(_command_to_mavros.arm_cmd);
}
break;
// 【User_Mode1】 暂空。可进行自定义
case prometheus_msgs::ControlCommand::User_Mode1:
break;
// 【User_Mode2】 暂空。可进行自定义
case prometheus_msgs::ControlCommand::User_Mode2:
break;
}
//发布用于RVIZ显示的位姿
ref_pose_rviz = get_rviz_ref_posistion(Command_Now);
rivz_ref_pose_pub.publish(ref_pose_rviz);
//发布log消息可用rosbag记录
LogMessage.control_type = PX4_SENDER;
LogMessage.time = cur_time;
LogMessage.Drone_State = _DroneState;
LogMessage.Control_Command = Command_Now;
LogMessage.ref_pose = ref_pose_rviz;
log_message_pub.publish(LogMessage);
Command_Last = Command_Now;
rate.sleep();
}
return 0;
}
void printf_param()
{
cout <<">>>>>>>>>>>>>>>>>>>>>>>> px4_sender Parameter <<<<<<<<<<<<<<<<<<<<<<" <<endl;
cout << "Takeoff_height : "<< Takeoff_height<<" [m] "<<endl;
cout << "Disarm_height : "<< Disarm_height <<" [m] "<<endl;
cout << "Land_speed : "<< Land_speed <<" [m/s] "<<endl;
cout << "Land_mode : "<< Land_mode << endl;
cout << "geo_fence_x : "<< geo_fence_x[0] << " [m] to "<<geo_fence_x[1] << " [m]"<< endl;
cout << "geo_fence_y : "<< geo_fence_y[0] << " [m] to "<<geo_fence_y[1] << " [m]"<< endl;
cout << "geo_fence_z : "<< geo_fence_z[0] << " [m] to "<<geo_fence_z[1] << " [m]"<< endl;
}
int check_failsafe()
{
if (_DroneState.position[0] < geo_fence_x[0] || _DroneState.position[0] > geo_fence_x[1] ||
_DroneState.position[1] < geo_fence_y[0] || _DroneState.position[1] > geo_fence_y[1] ||
_DroneState.position[2] < geo_fence_z[0] || _DroneState.position[2] > geo_fence_z[1])
{
cout << RED <<":----> Out of the geo fence, the drone is landing..."<< TAIL << endl;
return 1;
}else if(!_DroneState.odom_valid)
{
cout << RED <<":----> Mocap valid..., land quickly!"<< TAIL << endl;
return 2;
}
else{
return 0;
}
}
geometry_msgs::PoseStamped get_rviz_ref_posistion(const prometheus_msgs::ControlCommand& cmd)
{
geometry_msgs::PoseStamped ref_pose;
ref_pose.header.stamp = ros::Time::now();
// world: 世界系,即gazebo坐标系,参见tf_transform.launch
ref_pose.header.frame_id = "world";
if(cmd.Mode == prometheus_msgs::ControlCommand::Idle)
{
ref_pose.pose.position.x = _DroneState.position[0];
ref_pose.pose.position.y = _DroneState.position[1];
ref_pose.pose.position.z = _DroneState.position[2];
ref_pose.pose.orientation = _DroneState.attitude_q;
}else if(cmd.Mode == prometheus_msgs::ControlCommand::Takeoff || cmd.Mode == prometheus_msgs::ControlCommand::Hold)
{
ref_pose.pose.position.x = cmd.Reference_State.position_ref[0];
ref_pose.pose.position.y = cmd.Reference_State.position_ref[1];
ref_pose.pose.position.z = cmd.Reference_State.position_ref[2];
ref_pose.pose.orientation = _DroneState.attitude_q;
}else if(cmd.Mode == prometheus_msgs::ControlCommand::Disarm || cmd.Mode == prometheus_msgs::ControlCommand::Land )
{
ref_pose.pose.position.x = cmd.Reference_State.position_ref[0];
ref_pose.pose.position.y = cmd.Reference_State.position_ref[1];
ref_pose.pose.position.z = 0.0;
ref_pose.pose.orientation = _DroneState.attitude_q;
}
else if(cmd.Mode == prometheus_msgs::ControlCommand::Move)
{
if( cmd.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_POS )
{
ref_pose.pose.position.x = cmd.Reference_State.position_ref[0];
ref_pose.pose.position.y = cmd.Reference_State.position_ref[1];
ref_pose.pose.position.z = cmd.Reference_State.position_ref[2];
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_VEL )
{
ref_pose.pose.position.x = _DroneState.position[0] + cmd.Reference_State.velocity_ref[0] * dt;
ref_pose.pose.position.y = _DroneState.position[1] + cmd.Reference_State.velocity_ref[1] * dt;
ref_pose.pose.position.z = _DroneState.position[2] + cmd.Reference_State.velocity_ref[2] * dt;
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_VEL_Z_POS )
{
ref_pose.pose.position.x = _DroneState.position[0] + cmd.Reference_State.velocity_ref[0] * dt;
ref_pose.pose.position.y = _DroneState.position[1] + cmd.Reference_State.velocity_ref[1] * dt;
ref_pose.pose.position.z = cmd.Reference_State.position_ref[2];
}else if( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XY_POS_Z_VEL )
{
ref_pose.pose.position.x = cmd.Reference_State.position_ref[0];
ref_pose.pose.position.y = cmd.Reference_State.position_ref[1];
ref_pose.pose.position.z = _DroneState.position[2] + cmd.Reference_State.velocity_ref[2] * dt;
}else if ( Command_Now.Reference_State.Move_mode == prometheus_msgs::PositionReference::XYZ_ACC )
{
ref_pose.pose.position.x = _DroneState.position[0] + 0.5 * cmd.Reference_State.acceleration_ref[0] * dt * dt;
ref_pose.pose.position.y = _DroneState.position[1] + 0.5 * cmd.Reference_State.acceleration_ref[1] * dt * dt;
ref_pose.pose.position.z = _DroneState.position[2] + 0.5 * cmd.Reference_State.acceleration_ref[2] * dt * dt;
}
ref_pose.pose.orientation = _DroneState.attitude_q;
}else
{
ref_pose.pose.position.x = 0.0;
ref_pose.pose.position.y = 0.0;
ref_pose.pose.position.z = 0.0;
ref_pose.pose.orientation = _DroneState.attitude_q;
}
return ref_pose;
}

@ -0,0 +1,889 @@
/***************************************************************************************************************************
* terminal_control.cpp
*
* Author: Qyp
*
* Update Time: 2020.11.4
*
* Introduction: test function for sending ControlCommand.msg
***************************************************************************************************************************/
#include <ros/ros.h>
#include <iostream>
#include <prometheus_msgs/ControlCommand.h>
#include <mavros_msgs/CommandBool.h>
#include <mavros_msgs/SetMode.h>
#include <mavros_msgs/State.h>
#include <nav_msgs/Path.h>
#include "controller_test.h"
#include "KeyboardEvent.h"
//json数据库
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <jsoncpp/json/json.h>
#include <ctime>
#define HOST "192.168.43.58"
#define PORT 1900
#define VEL_XY_STEP_SIZE 0.1
#define VEL_Z_STEP_SIZE 0.1
#define YAW_STEP_SIZE 0.08
#define TRA_WINDOW 2000
#define NODE_NAME "terminal_control"
using namespace std;
//即将发布的command
prometheus_msgs::ControlCommand Command_to_pub;
//轨迹容器
std::vector<geometry_msgs::PoseStamped> posehistory_vector_;
float time_trajectory = 0.0;
// 轨迹追踪总时长,键盘控制时固定时长,指令输入控制可调
float trajectory_total_time = 50.0;
//发布
ros::Publisher move_pub;
ros::Publisher ref_trajectory_pub;
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 函数声明 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void mainloop1();
void mainloop2();
void generate_com(int Move_mode, float state_desired[4]);
void Draw_in_rviz(const prometheus_msgs::PositionReference& pos_ref, bool draw_trajectory);
void timerCallback(const ros::TimerEvent& e)
{
cout << ">>>>>>>>>>>>>>>> Welcome to use Prometheus Terminal Control <<<<<<<<<<<<<<<<"<< endl;
cout << "ENTER key to control the drone: " <<endl;
cout << "1 for Arm, Space for Takeoff, L for Land, H for Hold, 0 for Disarm, 8/9 for Trajectory tracking" <<endl;
cout << "Move mode is fixed (XYZ_VEL,BODY_FRAME): w/s for body_x, a/d for body_y, k/m for z, q/e for body_yaw" <<endl;
cout << "CTRL-C to quit." <<endl;
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 主函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
int main(int argc, char **argv)
{
ros::init(argc, argv, "terminal_control");
ros::NodeHandle nh;
// 【发布】 控制指令
move_pub = nh.advertise<prometheus_msgs::ControlCommand>("/prometheus/control_command", 10);
// 【发布】 参考轨迹
ref_trajectory_pub = nh.advertise<nav_msgs::Path>("/prometheus/reference_trajectory", 10);
//用于控制器测试的类,功能例如:生成圆形轨迹,8字轨迹等
Controller_Test Controller_Test; // 打印参数
Controller_Test.printf_param();
// 初始化命令 - Idle模式 电机怠速旋转 等待来自上层的控制指令
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Idle;
Command_to_pub.Command_ID = 0;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::ENU_FRAME;
Command_to_pub.Reference_State.position_ref[0] = 0;
Command_to_pub.Reference_State.position_ref[1] = 0;
Command_to_pub.Reference_State.position_ref[2] = 0;
Command_to_pub.Reference_State.velocity_ref[0] = 0;
Command_to_pub.Reference_State.velocity_ref[1] = 0;
Command_to_pub.Reference_State.velocity_ref[2] = 0;
Command_to_pub.Reference_State.acceleration_ref[0] = 0;
Command_to_pub.Reference_State.acceleration_ref[1] = 0;
Command_to_pub.Reference_State.acceleration_ref[2] = 0;
Command_to_pub.Reference_State.yaw_ref = 0;
//固定的浮点显示
cout.setf(ios::fixed);
//setprecision(n) 设显示小数精度为n位
cout<<setprecision(2);
//左对齐
cout.setf(ios::left);
// 强制显示小数点
cout.setf(ios::showpoint);
// 强制显示符号
//cout.setf(ios::showpos);
// 选择通过终端输入控制或键盘控制
int Remote_Mode;
cout << ">>>>>>>>>>>>>>>> Welcome to use Prometheus Terminal Control <<<<<<<<<<<<<<<<"<< endl;
cout << "Please choose the Remote Mode: 0 for command input control, 1 for keyboard input control"<<endl;
cin >> Remote_Mode;
if (Remote_Mode == 0)
{
cout << "Command input control mode"<<endl;
mainloop1();
}else if(Remote_Mode == 1)
{
ros::Timer timer = nh.createTimer(ros::Duration(30.0), timerCallback);
cout << "Keyboard input control mode"<<endl;
mainloop2();
}
return 0;
}
void mainloop1()
{
int Control_Mode = 0;
int Move_mode = 0;
int Move_frame = 0;
int Trjectory_mode = 0;
float state_desired[4];
Controller_Test Controller_Test;
while(ros::ok())
{
// Waiting for input
cout << ">>>>>>>>>>>>>>>> Welcome to use Prometheus Terminal Control <<<<<<<<<<<<<<<<"<< endl;
cout << "Please choose the Command.Mode: 0 for Idle, 1 for Takeoff, 2 for Hold, 3 for Land, 4 for Move, 5 for Disarm, 6 for User_Mode1, 7 for User_Mode2"<<endl;
cout << "Input 999 to switch to offboard mode and arm the drone (ONLY for simulation, please use RC in experiment!!!)"<<endl;
cin >> Control_Mode;
if(Control_Mode == prometheus_msgs::ControlCommand::Move)
{
cout << "Please choose the Command.Reference_State.Move_mode: 0 for XYZ_POS, 1 for XY_POS_Z_VEL, 2 for XY_VEL_Z_POS, 3 for XYZ_VEL, 5 for TRAJECTORY"<<endl;
cin >> Move_mode;
if(Move_mode == prometheus_msgs::PositionReference::TRAJECTORY)
{
cout << "For safety, please move the drone near to the trajectory start point firstly!!!"<<endl;
cout << "Please choose the trajectory type: 0 for Circle, 1 for Eight Shape, 2 for Step, 3 for Line"<<endl;
cin >> Trjectory_mode;
cout << "Input the trajectory_total_time:"<<endl;
cin >> trajectory_total_time;
}else
{
cout << "Please choose the Command.Reference_State.Move_frame: 0 for ENU_FRAME, 1 for BODY_FRAME"<<endl;
cin >> Move_frame;
cout << "Please input the reference state [x y z yaw]: "<< endl;
cout << "setpoint_t[0] --- x [m] : "<< endl;
cin >> state_desired[0];
cout << "setpoint_t[1] --- y [m] : "<< endl;
cin >> state_desired[1];
cout << "setpoint_t[2] --- z [m] : "<< endl;
cin >> state_desired[2];
cout << "setpoint_t[3] --- yaw [du] : "<< endl;
cin >> state_desired[3];
}
}
else if(Control_Mode == prometheus_msgs::ControlCommand::User_Mode1)
{
cout << "Please choose the Command.Reference_State.Move_mode: 0 for XYZ_POS, 1 for XY_POS_Z_VEL, 2 for XY_VEL_Z_POS, 3 for XYZ_VEL, 5 for TRAJECTORY"<<endl;
Move_mode = 5;
if(Move_mode == prometheus_msgs::PositionReference::TRAJECTORY)
{
cout << "For safety, please move the drone near to the trajectory start point firstly!!!"<<endl;
cout << "Please choose the trajectory type: 0 for Circle, 1 for Eight Shape, 2 for Step, 3 for Line"<<endl;
Trjectory_mode = 0;
cout << "Input the trajectory_total_time:"<<endl;
trajectory_total_time = 100;
cout << "Please choose the Command.Reference_State.Move_frame: 0 for ENU_FRAME, 1 for BODY_FRAME"<<endl;
Move_frame = 1;
cout << "Please input the reference state [x y z yaw]: "<< endl;
cout << "setpoint_t[0] --- x [m] : "<< endl;
cin >> state_desired[0];
cout << "setpoint_t[1] --- y [m] : "<< endl;
cin >> state_desired[1];
cout << "setpoint_t[2] --- z [m] : "<< endl;
cin >> state_desired[2];
cout << "setpoint_t[3] --- yaw [du] : "<< endl;
cin >> state_desired[3];
}
}
else if(Control_Mode == 999)
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Idle;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.yaw_ref = 999;
move_pub.publish(Command_to_pub);
Command_to_pub.Reference_State.yaw_ref = 0.0;
}
switch (Control_Mode)
{
case prometheus_msgs::ControlCommand::Idle:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Idle;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
case prometheus_msgs::ControlCommand::Takeoff:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Takeoff;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
case prometheus_msgs::ControlCommand::Hold:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Hold;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
case prometheus_msgs::ControlCommand::Land:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Land;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
case prometheus_msgs::ControlCommand::Move:
if(Move_mode == prometheus_msgs::PositionReference::TRAJECTORY)
{
time_trajectory = 0.0;
while(time_trajectory < trajectory_total_time)
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
if(Trjectory_mode == 0)
{
Command_to_pub.Reference_State = Controller_Test.Circle_trajectory_generation(time_trajectory);
}else if(Trjectory_mode == 1)
{
Command_to_pub.Reference_State = Controller_Test.Eight_trajectory_generation(time_trajectory);
}else if(Trjectory_mode == 2)
{
Command_to_pub.Reference_State = Controller_Test.Step_trajectory_generation(time_trajectory);
}else if(Trjectory_mode == 3)
{
Command_to_pub.Reference_State = Controller_Test.Line_trajectory_generation(time_trajectory);
}
move_pub.publish(Command_to_pub);
time_trajectory = time_trajectory + 0.01;
cout << "Trajectory tracking: "<< time_trajectory << " / " << trajectory_total_time << " [ s ]" <<endl;
Draw_in_rviz(Command_to_pub.Reference_State, true);
ros::Duration(0.01).sleep();
}
}else
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = Move_mode;
Command_to_pub.Reference_State.Move_frame = Move_frame;
Command_to_pub.Reference_State.time_from_start = -1;
generate_com(Move_mode, state_desired);
move_pub.publish(Command_to_pub);
}
break;
case prometheus_msgs::ControlCommand::Disarm:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Disarm;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
case prometheus_msgs::ControlCommand::User_Mode1:
int sock;
struct sockaddr_in server;
char message[4096*4], server_reply[4096*4];
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock == -1){
perror("Could not create socket");
break;
//return 1;
}
puts("Socket created");
server.sin_addr.s_addr = inet_addr(HOST);
server.sin_family = AF_INET;
server.sin_port = htons(PORT);
if(connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0){
perror("connect failed. Error");
break;
//return 1;
}
puts("Connected");
if(Move_mode == prometheus_msgs::PositionReference::TRAJECTORY)
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = Move_mode;
Command_to_pub.Reference_State.Move_frame = Move_frame;
Command_to_pub.Reference_State.time_from_start = -1;
generate_com(Move_mode, state_desired);
move_pub.publish(Command_to_pub);
sleep(20);
time_trajectory = 0.0;
while(time_trajectory < trajectory_total_time)
{
try{
if(recv(sock, server_reply, 4096, 0) < 0){
perror("recv failed");
break;
}
std::string recvmsg(server_reply);
Json::Value root;
Json::Reader reader;
bool parsingSuccessful = reader.parse(recvmsg, root);
if(!parsingSuccessful){
std::cout << "JSON parsing Error" << std::endl;
break;
}
std::cout << recvmsg << std::endl;
Json::Value target = root["targets"];
Json::Value sendmsg;
float x_ori = 0.0;
float y_ori = 0.0;
//pos_msg = "0";
if (target.size()){
std::cout<<"see something"<<endl;
if (!target.isNull() && target.isArray()) {
std::string detectedClass = target[0]["class"].asString();
std::cout<<detectedClass<<endl;
}
//pos_msg = std::to_string(state_desired[0]) + " " + std::to_string(state_desired[1]);
srand(time(NULL));
float rand_float = static_cast<float>(rand()) / 10;
x_ori = state_desired[0] + 0.9761;
y_ori = state_desired[1] + 0.3562;
sendmsg["x_pos"] = x_ori;
sendmsg["y_pos"] = y_ori;
std::string pos_msg = Json::writeString(Json::StreamWriterBuilder(), sendmsg);
std::cout<<pos_msg<<endl;
if (send(sock, pos_msg.c_str(), pos_msg.length(), 0) == -1) {
std::cout << "Failed to send message" << std::endl;
break;
//return 1;
}
break;
}
sendmsg["x_pos"] = x_ori;
sendmsg["y_pos"] = y_ori;
std::string pos_msg = Json::writeString(Json::StreamWriterBuilder(), sendmsg);
std::cout<<pos_msg<<endl;
if (send(sock, pos_msg.c_str(), pos_msg.length(), 0) == -1) {
std::cout << "Failed to send message" << std::endl;
break;
}
}catch(Json::RuntimeError e){
std::cout << "JSON runtime exception: " << e.what() << std::endl;
break;
}
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
//Command_to_pub.Reference_State = Controller_Test.Circle_trajectory_generation(time_trajectory);
Command_to_pub.Reference_State.Move_mode = Move_mode;
Command_to_pub.Reference_State.Move_frame = Move_frame;
Command_to_pub.Reference_State.time_from_start = -1;
if (time_trajectory <= 25){
state_desired[0] += time_trajectory/5;
}
else if (time_trajectory > 25 && time_trajectory <= 50){
state_desired[1] += (time_trajectory-25)/5;
}
else if (time_trajectory > 50 && time_trajectory <= 75){
state_desired[0] -= (time_trajectory-50)/5;
}
else if (time_trajectory > 75 && time_trajectory <= 100){
state_desired[1] -= (time_trajectory-75)/5;
}
cout<<"******************************"<<endl;
cout<<"x pos:"<<state_desired[0]<<" "<<"y pos:"<<state_desired[1]<<endl;
cout<<"******************************"<<endl;
generate_com(Move_mode, state_desired);
move_pub.publish(Command_to_pub);
//move_pub.publish(Command_to_pub);
time_trajectory = time_trajectory + 0.01;
//cout << "Trajectory tracking: "<< time_trajectory << " / " << trajectory_total_time << " [ s ]" <<endl;
//Draw_in_rviz(Command_to_pub.Reference_State, true);
ros::Duration(0.01).sleep();
}
}
break;
case prometheus_msgs::ControlCommand::User_Mode2:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::User_Mode2;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
}
cout << "....................................................." <<endl;
sleep(1.0);
}
}
void mainloop2()
{
KeyboardEvent keyboardcontrol;
Controller_Test Controller_Test;
char key_now;
char key_last;
cout << ">>>>>>>>>>>>>>>> Welcome to use Prometheus Terminal Control <<<<<<<<<<<<<<<<"<< endl;
cout << "ENTER key to control the drone: " <<endl;
cout << "1 for Arm, Space for Takeoff, L for Land, H for Hold, 0 for Disarm, 8/9 for Trajectory tracking" <<endl;
cout << "Move mode is fixed (XYZ_VEL,BODY_FRAME): w/s for body_x, a/d for body_y, k/m for z, q/e for body_yaw" <<endl;
cout << "CTRL-C to quit." <<endl;
while (ros::ok())
{
keyboardcontrol.RosWhileLoopRun();
key_now = keyboardcontrol.GetPressedKey();
switch (key_now)
{
//悬停, 应当只发送一次, 不需要循环发送
case U_KEY_NONE:
if (key_last != U_KEY_NONE)
{
//to be continued.
}
sleep(0.5);
break;
// 数字1非小键盘数字解锁及切换到OFFBOARD模式
case U_KEY_1:
cout << " " <<endl;
cout << "Arm and Switch to OFFBOARD." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Idle;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.yaw_ref = 999;
move_pub.publish(Command_to_pub);
sleep(1.0);
break;
// 空格:起飞
case U_KEY_SPACE:
cout << " " <<endl;
cout << "Switch to Takeoff Mode." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Takeoff;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.Reference_State.yaw_ref = 0.0;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
sleep(1.0);
break;
// 键盘L降落
case U_KEY_L:
cout << " " <<endl;
cout << "Switch to Land Mode." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Land;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
// 键盘0非小键盘数字紧急停止
case U_KEY_0:
cout << " " <<endl;
cout << "Switch to Disarm Mode." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Disarm;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
break;
//起飞要维持起飞的模式?
case U_KEY_T:
cout << " " <<endl;
cout << "Switch to Takeoff Mode." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Takeoff;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
move_pub.publish(Command_to_pub);
sleep(2.0);
break;
//起飞要维持起飞的模式?
case U_KEY_H:
cout << " " <<endl;
cout << "Switch to Hold Mode." <<endl;
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Hold;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.position_ref[0] = 0;
Command_to_pub.Reference_State.position_ref[1] = 0;
Command_to_pub.Reference_State.position_ref[2] = 0;
Command_to_pub.Reference_State.velocity_ref[0] = 0;
Command_to_pub.Reference_State.velocity_ref[1] = 0;
Command_to_pub.Reference_State.velocity_ref[2] = 0;
Command_to_pub.Reference_State.acceleration_ref[0] = 0;
Command_to_pub.Reference_State.acceleration_ref[1] = 0;
Command_to_pub.Reference_State.acceleration_ref[2] = 0;
move_pub.publish(Command_to_pub);
sleep(1.0);
break;
// 向前匀速运动
case U_KEY_W:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[0] += VEL_XY_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 向后匀速运动
case U_KEY_S:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[0] -= VEL_XY_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 向左匀速运动
case U_KEY_A:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[1] += VEL_XY_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 向右匀速运动
case U_KEY_D:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[1] -= VEL_XY_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 向上运动
case U_KEY_K:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[2] += VEL_Z_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 向下运动
case U_KEY_M:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.velocity_ref[2] -= VEL_Z_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Current Velocity [X Y Z]: " << Command_to_pub.Reference_State.velocity_ref[0] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[1] << " [m/s] " << Command_to_pub.Reference_State.velocity_ref[2] << " [m/s] "<<endl;
sleep(0.1);
break;
// 偏航运动,左转 (这个里偏航控制的是位置 不是速度)
case U_KEY_Q:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_VEL;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.yaw_ref = YAW_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Increase the Yaw angle." <<endl;
sleep(0.1);
break;
// 偏航运动,右转
case U_KEY_E:
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State.Move_mode = prometheus_msgs::PositionReference::XYZ_POS;
Command_to_pub.Reference_State.Move_frame = prometheus_msgs::PositionReference::BODY_FRAME;
Command_to_pub.Reference_State.yaw_ref = YAW_STEP_SIZE;
move_pub.publish(Command_to_pub);
cout << " " <<endl;
cout << "Decrease the Yaw angle." <<endl;
sleep(0.1);
break;
// 圆形追踪
case U_KEY_9:
time_trajectory = 0.0;
trajectory_total_time = 50.0;
// 需要设置
while(time_trajectory < trajectory_total_time)
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State = Controller_Test.Circle_trajectory_generation(time_trajectory);
move_pub.publish(Command_to_pub);
time_trajectory = time_trajectory + 0.01;
cout << "Trajectory tracking: "<< time_trajectory << " / " << trajectory_total_time << " [ s ]" <<endl;
Draw_in_rviz(Command_to_pub.Reference_State, true);
ros::Duration(0.01).sleep();
}
break;
// 8字追踪
case U_KEY_8:
time_trajectory = 0.0;
trajectory_total_time = 50.0;
// 需要设置
while(time_trajectory < trajectory_total_time)
{
Command_to_pub.header.stamp = ros::Time::now();
Command_to_pub.Mode = prometheus_msgs::ControlCommand::Move;
Command_to_pub.Command_ID = Command_to_pub.Command_ID + 1;
Command_to_pub.source = NODE_NAME;
Command_to_pub.Reference_State = Controller_Test.Eight_trajectory_generation(time_trajectory);
move_pub.publish(Command_to_pub);
time_trajectory = time_trajectory + 0.01;
cout << "Trajectory tracking: "<< time_trajectory << " / " << trajectory_total_time << " [ s ]" <<endl;
Draw_in_rviz(Command_to_pub.Reference_State, true);
ros::Duration(0.01).sleep();
}
break;
}
key_last = key_now;
ros::spinOnce();
sleep(0.1);
}
}
void generate_com(int Move_mode, float state_desired[4])
{
//# Move_mode 2-bit value:
//# 0 for position, 1 for vel, 1st for xy, 2nd for z.
//# xy position xy velocity
//# z position 0b00(0) 0b10(2)
//# z velocity 0b01(1) 0b11(3)
if(Move_mode == prometheus_msgs::PositionReference::XYZ_ACC)
{
cout << "ACC control not support yet." <<endl;
}
if((Move_mode & 0b10) == 0) //xy channel
{
Command_to_pub.Reference_State.position_ref[0] = state_desired[0];
Command_to_pub.Reference_State.position_ref[1] = state_desired[1];
Command_to_pub.Reference_State.velocity_ref[0] = 0;
Command_to_pub.Reference_State.velocity_ref[1] = 0;
}
else
{
Command_to_pub.Reference_State.position_ref[0] = 0;
Command_to_pub.Reference_State.position_ref[1] = 0;
Command_to_pub.Reference_State.velocity_ref[0] = state_desired[0];
Command_to_pub.Reference_State.velocity_ref[1] = state_desired[1];
}
if((Move_mode & 0b01) == 0) //z channel
{
Command_to_pub.Reference_State.position_ref[2] = state_desired[2];
Command_to_pub.Reference_State.velocity_ref[2] = 0;
}
else
{
Command_to_pub.Reference_State.position_ref[2] = 0;
Command_to_pub.Reference_State.velocity_ref[2] = state_desired[2];
}
Command_to_pub.Reference_State.acceleration_ref[0] = 0;
Command_to_pub.Reference_State.acceleration_ref[1] = 0;
Command_to_pub.Reference_State.acceleration_ref[2] = 0;
Command_to_pub.Reference_State.yaw_ref = state_desired[3]/180.0*M_PI;
}
void Draw_in_rviz(const prometheus_msgs::PositionReference& pos_ref, bool draw_trajectory)
{
geometry_msgs::PoseStamped reference_pose;
reference_pose.header.stamp = ros::Time::now();
reference_pose.header.frame_id = "world";
reference_pose.pose.position.x = pos_ref.position_ref[0];
reference_pose.pose.position.y = pos_ref.position_ref[1];
reference_pose.pose.position.z = pos_ref.position_ref[2];
if(draw_trajectory)
{
posehistory_vector_.insert(posehistory_vector_.begin(), reference_pose);
if(posehistory_vector_.size() > TRA_WINDOW){
posehistory_vector_.pop_back();
}
nav_msgs::Path reference_trajectory;
reference_trajectory.header.stamp = ros::Time::now();
reference_trajectory.header.frame_id = "world";
reference_trajectory.poses = posehistory_vector_;
ref_trajectory_pub.publish(reference_trajectory);
}else
{
posehistory_vector_.clear();
nav_msgs::Path reference_trajectory;
reference_trajectory.header.stamp = ros::Time::now();
reference_trajectory.header.frame_id = "world";
reference_trajectory.poses = posehistory_vector_;
ref_trajectory_pub.publish(reference_trajectory);
}
}
Loading…
Cancel
Save