syntax = "proto2";

// 算法测量结果内容
message LossResult {
  required float lf_loss = 1;
  required float rf_loss = 2;
  required float lb_loss = 3;
  required float rb_loss = 4;
  required float total_avg_loss = 5;
};
message DetectResult {
  required float cx = 1;
  required float cy = 2;
  required float theta = 3;
  required float wheel_base = 4;
  required float width = 5;
  required float body_width = 6;
  required float front_theta = 7;
  required float single_wheel_width = 8;
  required float single_wheel_length = 9;
  required bool success = 10;
  required LossResult loss = 11;
};

// 区域配置
message RegionEtc {
  required double maxx = 1;
  required double minx = 2;
  required double maxy = 3;
  required double miny = 4;
  required double maxz = 5;
  required double minz = 6;
};

message Region
{
  required RegionEtc cut_region = 1;
  required float turnplate_cx = 2;
  required float turnplate_cy = 3;
  required float border_minx = 4; // 最小边界x，左超界提示
  required float border_maxx = 5; // 最大边界x，右超界提示
  required float plc_offsetx = 6; // plc偏移x
  required float plc_offsety = 7; // plc偏移y
  required float plc_offset_degree = 8; // plc偏移角度
  required float plc_border_miny = 9;// plc后夹持y方向极限值
  required float plc_border_maxy = 10;// plc后夹持y方向极限值
  required float car_min_width = 11; // 最小车宽
  required float car_max_width = 12; // 最大车宽
  required float car_min_wheelbase = 13; // 最小轴距
  required float car_max_wheelbase = 14; // 最大轴距
  required float turnplate_angle_min = 15;
  required float turnplate_angle_max = 16;
  required float turnplate_angle_limit_anti_clockwise = 17; // 转盘逆时针角度极限
  required float turnplate_angle_limit_clockwise = 18; // 转盘顺时针角度极限
}

// 测量节点与雷达关系, 一个测量节点可以配置多个雷达
message MeasureLidar {
  required  string measureTopic = 1;          // 测量节点将测量结果发送的话题
  required  Region region = 2;             // 测量节点裁剪雷达数据的配置
  repeated string lidarTopic = 5;   // 测量节点雷达数据来源话题
}

// 测量节点有关配置
message MeasureConfig {
  required string sendTopics = 1;                // 测量节点发送的所有消息都在这个话题下
  required string lidarTopics = 2;               // 雷达的监听节点
  repeated MeasureLidar measures = 5;   // 测量节点所有的雷达关系
}

// 测量节点状态
message measure_info {
  required float cx = 1 [default = 0];                 // 车身中心x坐标
  required float cy = 2 [default = 0];                 // 车身中心y坐标
  required float theta = 3 [default = 0];              // 车身偏转角
  required float length = 4 [default = 0];             // 车长
  required float width = 5 [default = 0];              // 车宽
  required float height = 6 [default = 0];             // 车高
  required float wheelbase = 7 [default = 0];          // 轴距
  required float front_theta = 8 [default = 0];        // 前轮角
  required int32 border_statu = 9 [default = 0];       // 超界信息: 0x01:后超界, 0x02:左超界, 0x04:右超界, 0x08:前超界, 0x10:底盘超界, 0x20:超宽, 0x40:轴距超界, 0x80:车身角度偏左, 0x100:车身角度偏右, 0x200:方向盘未回正
  required int32 ground_status = 10 [default = 1];     // 0:ok, 1:nothing, 2:noise, 3:超界
  required int32 is_stop = 11 [default = 2];           // 是否可停1为可停，2为不可停
}
message measure_statu{
  required measure_info info = 1;
}

enum Range_status {
  Range_correct             = 0x0000; // 未超界
  Range_back                = 0x0001; // 后超界
  Range_left                = 0x0002; // 左超界
  Range_right               = 0x0004; // 右超界
  Range_front               = 0x0008; // 前超界
  Range_bottom              = 0x0010; // 底盘超界
  Range_car_width           = 0x0020; // 车宽超界
  Range_car_wheelbase       = 0x0040; // 轴距超界
  Range_angle_anti_clock    = 0x0080; // 左(逆时针)旋转超界
  Range_angle_clock         = 0x0100; // 右(顺时针)旋转超界
  Range_steering_wheel_nozero = 0x0200; // 方向盘未回正
  Range_top                 = 0x0400; // 车顶超界
  Range_car_moving          = 0x0800; // 车辆移动为1，静止为0
};

enum Ground_statu
{
  ok = 0;
  Noise = 1;
  Nothing = 2;
  Car_border_reached = 3;
}
