2026-06-26 17:55:15 +08:00
|
|
|
|
#ifndef IVR_DRONESCREWCTRL_CONFIG_H
|
|
|
|
|
|
#define IVR_DRONESCREWCTRL_CONFIG_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 板一连接参数(Server IP + ZMQ + RTSP)
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct DroneScrewServerInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string serverIp{"192.168.1.10"}; // 板一 IP
|
|
|
|
|
|
int zmqControlPort{5555}; // REQ-REP 控制
|
|
|
|
|
|
int zmqResultPort{5556}; // PUB-SUB 检测结果
|
|
|
|
|
|
int zmqRawImagePort{5557}; // PUB-SUB 原始图像,0=不订阅
|
|
|
|
|
|
int rtspPort{8554}; // RTSP
|
|
|
|
|
|
std::string rtspPath{"/live/dronescrew"};
|
|
|
|
|
|
std::string rtspUser;
|
|
|
|
|
|
std::string rtspPass;
|
|
|
|
|
|
bool rtspUseTcp{true};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 算法参数(板二界面可调,通过 ZMQ 透传到板一)
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct DroneScrewAlgoUiParams
|
|
|
|
|
|
{
|
|
|
|
|
|
float scoreThreshold{0.5f};
|
|
|
|
|
|
float nmsThreshold{0.45f};
|
|
|
|
|
|
|
|
|
|
|
|
int inputWidth{640};
|
|
|
|
|
|
int inputHeight{640};
|
|
|
|
|
|
int modelType{0};
|
2026-07-03 14:19:06 +08:00
|
|
|
|
int expectedBoltCount{8};
|
2026-06-26 17:55:15 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 相机参数(板二界面可调,通过 ZMQ 透传到板一)
|
|
|
|
|
|
*
|
|
|
|
|
|
* 单位与板一 config.xml 保持一致:曝光时间为微秒(μs),增益为倍数。
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct DroneScrewCameraParams
|
|
|
|
|
|
{
|
|
|
|
|
|
double exposure{10000.0}; // 曝光时间(μs),默认 10000
|
|
|
|
|
|
double gain{1.0}; // 增益,默认 1.0
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 显示选项
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct DroneScrewDisplayOption
|
|
|
|
|
|
{
|
|
|
|
|
|
bool drawBoxes{true};
|
|
|
|
|
|
bool drawScores{true};
|
|
|
|
|
|
bool drawClassId{true};
|
|
|
|
|
|
int boxThickness{2};
|
|
|
|
|
|
int maxResultListItems{200};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 整体配置
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct DroneScrewCtrlConfigResult
|
|
|
|
|
|
{
|
|
|
|
|
|
DroneScrewServerInfo server;
|
|
|
|
|
|
DroneScrewAlgoUiParams algo;
|
|
|
|
|
|
DroneScrewCameraParams camera;
|
|
|
|
|
|
DroneScrewDisplayOption display;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum DroneScrewCtrlLoadCode
|
|
|
|
|
|
{
|
|
|
|
|
|
DRONE_CFG_OK = 0,
|
|
|
|
|
|
DRONE_CFG_FILE_NOT_FOUND = -1,
|
|
|
|
|
|
DRONE_CFG_PARSE_ERR = -2,
|
|
|
|
|
|
DRONE_CFG_INVALID_FMT = -3,
|
|
|
|
|
|
DRONE_CFG_UNKNOWN_ERR = -99,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 配置变化通知接口
|
|
|
|
|
|
*/
|
|
|
|
|
|
class IDroneScrewCtrlConfigNotify
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual ~IDroneScrewCtrlConfigNotify() = default;
|
|
|
|
|
|
virtual void OnConfigChanged(const DroneScrewCtrlConfigResult& cfg) = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 配置文件读写接口
|
|
|
|
|
|
*/
|
|
|
|
|
|
class IDroneScrewCtrlConfig
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual ~IDroneScrewCtrlConfig() = default;
|
|
|
|
|
|
|
|
|
|
|
|
static bool CreateInstance(IDroneScrewCtrlConfig** pp);
|
|
|
|
|
|
|
|
|
|
|
|
virtual int LoadConfig(const std::string& filePath, DroneScrewCtrlConfigResult& result) = 0;
|
|
|
|
|
|
virtual bool SaveConfig(const std::string& filePath, const DroneScrewCtrlConfigResult& result) = 0;
|
|
|
|
|
|
virtual void SetConfigChangeNotify(IDroneScrewCtrlConfigNotify* notify) = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // IVR_DRONESCREWCTRL_CONFIG_H
|