MCPcopy Create free account
hub / github.com/HaisenbergPeng/ROLL / visualizeLoopClosure

Method visualizeLoopClosure

src/mapOptmization.cpp:1683–1736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1681 }
1682
1683 void visualizeLoopClosure()
1684 {
1685 if (loopIndexContainer.empty())
1686 return;
1687
1688 visualization_msgs::MarkerArray markerArray;
1689 // loop nodes
1690 visualization_msgs::Marker markerNode;
1691 markerNode.header.frame_id = mapFrame;
1692 markerNode.header.stamp = timeLidarInfoStamp;
1693 markerNode.action = visualization_msgs::Marker::ADD;
1694 markerNode.type = visualization_msgs::Marker::SPHERE_LIST;
1695 markerNode.ns = "loop_nodes";
1696 markerNode.id = 0;
1697 markerNode.pose.orientation.w = 1;
1698 markerNode.scale.x = 0.3; markerNode.scale.y = 0.3; markerNode.scale.z = 0.3;
1699 markerNode.color.r = 0; markerNode.color.g = 0.8; markerNode.color.b = 1;
1700 markerNode.color.a = 1;
1701 // loop edges
1702 visualization_msgs::Marker markerEdge;
1703 markerEdge.header.frame_id = mapFrame;
1704 markerEdge.header.stamp = timeLidarInfoStamp;
1705 markerEdge.action = visualization_msgs::Marker::ADD;
1706 markerEdge.type = visualization_msgs::Marker::LINE_LIST;
1707 markerEdge.ns = "loop_edges";
1708 markerEdge.id = 1;
1709 markerEdge.pose.orientation.w = 1;
1710 markerEdge.scale.x = 0.1;
1711 markerEdge.color.r = 0.9; markerEdge.color.g = 0.9; markerEdge.color.b = 0;
1712 markerEdge.color.a = 1;
1713
1714 for (auto it = loopIndexContainer.begin(); it != loopIndexContainer.end(); ++it)
1715 {
1716 int key_cur = it->first;
1717 int key_pre = it->second;
1718 geometry_msgs::Point p;
1719 p.x = copy_cloudKeyPoses6D->points[key_cur].x;
1720 p.y = copy_cloudKeyPoses6D->points[key_cur].y;
1721 p.z = copy_cloudKeyPoses6D->points[key_cur].z;
1722 markerNode.points.push_back(p);
1723 markerEdge.points.push_back(p);
1724 p.x = copy_cloudKeyPoses6D->points[key_pre].x;
1725 p.y = copy_cloudKeyPoses6D->points[key_pre].y;
1726 p.z = copy_cloudKeyPoses6D->points[key_pre].z;
1727 markerNode.points.push_back(p);
1728 markerEdge.points.push_back(p);
1729 }
1730
1731 markerArray.markers.push_back(markerNode);
1732 markerArray.markers.push_back(markerEdge);
1733 pubLoopConstraintEdge.publish(markerArray);
1734 // ROS_INFO_STREAM("Loop noise: "<<noiseVec[noiseVec.size()-1]);
1735
1736 }
1737
1738 pcl::PointCloud<PointType>::Ptr transformPointCloud(pcl::PointCloud<PointType>::Ptr cloudIn, Eigen::Affine3f transCur)
1739 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected