11#include " mapOptimization/mapOptimization.hpp"
22
3- void mapOptimization::pointAssociateToMap (PointType const * const pi, PointType * const po)
4- {
5- po->x = transPointAssociateToMap (0 ,0 ) * pi->x + transPointAssociateToMap (0 ,1 ) * pi->y + transPointAssociateToMap (0 ,2 ) * pi->z + transPointAssociateToMap (0 ,3 );
6- po->y = transPointAssociateToMap (1 ,0 ) * pi->x + transPointAssociateToMap (1 ,1 ) * pi->y + transPointAssociateToMap (1 ,2 ) * pi->z + transPointAssociateToMap (1 ,3 );
7- po->z = transPointAssociateToMap (2 ,0 ) * pi->x + transPointAssociateToMap (2 ,1 ) * pi->y + transPointAssociateToMap (2 ,2 ) * pi->z + transPointAssociateToMap (2 ,3 );
8- po->intensity = pi->intensity ;
9- }
103
114pcl::PointCloud<PointType>::Ptr mapOptimization::transformPointCloud (pcl::PointCloud<PointType>::Ptr cloudIn, PointTypePose* transformIn)
125{
@@ -403,9 +396,9 @@ void mapOptimization::publishFrames()
403396 pcl::PointCloud<PointType>::Ptr transformedInput = transformPointCloud (laserCloudSurfLastDS, &thisPose6D);
404397 pcl::PointCloud<pcl::PointXYZRGB>::Ptr coloredCloud (new pcl::PointCloud<pcl::PointXYZRGB>());
405398
406- const int codeBound = laserCloudSurfLastDSNum < static_cast <int >(laserCloudSurfDebugCode.size ())
399+ const int codeBound = laserCloudSurfLastDSNum < static_cast <int >(scanAligner-> laserCloudSurfDebugCode .size ())
407400 ? laserCloudSurfLastDSNum
408- : static_cast <int >(laserCloudSurfDebugCode.size ());
401+ : static_cast <int >(scanAligner-> laserCloudSurfDebugCode .size ());
409402 const int pointBound = codeBound < static_cast <int >(transformedInput->size ())
410403 ? codeBound
411404 : static_cast <int >(transformedInput->size ());
@@ -418,21 +411,21 @@ void mapOptimization::publishFrames()
418411 point.y = transformedInput->points [i].y ;
419412 point.z = transformedInput->points [i].z ;
420413
421- switch (laserCloudSurfDebugCode[i])
414+ switch (scanAligner-> laserCloudSurfDebugCode [i])
422415 {
423- case SURF_DEBUG_ACCEPTED:
416+ case ScanAligner:: SURF_DEBUG_ACCEPTED:
424417 point.r = 0 ; point.g = 255 ; point.b = 0 ; // green
425418 break ;
426- case SURF_DEBUG_REJECTED_NEIGHBOR_COUNT:
419+ case ScanAligner:: SURF_DEBUG_REJECTED_NEIGHBOR_COUNT:
427420 point.r = 255 ; point.g = 0 ; point.b = 0 ; // red
428421 break ;
429- case SURF_DEBUG_REJECTED_KNN_DISTANCE:
422+ case ScanAligner:: SURF_DEBUG_REJECTED_KNN_DISTANCE:
430423 point.r = 255 ; point.g = 165 ; point.b = 0 ; // orange
431424 break ;
432- case SURF_DEBUG_REJECTED_PLANE_INVALID:
425+ case ScanAligner:: SURF_DEBUG_REJECTED_PLANE_INVALID:
433426 point.r = 255 ; point.g = 255 ; point.b = 0 ; // yellow
434427 break ;
435- case SURF_DEBUG_REJECTED_LOW_WEIGHT:
428+ case ScanAligner:: SURF_DEBUG_REJECTED_LOW_WEIGHT:
436429 point.r = 255 ; point.g = 0 ; point.b = 255 ; // magenta
437430 break ;
438431 default :
@@ -473,7 +466,7 @@ void mapOptimization::publishFrames()
473466 if (pubMatchedSurfFeatures->get_subscription_count () != 0 )
474467 {
475468 pcl::PointCloud<PointType>::Ptr cloudOut (new pcl::PointCloud<PointType>());
476- *cloudOut += *transformPointCloud (laserCloudOri , &thisPose6D);
469+ *cloudOut += *transformPointCloud (scanAligner-> getLaserCloudOri () , &thisPose6D);
477470 publishCloud (pubMatchedSurfFeatures, cloudOut, timeLaserInfoStamp, mapFrameLocal);
478471 }
479472 // publish registered high-res raw cloud
@@ -492,24 +485,6 @@ void mapOptimization::publishFrames()
492485 globalPath.header .frame_id = mapFrameLocal;
493486 pubPath->publish (globalPath);
494487 }
495- // publish SLAM infomation for 3rd-party usage
496- if (pubSLAMInfo->get_subscription_count () != 0 )
497- {
498- // if (lastSLAMInfoPubSize != cloudKeyPoses6D->size())
499- // {
500- // liorf::msg::CloudInfo slamInfo;
501- // slamInfo.header.stamp = timeLaserInfoStamp;
502- // pcl::PointCloud<PointType>::Ptr cloudOut(new pcl::PointCloud<PointType>());
503- // *cloudOut += *laserCloudSurfLastDS;
504- // slamInfo.key_frame_cloud = publishCloud(rclcpp::Publisher(), cloudOut, timeLaserInfoStamp, lidarFrame);
505- // slamInfo.key_frame_poses = publishCloud(rclcpp::Publisher(), cloudKeyPoses6D, timeLaserInfoStamp, odometryFrame);
506- // pcl::PointCloud<PointType>::Ptr localMapOut(new pcl::PointCloud<PointType>());
507- // *localMapOut += *laserCloudSurfFromMapDS;
508- // slamInfo.key_frame_map = publishCloud(rclcpp::Publisher(), localMapOut, timeLaserInfoStamp, odometryFrame);
509- // pubSLAMInfo->publish(slamInfo);
510- // lastSLAMInfoPubSize = cloudKeyPoses6D->size();
511- // }
512- }
513488}
514489
515490
0 commit comments