You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 公共类型定义:各模块共享的数据结构
#ifndef COMMON_H
#define COMMON_H
#include <string>
#include <vector>
#include <cstdint>
// 原始扫描点(保留角度/距离,check/count 均可用)
struct ScanPoint
{
double x_mm; // 笛卡尔 X (mm)
double y_mm; // 笛卡尔 Y (mm, 雷达朝-Y方向, 0°指向-Y)
double angle_deg; // 原始角度(度)
uint16_t distance; // 原始距离(unit=2mm)
double z_val; // Z轴: 距离(mm)或时间(ms)
};
// 计数用点(x/y/z,已过滤)
struct CountPoint
{
double x_mm;
double y_mm;
double z_val;
};
// 计数参数(TCP box 字段)
struct CountParams
{
double l = 0.0; // 行(长) mm
double w = 0.0; // 宽 mm
double h = 0.0; // 层高 mm
int maxPerLayer = 0; // 每层最大个数
std::string task_id;
};
// 一次检测的结果(供 TCP 返回)
struct DetectResult
{
double start_fill_pct = -1.0; // 起点截面白色占比(%)
double end_fill_pct = -1.0; // 终点截面白色占比(%)
double start_y_max = 0.0; // 起点截面Y最大值(mm)
double start_y_med = 0.0; // 起点截面Y中位数(mm)
double end_y_max = 0.0; // 终点截面Y最大值(mm)
double end_y_med = 0.0; // 终点截面Y中位数(mm)
bool valid = false; // 是否有有效结果
};
#endif // COMMON_H