重构了与DB的交互逻辑,以及与任务\上位机指令的消息,使用新的loguru库进行日志管理
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#define PMSYSVARIABLE_H
|
||||
|
||||
//宏定义
|
||||
#include<string>
|
||||
#include <map>
|
||||
|
||||
|
||||
#define BREAK_OFF 0xAA
|
||||
@@ -408,6 +410,89 @@ namespace BatteryCommand {
|
||||
Start = 0x10,
|
||||
Stop = 0x20
|
||||
};
|
||||
};
|
||||
|
||||
namespace PMMode {
|
||||
enum Type : unsigned char {
|
||||
Normal = 0,
|
||||
Test = 1,
|
||||
Debug = 2
|
||||
};
|
||||
};
|
||||
|
||||
//工况定义
|
||||
namespace WorkCondition {
|
||||
enum Type : unsigned char {
|
||||
STANDBY = 1, // 待机工况
|
||||
SHORE_BASED_READY = 2, // 岸基备航
|
||||
WATER_BASED_READY = 3, // 水中备航
|
||||
REMOTE_CONTROL = 4, // 遥控工况
|
||||
CRUISE_MODE = 5, // 巡航模式
|
||||
HIGH_SPEED_MODE = 6, // 高速模式
|
||||
ASCEND_DESCEND = 7, // 上浮下潜
|
||||
BUOYANCY_ADJUST = 8, // 浮调模式
|
||||
UNDERWATER_RECON = 9, // 水下侦查
|
||||
SURFACE_RECON = 10, // 水面侦查
|
||||
DJ_MODE = 11, // DJ模式
|
||||
DEBUG_MODE = 12 // 调试模式
|
||||
};
|
||||
};
|
||||
// 抛载 throwLoad
|
||||
// 运动上浮 floatUp
|
||||
// 回收 recycle
|
||||
// 悬停 hover
|
||||
// 上浮通信 satComm
|
||||
// 上浮校准 satCalibrate
|
||||
// 游曳 tour
|
||||
// 航行 sail
|
||||
namespace TaskType {
|
||||
enum Type : unsigned char {
|
||||
THROW_LOAD = 1, // 抛载
|
||||
FLOAT_UP = 2, // 运动上浮
|
||||
RECYCLE = 3, // 回收
|
||||
HOVER = 4, // 悬停
|
||||
SAT_COMM = 5, // 上浮通信
|
||||
SAT_CALIBRATE = 6, // 上浮校准
|
||||
TOUR = 7, // 游曳
|
||||
SAIL = 8 // 航行
|
||||
};
|
||||
|
||||
inline const std::string toString(Type type) {
|
||||
static const std::map<Type, std::string> names = {
|
||||
{THROW_LOAD, "throwLoad"},
|
||||
{FLOAT_UP, "floatUp"},
|
||||
{RECYCLE, "recycle"},
|
||||
{HOVER, "hover"},
|
||||
{SAT_COMM, "satComm"},
|
||||
{SAT_CALIBRATE, "satCalibrate"},
|
||||
{TOUR, "tour"},
|
||||
{SAIL, "sail"}
|
||||
};
|
||||
auto it = names.find(type);
|
||||
return it != names.end() ? it->second : "unknown";
|
||||
}
|
||||
inline Type fromString(const std::string& str) {
|
||||
static const std::map<std::string, Type> stringToEnum = {
|
||||
{"throwLoad", THROW_LOAD},
|
||||
{"floatUp", FLOAT_UP},
|
||||
{"recycle", RECYCLE},
|
||||
{"hover", HOVER},
|
||||
{"satComm", SAT_COMM},
|
||||
{"satCalibrate", SAT_CALIBRATE},
|
||||
{"tour", TOUR},
|
||||
{"sail", SAIL}
|
||||
};
|
||||
auto it = stringToEnum.find(str);
|
||||
return it != stringToEnum.end() ? it->second : static_cast<Type>(0); // 返回0表示无效类型
|
||||
}
|
||||
}
|
||||
|
||||
struct MissionState
|
||||
{
|
||||
int type;
|
||||
bool enableBowRudder;
|
||||
bool enableBuoyancyAdjustment;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user