vehicle manage
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
~$*.docx
|
||||
*.pro.*
|
||||
*~
|
||||
*.bak
|
||||
*.swp
|
||||
html/
|
||||
*.zip
|
||||
*.bz2
|
||||
*.tar
|
||||
|
||||
|
||||
bin
|
||||
build
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
Vehicle::Vehicle(QObject *parent) : QObject(parent)
|
||||
{
|
||||
//WayPointGroup.begin().value().begin().value()
|
||||
|
||||
}
|
||||
|
||||
Vehicle::~Vehicle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Vehicle::setType(int t)
|
||||
{
|
||||
type = t;
|
||||
}
|
||||
|
||||
void Vehicle::setMsg(int idx,int m)
|
||||
{
|
||||
Q_UNUSED(idx)
|
||||
Q_UNUSED(m)
|
||||
}
|
||||
|
||||
void Vehicle::setParam(int idx, param *p)
|
||||
{
|
||||
params.insert(idx,p);
|
||||
}
|
||||
|
||||
void Vehicle::setMission(int idx, item_int * i)
|
||||
{
|
||||
//waypoint.insert(idx,i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#ifndef VEHICLE_H
|
||||
#define VEHICLE_H
|
||||
|
||||
#include "VehicleManage_global.h"
|
||||
#include <QObject>
|
||||
|
||||
|
||||
#include "QHash"
|
||||
#include "QMap"
|
||||
#include "VehicleType.h"
|
||||
|
||||
class VEHICLEMANAGE_EXPORT Vehicle : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Vehicle(QObject *parent = nullptr);
|
||||
~Vehicle();
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void setType(int t);
|
||||
|
||||
void setMsg(int idx, int m);
|
||||
void setParam(int idx,param *p);
|
||||
void setMission(int idx, item_int *i);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool isSeleted = false;
|
||||
|
||||
int sysid;
|
||||
|
||||
int type;
|
||||
|
||||
|
||||
state m_state;
|
||||
|
||||
/*
|
||||
* 航线组
|
||||
* |
|
||||
* / \
|
||||
* / \
|
||||
* 航线1 航线2
|
||||
* / | \ | \
|
||||
* p p p p p
|
||||
*
|
||||
* 组下面有航线,航线下面有航点
|
||||
*
|
||||
*/
|
||||
|
||||
QMap<int,QMap<int,item_int *>> WayPointGroup;//航线组
|
||||
|
||||
|
||||
QMap<int,int> msg;
|
||||
QMap<int,param *> params;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // VEHICLE_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "VehicleManage.h"
|
||||
|
||||
VehicleManage::VehicleManage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VehicleManage::~VehicleManage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void VehicleManage::addVehicle(int sysid)
|
||||
{
|
||||
qDebug() << sysid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef VEHICLEMANAGE_H
|
||||
#define VEHICLEMANAGE_H
|
||||
|
||||
#include "VehicleManage_global.h"
|
||||
#include "QObject"
|
||||
#include "QDebug"
|
||||
|
||||
|
||||
#include "Vehicle.h"
|
||||
|
||||
class VEHICLEMANAGE_EXPORT VehicleManage : public QObject
|
||||
{
|
||||
public:
|
||||
explicit VehicleManage();
|
||||
~VehicleManage();
|
||||
|
||||
signals:
|
||||
|
||||
void PluginLoading(bool flag);
|
||||
|
||||
public slots:
|
||||
|
||||
void addVehicle(int sysid);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
QMap<int,Vehicle *> Vehicles;
|
||||
|
||||
};
|
||||
|
||||
#endif // VEHICLEMANAGE_H
|
||||
@@ -0,0 +1,83 @@
|
||||
QT -= gui
|
||||
|
||||
TEMPLATE = lib
|
||||
DEFINES += VEHICLEMANAGE_LIBRARY
|
||||
|
||||
CONFIG += c++11 \
|
||||
debug_and_release
|
||||
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
# Target name.
|
||||
TARGET = $$join(TARGET,,,d)
|
||||
}
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
DESTDIR = $$PWD/bin
|
||||
MOC_DIR = $$PWD/build
|
||||
OBJECTS_DIR = $$PWD/build
|
||||
|
||||
|
||||
SOURCES += \
|
||||
Vehicle.cpp \
|
||||
VehicleManage.cpp
|
||||
|
||||
HEADERS += \
|
||||
Vehicle.h \
|
||||
VehicleManage_global.h \
|
||||
VehicleManage.h \
|
||||
VehicleType.h
|
||||
|
||||
TRANSLATIONS += \
|
||||
VehicleManage_zh_CN.ts
|
||||
|
||||
# Default rules for deployment.
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
}
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
win {
|
||||
src_dir = $$PWD\\*.h
|
||||
dst_dir = $$PWD\\bin\\include\\
|
||||
# dst_dir 最后的 \\ 是必须的,用来标示 xcopy 到一个文件夹,若不存在,创建之
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
src_dir ~= s,/,\\,g
|
||||
dst_dir ~= s,/,\\,g
|
||||
|
||||
system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
}
|
||||
|
||||
|
||||
unix {
|
||||
src_dir = $$PWD/*.h
|
||||
dst_dir = $$PWD\\bin\\include\\
|
||||
|
||||
!exists($$dst_dir): system(mkdir -p $$dst_dir)
|
||||
|
||||
system(cp $$src_dir $$dst_dir -arf )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef VEHICLEMANAGE_GLOBAL_H
|
||||
#define VEHICLEMANAGE_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(VEHICLEMANAGE_LIBRARY)
|
||||
# define VEHICLEMANAGE_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define VEHICLEMANAGE_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // VEHICLEMANAGE_GLOBAL_H
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="VehicleManage_zh_CN"></TS>
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef VEHICLETYPE_H
|
||||
#define VEHICLETYPE_H
|
||||
|
||||
#include "QDebug"
|
||||
#include "QObject"
|
||||
|
||||
typedef struct __state
|
||||
{
|
||||
bool isSeleted = false;
|
||||
|
||||
int type;//设备类型
|
||||
|
||||
bool arm;
|
||||
int flightmode;
|
||||
|
||||
|
||||
int lat;
|
||||
int lng;
|
||||
int alt;
|
||||
|
||||
float vel;
|
||||
float heading;
|
||||
|
||||
int fix;
|
||||
int svn;
|
||||
|
||||
|
||||
|
||||
float tas;
|
||||
float cas;
|
||||
float gs;
|
||||
float ma;
|
||||
float as_err;
|
||||
|
||||
|
||||
|
||||
|
||||
float rol;
|
||||
float pit;
|
||||
float yaw;
|
||||
|
||||
float p;
|
||||
float q;
|
||||
float r;
|
||||
|
||||
float ax;
|
||||
float ay;
|
||||
float az;
|
||||
|
||||
|
||||
|
||||
}state;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct __param {
|
||||
float param_value; /*< Onboard parameter value*/
|
||||
uint16_t param_count; /*< Total number of onboard parameters*/
|
||||
uint16_t param_index; /*< Index of this onboard parameter*/
|
||||
char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/
|
||||
uint8_t param_type; /*< Onboard parameter type.*/
|
||||
} param;
|
||||
|
||||
typedef struct __item_int {
|
||||
float param1; /*< PARAM1, see MAV_CMD enum*/
|
||||
float param2; /*< PARAM2, see MAV_CMD enum*/
|
||||
float param3; /*< PARAM3, see MAV_CMD enum*/
|
||||
float param4; /*< PARAM4, see MAV_CMD enum*/
|
||||
int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/
|
||||
int32_t y; /*< PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7*/
|
||||
float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.*/
|
||||
uint16_t target_system; /*< System ID*/
|
||||
uint16_t seq; /*< Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4).*/
|
||||
uint16_t command; /*< The scheduled action for the waypoint.*/
|
||||
uint8_t target_component; /*< Component ID*/
|
||||
uint8_t frame; /*< The coordinate system of the waypoint.*/
|
||||
uint8_t current; /*< false:0, true:1*/
|
||||
uint8_t autocontinue; /*< Autocontinue to next waypoint*/
|
||||
uint8_t mission_type; /*< Mission type.*/
|
||||
} item_int;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // VEHICLETYPE_H
|
||||
Reference in New Issue
Block a user