浏览代码

change detection_lidar_grid. test fusion ok.

yuchuli 1 年之前
父节点
当前提交
acea842cc9
共有 1 个文件被更改,包括 15 次插入10 次删除
  1. 15 10
      src/detection/detection_lidar_grid/perception_lidar_vv7.cpp

+ 15 - 10
src/detection/detection_lidar_grid/perception_lidar_vv7.cpp

@@ -406,27 +406,32 @@ static void GridGetObs(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::s
 
 #include "fusionobjectarray.pb.h"
 
+iv::fusion::fusionobjectarray xfusion;
+
 void ShareFusionObject(void * pa ,std::shared_ptr<std::vector<iv::ObstacleBasic>> & lidar_obs)
 {
-    iv::fusion::fusionobjectarray xfusion;
+
     double timestamp = std::chrono::system_clock::now().time_since_epoch().count();
     timestamp = timestamp/1000000.0;
 
+    xfusion.clear_obj();
+
     xfusion.set_timestamp(timestamp);
 
     iv::fusion::fusionobject * pobj =  xfusion.add_obj();
 
     pobj->set_id(0);
     pobj->set_type(0);
-    iv::fusion::VelXY xvel;
-    xvel.set_x(0);
-    xvel.set_y(0);
-    pobj->set_allocated_vel_abs(&xvel);
-    iv::fusion::Dimension xdim;
-    xdim.set_x(0.2);
-    xdim.set_y(0.2);
-    xdim.set_z(2.0);
-    pobj->set_allocated_dimensions(&xdim);
+    iv::fusion::VelXY *pxvel = new iv::fusion::VelXY;
+    pxvel->set_x(0);
+    pxvel->set_y(0);
+    pobj->set_allocated_vel_abs(pxvel);
+    iv::fusion::Dimension * pxdim = new iv::fusion::Dimension;
+    pxdim->set_x(0.2);
+    pxdim->set_y(0.2);
+    pxdim->set_z(2.0);
+
+    pobj->set_allocated_dimensions(pxdim);
 
     int i;
     int nsize = lidar_obs->size();