|
@@ -3,6 +3,8 @@
|
|
|
|
|
|
#include <pcl/io/io.h>
|
|
#include <pcl/io/io.h>
|
|
#include <pcl/io/pcd_io.h>
|
|
#include <pcl/io/pcd_io.h>
|
|
|
|
+//#include <pcl/filters/statistical_outlier_removal.h>
|
|
|
|
+#include <pcl/filters/radius_outlier_removal.h>
|
|
|
|
|
|
#include <iostream>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <fstream>
|
|
@@ -62,6 +64,52 @@ void dec_yaml(const char * stryamlpath)
|
|
std::string stroffset_x;
|
|
std::string stroffset_x;
|
|
std::string stroffset_y;
|
|
std::string stroffset_y;
|
|
std::string stroffset_z;
|
|
std::string stroffset_z;
|
|
|
|
+ std::string strangle_x;
|
|
|
|
+ std::string strangle_y;
|
|
|
|
+ std::string strangle_z;
|
|
|
|
+ std::string strtem;
|
|
|
|
+
|
|
|
|
+ double fignore_xmax = 0;
|
|
|
|
+ double fignore_ymax = 0;
|
|
|
|
+ double fignore_xmin = 0;
|
|
|
|
+ double fignore_ymin = 0;
|
|
|
|
+ double fignore_zmax = 0;
|
|
|
|
+ double fignore_zmin = 0;
|
|
|
|
+
|
|
|
|
+ if(config["ignore"]["xmin"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["xmin"].as<std::string>();
|
|
|
|
+ fignore_xmin = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["ignore"]["ymin"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["ymin"].as<std::string>();
|
|
|
|
+ fignore_ymin = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["ignore"]["xmax"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["xmax"].as<std::string>();
|
|
|
|
+ fignore_xmax = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(config["ignore"]["ymax"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["ymax"].as<std::string>();
|
|
|
|
+ fignore_ymax = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config["ignore"]["zmax"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["zmax"].as<std::string>();
|
|
|
|
+ fignore_zmax = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config["ignore"]["zmin"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config["ignore"]["zmin"].as<std::string>();
|
|
|
|
+ fignore_zmin = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
for(i=0;i<nlidarsize;i++)
|
|
for(i=0;i<nlidarsize;i++)
|
|
{
|
|
{
|
|
@@ -73,15 +121,62 @@ void dec_yaml(const char * stryamlpath)
|
|
stroffset_x = config[veclidarname[i].data()]["offset"]["x"].as<std::string>();
|
|
stroffset_x = config[veclidarname[i].data()]["offset"]["x"].as<std::string>();
|
|
stroffset_y = config[veclidarname[i].data()]["offset"]["y"].as<std::string>();
|
|
stroffset_y = config[veclidarname[i].data()]["offset"]["y"].as<std::string>();
|
|
stroffset_z = config[veclidarname[i].data()]["offset"]["z"].as<std::string>();
|
|
stroffset_z = config[veclidarname[i].data()]["offset"]["z"].as<std::string>();
|
|
|
|
+ strangle_x = config[veclidarname[i].data()]["angle"]["x"].as<std::string>();
|
|
|
|
+ strangle_y = config[veclidarname[i].data()]["angle"]["y"].as<std::string>();
|
|
|
|
+ strangle_z = config[veclidarname[i].data()]["angle"]["z"].as<std::string>();
|
|
|
|
|
|
iv::lidar_data xlidardata;
|
|
iv::lidar_data xlidardata;
|
|
xlidardata.foff_x = atof(stroffset_x.data());
|
|
xlidardata.foff_x = atof(stroffset_x.data());
|
|
xlidardata.foff_y = atof(stroffset_y.data());
|
|
xlidardata.foff_y = atof(stroffset_y.data());
|
|
xlidardata.foff_z = atof(stroffset_z.data());
|
|
xlidardata.foff_z = atof(stroffset_z.data());
|
|
|
|
+ xlidardata.fang_x = atof(strangle_x.data());
|
|
|
|
+ xlidardata.fang_y = atof(strangle_y.data());
|
|
|
|
+ xlidardata.fang_z = atof(strangle_z.data());
|
|
|
|
+ if(config[veclidarname[i].data()]["maximum"]["x"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["maximum"]["x"].as<std::string>();
|
|
|
|
+ xlidardata.fmax_x = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config[veclidarname[i].data()]["maximum"]["y"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["maximum"]["y"].as<std::string>();
|
|
|
|
+ xlidardata.fmax_y = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config[veclidarname[i].data()]["maximum"]["z"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["maximum"]["z"].as<std::string>();
|
|
|
|
+ xlidardata.fmax_z = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config[veclidarname[i].data()]["minimum"]["x"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["minimum"]["x"].as<std::string>();
|
|
|
|
+ xlidardata.fmin_x = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config[veclidarname[i].data()]["minimum"]["y"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["minimum"]["y"].as<std::string>();
|
|
|
|
+ xlidardata.fmin_y = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+ if(config[veclidarname[i].data()]["minimum"]["z"])
|
|
|
|
+ {
|
|
|
|
+ strtem = config[veclidarname[i].data()]["minimum"]["z"].as<std::string>();
|
|
|
|
+ xlidardata.fmin_z = atof(strtem.data());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ xlidardata.fignore_xmax = fignore_xmax;
|
|
|
|
+ xlidardata.fignore_ymax = fignore_ymax;
|
|
|
|
+ xlidardata.fignore_xmin = fignore_xmin;
|
|
|
|
+ xlidardata.fignore_ymin = fignore_ymin;
|
|
|
|
+ xlidardata.fignore_zmax = fignore_zmax;
|
|
|
|
+ xlidardata.fignore_zmin = fignore_zmin;
|
|
|
|
+
|
|
|
|
+
|
|
strncpy(xlidardata.strmemname,strmemname.data(),255);
|
|
strncpy(xlidardata.strmemname,strmemname.data(),255);
|
|
gvectorlidar.push_back(xlidardata);
|
|
gvectorlidar.push_back(xlidardata);
|
|
qDebug("name is %s ",strmemname.data());
|
|
qDebug("name is %s ",strmemname.data());
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -138,7 +233,9 @@ void ListenPointCloud(const char * strdata,const unsigned int nSize,const unsign
|
|
if(strncmp(strmemname,gvectorlidar[i].strmemname,255) == 0)
|
|
if(strncmp(strmemname,gvectorlidar[i].strmemname,255) == 0)
|
|
{
|
|
{
|
|
gMutex.lock();
|
|
gMutex.lock();
|
|
|
|
+ gvectorlidar[i].mpoint_cloud_old = gvectorlidar[i].mpoint_cloud;
|
|
gvectorlidar[i].mpoint_cloud = point_cloud;
|
|
gvectorlidar[i].mpoint_cloud = point_cloud;
|
|
|
|
+ gvectorlidar[i].mupdatetime = QDateTime::currentMSecsSinceEpoch();
|
|
gvectorlidar[i].bUpdate = true;
|
|
gvectorlidar[i].bUpdate = true;
|
|
gMutex.unlock();
|
|
gMutex.unlock();
|
|
}
|
|
}
|
|
@@ -170,6 +267,9 @@ void merge()
|
|
pcl::PointCloud<pcl::PointXYZI>::Ptr point_cloud(
|
|
pcl::PointCloud<pcl::PointXYZI>::Ptr point_cloud(
|
|
new pcl::PointCloud<pcl::PointXYZI>());
|
|
new pcl::PointCloud<pcl::PointXYZI>());
|
|
|
|
|
|
|
|
+ pcl::PointCloud<pcl::PointXYZI>::Ptr cloud_filtered(
|
|
|
|
+ new pcl::PointCloud<pcl::PointXYZI>());
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
gMutex.lock();
|
|
gMutex.lock();
|
|
@@ -180,6 +280,11 @@ void merge()
|
|
}
|
|
}
|
|
gMutex.unlock();
|
|
gMutex.unlock();
|
|
point_cloud = mergefunc(xvectorlidar);
|
|
point_cloud = mergefunc(xvectorlidar);
|
|
|
|
+// pcl::RadiusOutlierRemoval<pcl::PointXYZI> pcFilter;
|
|
|
|
+// pcFilter.setInputCloud(point_cloud);
|
|
|
|
+// pcFilter.setRadiusSearch(0.8);
|
|
|
|
+// pcFilter.setMinNeighborsInRadius(5);
|
|
|
|
+// pcFilter.filter(*cloud_filtered);
|
|
sharepointcloud(point_cloud,gpaout);
|
|
sharepointcloud(point_cloud,gpaout);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -198,7 +303,7 @@ void mergethread()
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(((QDateTime::currentMSecsSinceEpoch() - glasttime)>150) ||(bNOtAllOK == false))
|
|
|
|
|
|
+ if(((QDateTime::currentMSecsSinceEpoch() - glasttime)>=150) ||(bNOtAllOK == false))
|
|
{
|
|
{
|
|
merge();
|
|
merge();
|
|
qDebug("time is %ld",glasttime);
|
|
qDebug("time is %ld",glasttime);
|