Browse Source

1、修改rabbitmq消息结构,对接厦门

LiuZe 11 months ago
parent
commit
11934dc7e6

+ 2 - 0
CMakeLists.txt

@@ -13,6 +13,8 @@ if (OPTION_ENABLE_TENSORRT_DETECT_CODE)
 
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
     set(CMAKE_CXX_STANDARD 17)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
 
     option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
 

+ 24 - 15
communication/rabbitmq/Boundary.cpp

@@ -98,33 +98,42 @@ void Boundary::limit(JetStream::MeasureInfo &info) {
 
 }
 
-void Boundary::transMeasureInfo(JetStream::MeasureInfo &in, measure_info &out) {
+void Boundary::transMeasureInfo(JetStream::MeasureInfo &in, measure_buffer &out) {
+    measure_info info;
+    info.CopyFrom(out.measure_info_to_plc_forward());
     // 如果地面雷达状态已经被修改过,直接返回
-    if (out.ground_status() != Measure_OK) {
+    if (info.ground_status() != Measure_OK) {
+        out.mutable_measure_info_to_plc_reverse()->CopyFrom(info);
+        out.mutable_measure_info_to_terminal()->CopyFrom(info);
         return;
     }
 
     // 设备状态
     if (in.border_display() != Range_status::Range_correct || in.border_plc() != Range_status::Range_correct) {
-        out.set_ground_status((MeasureStatu::Measure_Border));
+        info.set_ground_status((MeasureStatu::Measure_Border));
     }
 
-    out.set_cx(in.trans_x());                                 // 车辆中心坐标x
-    out.set_cy(in.trans_y());
-    out.set_theta(in.theta() * 180.0 / M_PI);
-    out.set_length(0);
-    out.set_width(in.width());
-    out.set_wheelbase(in.wheelbase());
-    out.set_front_theta(in.ftheta() * 180.0 / M_PI);
-    out.set_border_statu(in.border_plc());
-    out.set_is_stop(0);
+    info.set_cx(in.trans_x());                                 // 车辆中心坐标x
+    info.set_cy(in.trans_y());
+    info.set_theta(in.theta() * 180.0 / M_PI);
+    info.set_length(0);
+    info.set_width(in.width());
+    info.set_wheelbase(in.wheelbase());
+    info.set_front_theta(in.ftheta() * 180.0 / M_PI);
+    info.set_border_statu(in.border_plc());
+    info.set_is_stop(0);
 
     if (DetectManager::iter()->carMoveStatus() == FAILED) {
-        out.set_motion_statu(1);    // 静止3秒
+        info.set_motion_statu(1);    // 静止3秒
     } else {
-        out.set_motion_statu(0);    // 运动
+        info.set_motion_statu(0);    // 运动
     }
-    out.set_move_distance(0);
+    info.set_move_distance(0);
+
+    out.mutable_measure_info_to_plc_forward()->CopyFrom(info);
+    out.mutable_measure_info_to_plc_reverse()->CopyFrom(info);
+    out.mutable_measure_info_to_terminal()->CopyFrom(info);
+    out.mutable_measure_info_to_terminal()->set_border_statu(in.border_display());
 }
 
 void Boundary::transMeasureInfo(JetStream::MeasureInfo &in, TransitData::MeasureInfo &out) {

+ 1 - 1
communication/rabbitmq/Boundary.h

@@ -35,7 +35,7 @@ public:
 
     void limit(JetStream::MeasureInfo &info);
 
-    void transMeasureInfo(JetStream::MeasureInfo &in, measure_info &out);
+    void transMeasureInfo(JetStream::MeasureInfo &in, measure_buffer &out);
 
     void transMeasureInfo(JetStream::MeasureInfo &in, TransitData::MeasureInfo &out);
 

+ 3 - 3
communication/rabbitmq/rabbitmq_communication.cpp

@@ -34,16 +34,16 @@ Error_manager RabbitmqCommunicationTof3D::auto_encapsulate_status() {
         heart = 0;
     }
 
-    measure_info rabbit_measure_info;
+    measure_buffer rabbit_measure_info;
     DetectManager::DetectResult detect_measure_info;
 
     // 设备状态
     if (DeviceTof3D::iter()->getDeviceStatus() != SUCCESS) {
-        rabbit_measure_info.set_ground_status(MeasureStatu::Lidar_Disconnect);
+        rabbit_measure_info.mutable_measure_info_to_plc_forward()->set_ground_status(MeasureStatu::Lidar_Disconnect);
     }
     MeasureStatu measure_status = DetectManager::iter()->getMeasureResult(detect_measure_info);
     if (measure_status != MeasureStatu::Measure_OK) {
-        rabbit_measure_info.set_ground_status(measure_status);
+        rabbit_measure_info.mutable_measure_info_to_plc_forward()->set_ground_status(measure_status);
     }
 
     // 超界判断

+ 1 - 0
detect/ceres_detect/detect_wheel_ceres.cpp

@@ -459,6 +459,7 @@ bool detect_wheel_ceres::detect_2Step(pcl::PointCloud<pcl::PointXYZ>::Ptr cl1,pc
   bool ryl=detect_RYL(cl1,cl2,cl3,cl4,cx,cy,theta,wheel_base,width,front_theta,loss);
   if(ryl==false) return ryl;
   bool xwf=detect_XWF(cl1,cl2,cl3,cl4,cx,cy,theta,wheel_base,width,front_theta,loss);
+  width += 0.04;
   return xwf;
 }
 

+ 6 - 0
proto/communication.proto

@@ -25,3 +25,9 @@ message CommunicationManagerConfig {
     optional string grpc_server_ip = 4 [default = "127.0.0.1"];
     optional int32 grpc_server_port = 5 [default = 9876];
 }
+
+message measure_buffer{
+    required measure_info measure_info_to_plc_forward=1;     //雷达数据给plc,正向
+    required measure_info measure_info_to_plc_reverse=2;     //雷达数据给plc,反向
+    required measure_info measure_info_to_terminal=3;        //雷达数据给终端,边界较小
+}