|
@@ -9,7 +9,7 @@
|
|
|
#include <iostream>
|
|
|
#include <QDateTime>
|
|
|
#include <QMutex>
|
|
|
-
|
|
|
+#include "Eigen/Dense"
|
|
|
#include <pcl/conversions.h>
|
|
|
#include <pcl/point_cloud.h>
|
|
|
#include <pcl/point_types.h>
|
|
@@ -19,6 +19,7 @@
|
|
|
#include "ivbacktrace.h"
|
|
|
|
|
|
#include "perceptionoutput.h"
|
|
|
+#include "fusionobjectarray.pb.h"
|
|
|
|
|
|
#include <iostream>
|
|
|
#include <fstream>
|
|
@@ -48,6 +49,8 @@ static char gstr_skipymin[256];
|
|
|
static char gstr_skipymax[256];
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
static int g_robosys = 10;
|
|
|
|
|
|
//#define OUT_GROUND
|
|
@@ -118,15 +121,14 @@ static void writepctosm(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,void
|
|
|
|
|
|
|
|
|
|
|
|
-static float SENSOR_HEIGHT = 2.1;
|
|
|
-static float VEHICLE_HEIGHT = 2.6;
|
|
|
+static float SENSOR_HEIGHT = 1.35;
|
|
|
+static float VEHICLE_HEIGHT = 1.50;
|
|
|
//static float local_max_slope_ = 10;
|
|
|
//static float general_max_slope_ = 3;
|
|
|
//static float concentric_divider_distance_ = 1.5;
|
|
|
//static float min_height_threshold_ = 0.05;
|
|
|
//static float reclass_distance_threshold_ = 10.0;
|
|
|
|
|
|
-
|
|
|
static float GRID_SIZE = 2.0;
|
|
|
static float SMALLGRID_SIZE = 0.2;
|
|
|
static float Height_Thesh_Ratio = 0.1;
|
|
@@ -137,12 +139,12 @@ static float VEC_MIN = -100.0;
|
|
|
static float HOR_MIN = -100.0;
|
|
|
static int g_seq = 0;
|
|
|
|
|
|
-static float skip_xmin = -0.9;
|
|
|
-static float skip_ymin = -2.3;
|
|
|
-static float skip_xmax = 0.9;
|
|
|
-static float skip_ymax = 2.3;
|
|
|
+static float skip_xmin = -0.4;
|
|
|
+static float skip_ymin = 0.0;
|
|
|
+static float skip_xmax = 0.4;
|
|
|
+static float skip_ymax = 0.3;
|
|
|
|
|
|
-static void GridGetObs(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::shared_ptr<std::vector<iv::ObstacleBasic>> lidar_obs)
|
|
|
+static void GridGetObs(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::shared_ptr<iv::fusion::fusionobjectarray> lidar_obs)
|
|
|
{
|
|
|
|
|
|
// std::cout<<"enter gird obs"<<std::endl;
|
|
@@ -359,8 +361,42 @@ static void GridGetObs(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::s
|
|
|
|
|
|
for(i=0;i<NYC;i++)
|
|
|
{
|
|
|
+ iv::fusion::fusionobject fusion_obj;
|
|
|
+ fusion_obj.set_id(i);
|
|
|
+ iv::fusion::PointXYZ centroid;
|
|
|
+ iv::fusion::PointXYZ *centroid_;
|
|
|
+ centroid.set_x(0);
|
|
|
+ centroid.set_y(0);
|
|
|
+ centroid.set_z(0);
|
|
|
+ centroid_ = fusion_obj.mutable_centroid();
|
|
|
+ centroid_->CopyFrom(centroid);
|
|
|
+
|
|
|
+ iv::fusion::Dimension dimension;
|
|
|
+ iv::fusion::Dimension *dimension_;
|
|
|
+ dimension.set_x(0);
|
|
|
+ dimension.set_y(0);
|
|
|
+ dimension.set_z(0);
|
|
|
+ dimension_ = fusion_obj.mutable_dimensions();
|
|
|
+ dimension_->CopyFrom(dimension);
|
|
|
+
|
|
|
+ iv::fusion::VelXY vel_relative;
|
|
|
+ iv::fusion::VelXY *vel_relative_;
|
|
|
+ vel_relative.set_x(0);
|
|
|
+ vel_relative.set_y(0);
|
|
|
+ vel_relative_ = fusion_obj.mutable_vel_relative();
|
|
|
+ vel_relative_->CopyFrom(vel_relative);
|
|
|
+
|
|
|
+// std::cout<<": "<<NYC<<std::endl;
|
|
|
+
|
|
|
for(j=0;j<NXC;j++)
|
|
|
{
|
|
|
+ iv::fusion::NomalXYZ nomal_centroid;
|
|
|
+ iv::fusion::NomalXYZ *nomal_centroid_;
|
|
|
+ float low;
|
|
|
+ float high;
|
|
|
+ float nomal_z;
|
|
|
+ float nomal_x;
|
|
|
+ float nomal_y;
|
|
|
iv::LidarGrid * p = pobsgrid + i*NXC+j;
|
|
|
if(p->ob>=3)
|
|
|
{
|
|
@@ -370,24 +406,26 @@ static void GridGetObs(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_cloud,std::s
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-// temp.nomal_x = (j-125)*0.2+0.1;
|
|
|
-// temp.nomal_y = (i-250)*0.2+0.1;
|
|
|
-
|
|
|
-
|
|
|
- iv::ObstacleBasic temp;
|
|
|
- temp.low = p->low;
|
|
|
- temp.high = p->high;
|
|
|
- temp.nomal_z = p->high-p->low;
|
|
|
- temp.nomal_x = j*SMALLGRID_SIZE + 0.1+HOR_MIN;
|
|
|
- temp.nomal_y = i*SMALLGRID_SIZE +0.1 +VEC_MIN;
|
|
|
- lidar_obs->push_back(temp);
|
|
|
+ low = p->low;
|
|
|
+ high = p->high;
|
|
|
+ nomal_z = p->high-p->low;
|
|
|
+ nomal_x = j*SMALLGRID_SIZE + 0.1+HOR_MIN;
|
|
|
+ nomal_y = i*SMALLGRID_SIZE +0.1 +VEC_MIN;
|
|
|
}
|
|
|
}
|
|
|
+ if (abs(nomal_x)<0.4 && nomal_y<1.0 && nomal_y>-0.3) continue;
|
|
|
+ nomal_centroid.set_nomal_x(nomal_x);
|
|
|
+ nomal_centroid.set_nomal_y(nomal_y);
|
|
|
+ nomal_centroid.set_nomal_z(nomal_z);
|
|
|
+ nomal_centroid_ = fusion_obj.add_nomal_centroid();
|
|
|
+ nomal_centroid_->CopyFrom(nomal_centroid);
|
|
|
}
|
|
|
+ iv::fusion::fusionobject *obj_ = lidar_obs->add_obj();
|
|
|
+ obj_->CopyFrom(fusion_obj);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
delete pobsgrid;
|
|
|
-
|
|
|
delete floor_find;
|
|
|
delete floor_h_raw;
|
|
|
delete floor_h;
|
|
@@ -439,8 +477,9 @@ static void ListenPointCloud(const char * strdata,const unsigned int nSize,const
|
|
|
p++;
|
|
|
}
|
|
|
|
|
|
- std::shared_ptr<std::vector<iv::ObstacleBasic>> lidar_obs(new std::vector<iv::ObstacleBasic>);
|
|
|
+// std::shared_ptr<std::vector<iv::ObstacleBasic>> lidar_obs(new std::vector<iv::ObstacleBasic>);
|
|
|
|
|
|
+ std::shared_ptr<iv::fusion::fusionobjectarray> lidar_obs(new iv::fusion::fusionobjectarray);
|
|
|
GridGetObs(point_cloud,lidar_obs);
|
|
|
// perception_lidar_vv7_ProcObs(point_cloud,lidar_obs);
|
|
|
|
|
@@ -448,17 +487,24 @@ static void ListenPointCloud(const char * strdata,const unsigned int nSize,const
|
|
|
|
|
|
if(g_robosys == 0)
|
|
|
{
|
|
|
- if(lidar_obs->size() == 0)
|
|
|
+ if(lidar_obs->obj_size() == 0)
|
|
|
{
|
|
|
- iv::ObstacleBasic temp;
|
|
|
- temp.low = 0;
|
|
|
- temp.high = 3.0;
|
|
|
- temp.nomal_z = 3.0;
|
|
|
- temp.nomal_x = 1000;
|
|
|
- temp.nomal_y = 1000;
|
|
|
- lidar_obs->push_back(temp);
|
|
|
+ iv::fusion::fusionobject fake_obj;
|
|
|
+ iv::fusion::fusionobject *fake_obj_;
|
|
|
+ iv::fusion::PointXYZ fake_cen;
|
|
|
+ iv::fusion::PointXYZ *fake_cen_;
|
|
|
+ fake_cen.set_x(10000);
|
|
|
+ fake_cen.set_y(10000);
|
|
|
+ fake_cen.set_z(10000);
|
|
|
+ fake_cen_ = fake_obj.mutable_centroid();
|
|
|
+ fake_cen_ ->CopyFrom(fake_cen);
|
|
|
+
|
|
|
+ fake_obj_ = lidar_obs->add_obj();
|
|
|
+ fake_obj_->CopyFrom(fake_obj);
|
|
|
}
|
|
|
- if(lidar_obs->size() >0)iv::modulecomm::ModuleSendMsg(glidar_obs,(char *)(lidar_obs->data()),lidar_obs->size()*sizeof(iv::ObstacleBasic));
|
|
|
+
|
|
|
+ std::string out = lidar_obs->SerializeAsString();
|
|
|
+ if(lidar_obs->obj_size() >0)iv::modulecomm::ModuleSendMsg(glidar_obs,out.data(),out.length());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -645,6 +691,7 @@ int main(int argc, char *argv[])
|
|
|
gfault = new iv::Ivfault("lidar_grid");
|
|
|
givlog = new iv::Ivlog("lidar_grid");
|
|
|
|
|
|
+
|
|
|
snprintf(gstr_yaml,255,"");
|
|
|
|
|
|
int nRtn = GetOptLong(argc,argv);
|
|
@@ -653,14 +700,14 @@ int main(int argc, char *argv[])
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- snprintf(gstr_sensorheight,255,"2.0");
|
|
|
- snprintf(gstr_vehicleheight,255,"2.3");
|
|
|
+ snprintf(gstr_sensorheight,255,"1.35");
|
|
|
+ snprintf(gstr_vehicleheight,255,"1.5");
|
|
|
snprintf(gstr_inputmemname,255,"lidar_pc");
|
|
|
- snprintf(gstr_outputmemname,255,"lidar_obs");
|
|
|
- snprintf(gstr_skipxmin,255,"-0.9");
|
|
|
- snprintf(gstr_skipxmax,255,"0.9");
|
|
|
- snprintf(gstr_skipymin,255,"-2.3");
|
|
|
- snprintf(gstr_skipymax,255,"2.3");
|
|
|
+ snprintf(gstr_outputmemname,255,"li_ra_fusion");
|
|
|
+ snprintf(gstr_skipxmin,255,"-0.4");
|
|
|
+ snprintf(gstr_skipxmax,255,"0.4");
|
|
|
+ snprintf(gstr_skipymin,255,"0.0");
|
|
|
+ snprintf(gstr_skipymax,255,"0.3");
|
|
|
|
|
|
|
|
|
givlog->verbose("yaml is %s ",gstr_yaml);
|