@@ -45,11 +45,12 @@ bool limitGroundLift = false;
4545double maxGroundLift = 0.15 ;
4646bool clearDyObs = false ;
4747double minDyObsDis = 0.3 ;
48- double minDyObsHeight = 0.2 ;
4948double absDyObsRelZThre = 0.2 ;
5049double minDyObsVFOV = -16.0 ;
5150double maxDyObsVFOV = 16.0 ;
5251int minDyObsPointNum = 1 ;
52+ int minOutOfFovPointNum = 2 ;
53+ double obstacleHeightThre = 0.2 ;
5354bool noDataObstacle = false ;
5455int noDataBlockSkipNum = 0 ;
5556int minBlockPointNum = 10 ;
@@ -91,6 +92,7 @@ float terrainVoxelUpdateTime[terrainVoxelNum] = {0};
9192float planarVoxelElev[planarVoxelNum] = {0 };
9293int planarVoxelEdge[planarVoxelNum] = {0 };
9394int planarVoxelDyObs[planarVoxelNum] = {0 };
95+ int planarVoxelOutOfFov[planarVoxelNum] = {0 };
9496vector<float > planarPointElev[planarVoxelNum];
9597
9698double laserCloudTime = 0 ;
@@ -211,11 +213,12 @@ int main(int argc, char **argv) {
211213 nh->declare_parameter <double >(" maxGroundLift" , maxGroundLift);
212214 nh->declare_parameter <bool >(" clearDyObs" , clearDyObs);
213215 nh->declare_parameter <double >(" minDyObsDis" , minDyObsDis);
214- nh->declare_parameter <double >(" minDyObsHeight" , minDyObsHeight);
215216 nh->declare_parameter <double >(" absDyObsRelZThre" , absDyObsRelZThre);
216217 nh->declare_parameter <double >(" minDyObsVFOV" , minDyObsVFOV);
217218 nh->declare_parameter <double >(" maxDyObsVFOV" , maxDyObsVFOV);
218219 nh->declare_parameter <int >(" minDyObsPointNum" , minDyObsPointNum);
220+ nh->declare_parameter <int >(" minOutOfFovPointNum" , minOutOfFovPointNum);
221+ nh->declare_parameter <double >(" obstacleHeightThre" , obstacleHeightThre);
219222 nh->declare_parameter <bool >(" noDataObstacle" , noDataObstacle);
220223 nh->declare_parameter <int >(" noDataBlockSkipNum" , noDataBlockSkipNum);
221224 nh->declare_parameter <int >(" minBlockPointNum" , minBlockPointNum);
@@ -237,11 +240,12 @@ int main(int argc, char **argv) {
237240 nh->get_parameter (" maxGroundLift" , maxGroundLift);
238241 nh->get_parameter (" clearDyObs" , clearDyObs);
239242 nh->get_parameter (" minDyObsDis" , minDyObsDis);
240- nh->get_parameter (" minDyObsHeight" , minDyObsHeight);
241243 nh->get_parameter (" absDyObsRelZThre" , absDyObsRelZThre);
242244 nh->get_parameter (" minDyObsVFOV" , minDyObsVFOV);
243245 nh->get_parameter (" maxDyObsVFOV" , maxDyObsVFOV);
244246 nh->get_parameter (" minDyObsPointNum" , minDyObsPointNum);
247+ nh->get_parameter (" minOutOfFovPointNum" , minOutOfFovPointNum);
248+ nh->get_parameter (" obstacleHeightThre" , obstacleHeightThre);
245249 nh->get_parameter (" noDataObstacle" , noDataObstacle);
246250 nh->get_parameter (" noDataBlockSkipNum" , noDataBlockSkipNum);
247251 nh->get_parameter (" minBlockPointNum" , minBlockPointNum);
@@ -415,6 +419,7 @@ int main(int argc, char **argv) {
415419 planarVoxelElev[i] = 0 ;
416420 planarVoxelEdge[i] = 0 ;
417421 planarVoxelDyObs[i] = 0 ;
422+ planarVoxelOutOfFov[i] = 0 ;
418423 planarPointElev[i].clear ();
419424 }
420425
@@ -513,7 +518,7 @@ int main(int argc, char **argv) {
513518 float dis1 = sqrt (pointX1 * pointX1 + pointY1 * pointY1);
514519 if (dis1 > minDyObsDis) {
515520 float h1 = point.z - planarVoxelElev[planarVoxelWidth * indX + indY];
516- if (h1 > minDyObsHeight ) {
521+ if (h1 > obstacleHeightThre ) {
517522 float pointX2 =
518523 pointX1 * cosVehicleYaw + pointY1 * sinVehicleYaw;
519524 float pointY2 =
@@ -536,11 +541,12 @@ int main(int argc, char **argv) {
536541 float angle4 = atan2 (pointZ4, dis4) * 180.0 / PI;
537542 if (angle4 > minDyObsVFOV && angle4 < maxDyObsVFOV || fabs (pointZ4) < absDyObsRelZThre) {
538543 planarVoxelDyObs[planarVoxelWidth * indX + indY]++;
544+ } else {
545+ planarVoxelOutOfFov[planarVoxelWidth * indX + indY]++;
539546 }
540547 }
541548 } else {
542- planarVoxelDyObs[planarVoxelWidth * indX + indY] +=
543- minDyObsPointNum;
549+ planarVoxelDyObs[planarVoxelWidth * indX + indY] += minDyObsPointNum;
544550 }
545551 }
546552 }
@@ -561,7 +567,7 @@ int main(int argc, char **argv) {
561567 if (indX >= 0 && indX < planarVoxelWidth && indY >= 0 &&
562568 indY < planarVoxelWidth) {
563569 float h1 = point.z - planarVoxelElev[planarVoxelWidth * indX + indY];
564- if (h1 > minDyObsHeight ) {
570+ if (h1 > obstacleHeightThre ) {
565571 planarVoxelDyObs[planarVoxelWidth * indX + indY] = 0 ;
566572 }
567573 }
@@ -585,16 +591,16 @@ int main(int argc, char **argv) {
585591
586592 if (indX >= 0 && indX < planarVoxelWidth && indY >= 0 &&
587593 indY < planarVoxelWidth) {
588- if (planarVoxelDyObs[planarVoxelWidth * indX + indY] < minDyObsPointNum ||
589- !clearDyObs) {
594+ if (planarVoxelDyObs[planarVoxelWidth * indX + indY] < minDyObsPointNum || !clearDyObs) {
590595 float disZ =
591596 point.z - planarVoxelElev[planarVoxelWidth * indX + indY];
592597 if (considerDrop)
593598 disZ = fabs (disZ);
594599 int planarPointElevSize =
595600 planarPointElev[planarVoxelWidth * indX + indY].size ();
596- if (disZ >= 0 && disZ < vehicleHeight &&
597- planarPointElevSize >= minBlockPointNum) {
601+ int outOfFovPointNum = planarVoxelOutOfFov[planarVoxelWidth * indX + indY];
602+ if (disZ >= 0 && disZ < vehicleHeight && planarPointElevSize >= minBlockPointNum &&
603+ (outOfFovPointNum <= 0 || outOfFovPointNum >= minOutOfFovPointNum || disZ < obstacleHeightThre)) {
598604 terrainCloudElev->push_back (point);
599605 terrainCloudElev->points [terrainCloudElevSize].intensity = disZ;
600606
0 commit comments