28 #include <boost/serialization/vector.hpp> 46 #define MAX_VARIANCE 500.0 47 #define DISTANCE_PENALTY_GAIN 0.2 48 #define ANGLE_PENALTY_GAIN 0.2 213 std::cout <<
"Remove Scan: Failed to find scan in m_Scans" << std::endl;
236 template<
class Archive>
239 ar & BOOST_SERIALIZATION_NVP(
m_Scans);
263 if (GetScanManager(rSensorName) ==
NULL)
278 ScanManager* pScanManager = GetScanManager(rSensorName);
279 if (pScanManager !=
NULL)
281 LocalizedRangeScanMap::iterator it = pScanManager->
GetScans().find(scanIndex);
282 if (it != pScanManager->
GetScans().end())
303 RegisterSensor(rSensorName);
305 return GetScanManager(rSensorName)->GetLastScan();
314 GetScanManager(pScan)->SetLastScan(pScan);
323 GetScanManager(pScan)->ClearLastScan();
332 GetScanManager(name)->ClearLastScan();
341 GetScanManager(pScan)->AddScan(pScan, m_NextScanId);
342 m_Scans.insert({m_NextScanId, pScan});
352 GetScanManager(pScan)->AddRunningScan(pScan);
361 GetScanManager(pScan)->RemoveScan(pScan);
371 std::cout <<
"RemoveScan: Failed to find scan in m_Scans" << std::endl;
382 return GetScanManager(rSensorName)->GetScans();
392 return GetScanManager(rSensorName)->GetRunningScans();
397 GetScanManager(rSensorName)->ClearRunningScans();
403 return GetScanManager(rSensorName)->GetRunningScanBufferSize();
410 std::vector<Name> names = GetSensorNames();
411 for (uint i = 0; i != names.size(); i++) {
412 GetScanManager(names[i])->SetRunningScanBufferSize(rScanBufferSize);
420 std::vector<Name> names = GetSensorNames();
421 for (uint i = 0; i != names.size(); i++) {
422 GetScanManager(names[i])->SetRunningScanBufferMaximumDistance(rScanBufferMaxDistance);
438 LocalizedRangeScanMap::iterator it;
439 for (it = rScans.begin(); it != rScans.end(); ++it)
441 scans.push_back(it->second);
458 iter->second =
nullptr;
461 m_ScanManagers.clear();
470 if (m_pCorrelationGrid)
472 delete m_pCorrelationGrid;
474 if (m_pSearchSpaceProbs)
476 delete m_pSearchSpaceProbs;
480 delete m_pGridLookup;
497 if (smearDeviation < 0)
501 if (rangeThreshold <= 0)
513 kt_int32u pointReadingMargin =
static_cast<kt_int32u>(ceil(rangeThreshold / resolution));
515 kt_int32s gridSize = searchSpaceSideSize + 2 * pointReadingMargin;
518 assert(gridSize % 2 == 1);
523 searchSpaceSideSize, resolution);
562 rCovariance(2, 2) = 4 *
math::Square(m_pMapper->m_pCoarseAngleResolution->GetValue());
572 offset.
SetX(scanPose.
GetX() - (0.5 * (roi.
GetWidth() - 1) * m_pCorrelationGrid->GetResolution()));
573 offset.
SetY(scanPose.
GetY() - (0.5 * (roi.
GetHeight() - 1) * m_pCorrelationGrid->GetResolution()));
576 m_pCorrelationGrid->GetCoordinateConverter()->SetOffset(offset);
584 Vector2<kt_double> searchDimensions(m_pSearchSpaceProbs->GetWidth(), m_pSearchSpaceProbs->GetHeight());
585 Vector2<kt_double> coarseSearchOffset(0.5 * (searchDimensions.GetX() - 1) * m_pCorrelationGrid->GetResolution(),
586 0.5 * (searchDimensions.GetY() - 1) * m_pCorrelationGrid->GetResolution());
590 2 * m_pCorrelationGrid->GetResolution());
593 kt_double bestResponse = CorrelateScan(pScan, scanPose, coarseSearchOffset, coarseSearchResolution,
594 m_pMapper->m_pCoarseSearchAngleOffset->GetValue(),
595 m_pMapper->m_pCoarseAngleResolution->GetValue(),
596 doPenalize, rMean, rCovariance,
false);
598 if (m_pMapper->m_pUseResponseExpansion->GetValue() ==
true)
603 std::cout <<
"Mapper Info: Expanding response search space!" << std::endl;
606 kt_double newSearchAngleOffset = m_pMapper->m_pCoarseSearchAngleOffset->GetValue();
611 bestResponse = CorrelateScan(pScan, scanPose, coarseSearchOffset, coarseSearchResolution,
612 newSearchAngleOffset, m_pMapper->m_pCoarseAngleResolution->GetValue(),
613 doPenalize, rMean, rCovariance,
false);
624 std::cout <<
"Mapper Warning: Unable to calculate response!" << std::endl;
633 Vector2<kt_double> fineSearchResolution(m_pCorrelationGrid->GetResolution(), m_pCorrelationGrid->GetResolution());
634 bestResponse = CorrelateScan(pScan, rMean, fineSearchOffset, fineSearchResolution,
635 0.5 * m_pMapper->m_pCoarseAngleResolution->GetValue(),
636 m_pMapper->m_pFineSearchAngleOffset->GetValue(),
637 doPenalize, rMean, rCovariance,
true);
641 std::cout <<
" BEST POSE = " << rMean <<
" BEST RESPONSE = " << bestResponse <<
", VARIANCE = " 642 << rCovariance(0, 0) <<
", " << rCovariance(1, 1) << std::endl;
653 kt_int32u y_pose = std::find(m_yPoses.begin(), m_yPoses.end(), y) - m_yPoses.begin();
655 const kt_int32u size_x = m_xPoses.size();
657 kt_double newPositionY = m_rSearchCenter.GetY() + y;
660 for ( std::vector<kt_double>::const_iterator xIter = m_xPoses.begin(); xIter != m_xPoses.end(); ++xIter )
662 x_pose = std::distance(m_xPoses.begin(), xIter);
664 kt_double newPositionX = m_rSearchCenter.GetX() + x;
668 kt_int32s gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
669 assert(gridIndex >= 0);
672 kt_double startAngle = m_rSearchCenter.GetHeading() - m_searchAngleOffset;
673 for (
kt_int32u angleIndex = 0; angleIndex < m_nAngles; angleIndex++)
675 angle = startAngle + angleIndex * m_searchAngleResolution;
681 kt_double squaredDistance = squareX + squareY;
683 squaredDistance / m_pMapper->m_pDistanceVariancePenalty->GetValue());
684 distancePenalty =
math::Maximum(distancePenalty, m_pMapper->m_pMinimumDistancePenalty->GetValue());
688 squaredAngleDistance / m_pMapper->m_pAngleVariancePenalty->GetValue());
689 anglePenalty =
math::Maximum(anglePenalty, m_pMapper->m_pMinimumAnglePenalty->GetValue());
691 response *= (distancePenalty * anglePenalty);
695 poseResponseCounter = (y_pose*size_x + x_pose)*(m_nAngles) + angleIndex;
696 m_pPoseResponse[poseResponseCounter] = std::pair<kt_double, Pose2>(response,
Pose2(newPositionX, newPositionY,
725 assert(searchAngleResolution != 0.0);
728 m_pGridLookup->ComputeOffsets(pScan, rSearchCenter.
GetHeading(), searchAngleOffset, searchAngleResolution);
733 m_pSearchSpaceProbs->Clear();
737 m_pSearchSpaceProbs->GetCoordinateConverter()->SetOffset(offset);
744 2.0 / rSearchSpaceResolution.
GetX()) + 1);
746 for (
kt_int32u xIndex = 0; xIndex < nX; xIndex++)
748 m_xPoses.push_back(startX + xIndex * rSearchSpaceResolution.
GetX());
754 2.0 / rSearchSpaceResolution.
GetY()) + 1);
756 for (
kt_int32u yIndex = 0; yIndex < nY; yIndex++)
758 m_yPoses.push_back(startY + yIndex * rSearchSpaceResolution.
GetY());
765 kt_int32u poseResponseSize =
static_cast<kt_int32u>(m_xPoses.size() * m_yPoses.size() * nAngles);
768 m_pPoseResponse =
new std::pair<kt_double, Pose2>[poseResponseSize];
771 + startX, rSearchCenter.
GetY() + startY));
774 m_rSearchCenter = rSearchCenter;
775 m_searchAngleOffset = searchAngleOffset;
777 m_searchAngleResolution = searchAngleResolution;
778 m_doPenalize = doPenalize;
779 tbb::parallel_do(m_yPoses, (*
this) );
783 for (
kt_int32u i = 0; i < poseResponseSize; i++)
785 bestResponse =
math::Maximum(bestResponse, m_pPoseResponse[i].first);
790 const Pose2& rPose = m_pPoseResponse[i].second;
796 ptr = (
kt_double*)(m_pSearchSpaceProbs->GetDataPointer(grid));
800 throw std::runtime_error(
"Mapper FATAL ERROR - unable to get pointer in probability search!");
805 throw std::runtime_error(
"Mapper FATAL ERROR - Index out of range in probability search!");
817 for (
kt_int32u i = 0; i < poseResponseSize; i++)
821 averagePosition += m_pPoseResponse[i].second.GetPosition();
823 kt_double heading = m_pPoseResponse[i].second.GetHeading();
824 thetaX +=
cos(heading);
825 thetaY +=
sin(heading);
832 if (averagePoseCount > 0)
834 averagePosition /= averagePoseCount;
836 thetaX /= averagePoseCount;
837 thetaY /= averagePoseCount;
839 averagePose =
Pose2(averagePosition,
atan2(thetaY, thetaX));
843 throw std::runtime_error(
"Mapper FATAL ERROR - Unable to find best position");
847 delete [] m_pPoseResponse;
848 m_pPoseResponse =
nullptr;
851 std::cout <<
"bestPose: " << averagePose << std::endl;
852 std::cout <<
"bestResponse: " << bestResponse << std::endl;
857 ComputePositionalCovariance(averagePose, bestResponse, rSearchCenter, rSearchSpaceOffset,
858 rSearchSpaceResolution, searchAngleResolution, rCovariance);
862 ComputeAngularCovariance(averagePose, bestResponse, rSearchCenter,
863 searchAngleOffset, searchAngleResolution, rCovariance);
869 std::cout <<
"bestPose: " << averagePose << std::endl;
872 if (bestResponse > 1.0)
894 const Pose2& rSearchCenter,
907 rCovariance(2, 2) = 4 *
math::Square(searchAngleResolution);
931 for (
kt_int32u yIndex = 0; yIndex < nY; yIndex++)
933 kt_double y = startY + yIndex * rSearchSpaceResolution.
GetY();
935 for (
kt_int32u xIndex = 0; xIndex < nX; xIndex++)
937 kt_double x = startX + xIndex * rSearchSpaceResolution.
GetX();
940 rSearchCenter.
GetY() + y));
944 if (response >= (bestResponse - 0.1))
947 accumulatedVarianceXX += (
math::Square(x - dx) * response);
948 accumulatedVarianceXY += ((x - dx) * (y - dy) * response);
949 accumulatedVarianceYY += (
math::Square(y - dy) * response);
956 kt_double varianceXX = accumulatedVarianceXX / norm;
957 kt_double varianceXY = accumulatedVarianceXY / norm;
958 kt_double varianceYY = accumulatedVarianceYY / norm;
969 kt_double multiplier = 1.0 / bestResponse;
970 rCovariance(0, 0) = varianceXX * multiplier;
971 rCovariance(0, 1) = varianceXY * multiplier;
972 rCovariance(1, 0) = varianceXY * multiplier;
973 rCovariance(1, 1) = varianceYY * multiplier;
974 rCovariance(2, 2) = varianceTHTH;
1001 const Pose2& rSearchCenter,
1012 kt_int32s gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
1020 kt_double accumulatedVarianceThTh = 0.0;
1021 for (
kt_int32u angleIndex = 0; angleIndex < nAngles; angleIndex++)
1023 angle = startAngle + angleIndex * searchAngleResolution;
1027 if (response >= (bestResponse - 0.1))
1030 accumulatedVarianceThTh += (
math::Square(angle - bestAngle) * response);
1039 accumulatedVarianceThTh =
math::Square(searchAngleResolution);
1042 accumulatedVarianceThTh /= norm;
1046 accumulatedVarianceThTh = 1000 *
math::Square(searchAngleResolution);
1049 rCovariance(2, 2) = accumulatedVarianceThTh;
1059 m_pCorrelationGrid->Clear();
1080 m_pCorrelationGrid->Clear();
1085 if (iter->second ==
NULL)
1090 AddScan(iter->second, viewPoint);
1108 if (!
math::IsUpTo(gridPoint.
GetX(), m_pCorrelationGrid->GetROI().GetWidth()) ||
1115 int gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
1127 if (doSmear ==
true)
1129 m_pCorrelationGrid->SmearPoint(gridPoint);
1149 PointVectorDouble::const_iterator trailingPointIter = rPointReadings.begin();
1158 if (firstTime && !std::isnan(currentPoint.
GetX()) && !std::isnan(currentPoint.
GetY()))
1160 firstPoint = currentPoint;
1172 double a = rViewPoint.
GetY() - firstPoint.
GetY();
1173 double b = firstPoint.
GetX() - rViewPoint.
GetX();
1174 double c = firstPoint.
GetY() * rViewPoint.
GetX() - firstPoint.
GetX() * rViewPoint.
GetY();
1175 double ss = currentPoint.GetX() * a + currentPoint.GetY() * b + c;
1178 firstPoint = currentPoint;
1182 trailingPointIter = iter;
1186 for (; trailingPointIter != iter; ++trailingPointIter)
1188 validPoints.push_back(*trailingPointIter);
1208 kt_int8u* pByte = m_pCorrelationGrid->GetDataPointer() + gridPositionIndex;
1210 const LookupArray* pOffsets = m_pGridLookup->GetLookupArray(angleIndex);
1211 assert(pOffsets !=
NULL);
1225 kt_int32s pointGridIndex = gridPositionIndex + pAngleIndexPointer[i];
1232 response += pByte[pAngleIndexPointer[i]];
1237 assert(fabs(response) <= 1.0);
1247 template<
typename T>
1278 std::vector<Vertex<T>*> validVertices = TraverseForVertices(pStartVertex, pVisitor);
1280 std::vector<T*> objects;
1283 objects.push_back((*iter)->GetObject());
1297 std::queue<Vertex<T>*> toVisit;
1298 std::set<Vertex<T>*> seenVertices;
1299 std::vector<Vertex<T>*> validVertices;
1301 toVisit.push(pStartVertex);
1302 seenVertices.insert(pStartVertex);
1309 if (pNext !=
NULL && pVisitor->
Visit(pNext))
1312 validVertices.push_back(pNext);
1320 if (seenVertices.find(pAdjacent) == seenVertices.end())
1322 toVisit.push(pAdjacent);
1323 seenVertices.insert(pAdjacent);
1327 }
while (toVisit.empty() ==
false);
1329 return validVertices;
1332 friend class boost::serialization::access;
1333 template<
class Archive>
1348 : m_MaxDistanceSquared(math::
Square(maxDistance))
1349 , m_UseScanBarycenter(useScanBarycenter)
1361 return (squaredDistance <= m_MaxDistanceSquared -
KT_TOLERANCE);
1366 std::cout <<
"Unable to visit valid vertex elements!" << std::endl;
1375 friend class boost::serialization::access;
1376 template<
class Archive>
1380 ar & BOOST_SERIALIZATION_NVP(m_CenterPose);
1381 ar & BOOST_SERIALIZATION_NVP(m_MaxDistanceSquared);
1382 ar & BOOST_SERIALIZATION_NVP(m_UseScanBarycenter);
1394 : m_MaxDistanceSquared(math::
Square(maxDistance))
1395 , m_UseScanBarycenter(useScanBarycenter)
1397 m_CenterPose = refPose;
1407 return (squaredDistance <= m_MaxDistanceSquared -
KT_TOLERANCE);
1414 friend class boost::serialization::access;
1415 template<
class Archive>
1419 ar & BOOST_SERIALIZATION_NVP(m_CenterPose);
1420 ar & BOOST_SERIALIZATION_NVP(m_MaxDistanceSquared);
1421 ar & BOOST_SERIALIZATION_NVP(m_UseScanBarycenter);
1431 : m_pMapper(pMapper)
1481 assert(previousScanNum >= 0);
1491 std::vector<Matrix3> covariances;
1496 assert(pSensorManager->
GetScans(rSensorName).size() == 1);
1498 std::vector<Name> deviceNames = pSensorManager->
GetSensorNames();
1499 forEach(std::vector<Name>, &deviceNames)
1501 const Name& rCandidateSensorName = *iter;
1504 if ((rCandidateSensorName == rSensorName) || (pSensorManager->
GetScans(rCandidateSensorName).empty()))
1512 pSensorManager->
GetScans(rCandidateSensorName),
1513 bestPose, covariance);
1514 LinkScans(pScan, pSensorManager->
GetScan(rCandidateSensorName, 0), bestPose, covariance);
1519 means.push_back(bestPose);
1520 covariances.push_back(covariance);
1528 means.push_back(scanPose);
1529 covariances.push_back(rCovariance);
1550 while (!candidateChain.empty())
1555 bestPose, covariance,
false,
false);
1557 std::stringstream stream;
1558 stream <<
"COARSE RESPONSE: " << coarseResponse
1561 stream <<
" var: " << covariance(0, 0) <<
", " << covariance(1, 1)
1572 tmpScan.SetTime(pScan->
GetTime());
1575 tmpScan.SetSensorPose(bestPose);
1577 bestPose, covariance,
false);
1579 std::stringstream stream1;
1580 stream1 <<
"FINE RESPONSE: " << fineResponse <<
" (>" 1584 if (fineResponse < m_pMapper->m_pLoopMatchMinimumResponseFine->GetValue())
1609 const Pose2& rPose)
const 1612 kt_double bestSquaredDistance = DBL_MAX;
1619 if (squaredDistance < bestSquaredDistance)
1621 bestSquaredDistance = squaredDistance;
1622 pClosestScan = *iter;
1626 return pClosestScan;
1638 std::cout <<
"AddEdge: At least one vertex is invalid." << std::endl;
1672 if (isNewEdge ==
true)
1684 const std::vector<LocalizedRangeScanVector> nearChains =
FindNearChains(pScan);
1685 const_forEach(std::vector<LocalizedRangeScanVector>, &nearChains)
1698 rMeans.push_back(mean);
1699 rCovariances.push_back(covariance);
1711 assert(pClosestScan !=
NULL);
1718 LinkScans(pClosestScan, pScan, rMean, rCovariance);
1724 std::vector<LocalizedRangeScanVector> nearChains;
1737 if (pNearScan == pScan)
1743 if (find(processed.begin(), processed.end(), pNearScan) != processed.end())
1748 processed.push_back(pNearScan);
1752 std::list<LocalizedRangeScan*> chain;
1755 for (
kt_int32s candidateScanNum = pNearScan->
GetStateId() - 1; candidateScanNum >= 0; candidateScanNum--)
1761 if (pCandidateScan == pScan)
1763 isValidChain =
false;
1767 if (pCandidateScan ==
NULL)
1777 chain.push_front(pCandidateScan);
1778 processed.push_back(pCandidateScan);
1786 chain.push_back(pNearScan);
1790 for (
kt_int32u candidateScanNum = pNearScan->
GetStateId() + 1; candidateScanNum < end; candidateScanNum++)
1795 if (pCandidateScan == pScan)
1797 isValidChain =
false;
1801 if (pCandidateScan ==
NULL)
1811 chain.push_back(pCandidateScan);
1812 processed.push_back(pCandidateScan);
1824 std::copy(chain.begin(), chain.end(), std::inserter(tempChain, tempChain.begin()));
1826 nearChains.push_back(tempChain);
1839 return nearLinkedScans;
1845 std::vector<Vertex<LocalizedRangeScan>*> nearLinkedVertices =
m_pTraversal->TraverseForVertices(
GetVertex(pScan), pVisitor);
1848 return nearLinkedVertices;
1860 return nearLinkedScans;
1866 std::map<int, Vertex<LocalizedRangeScan>*>& vertices = vertexMap[name];
1868 std::vector<Vertex<LocalizedRangeScan>*> vertices_to_search;
1869 std::map<int, Vertex<LocalizedRangeScan>*>::iterator it;
1870 for (it = vertices.begin(); it != vertices.end(); ++it)
1874 vertices_to_search.push_back(it->second);
1878 const size_t dim = 2;
1881 const P2KD p2kd(vertices_to_search);
1888 std::vector<std::pair<size_t,double> > ret_matches;
1889 const double query_pt[2] = {refPose.
GetX(), refPose.
GetY()};
1891 const size_t num_results = index.radiusSearch(&query_pt[0], maxDistance, ret_matches, params);
1893 std::vector<Vertex<LocalizedRangeScan>*> rtn_vertices;
1894 rtn_vertices.reserve(ret_matches.size());
1895 for (uint i = 0; i != ret_matches.size(); i++)
1897 rtn_vertices.push_back(vertices_to_search[ret_matches[i].first]);
1899 return rtn_vertices;
1905 std::map<int, Vertex<LocalizedRangeScan>*>& vertices = vertexMap[name];
1907 std::vector<Vertex<LocalizedRangeScan>*> vertices_to_search;
1908 std::map<int, Vertex<LocalizedRangeScan>*>::iterator it;
1909 for (it = vertices.begin(); it != vertices.end(); ++it)
1913 vertices_to_search.push_back(it->second);
1917 size_t num_results = 1;
1918 const size_t dim = 2;
1921 const P2KD p2kd(vertices_to_search);
1928 std::vector<size_t> ret_index(num_results);
1929 std::vector<double> out_dist_sqr(num_results);
1930 const double query_pt[2] = {refPose.
GetX(), refPose.
GetY()};
1931 num_results = index.knnSearch(&query_pt[0], num_results, &ret_index[0], &out_dist_sqr[0]);
1933 if (num_results > 0)
1935 return vertices_to_search[ret_index[0]];
1945 assert(rMeans.size() == rCovariances.size());
1948 std::vector<Matrix3> inverses;
1949 inverses.reserve(rCovariances.size());
1955 inverses.push_back(inverse);
1957 sumOfInverses += inverse;
1962 Pose2 accumulatedPose;
1966 Pose2Vector::const_iterator meansIter = rMeans.begin();
1969 Pose2 pose = *meansIter;
1971 thetaX +=
cos(angle);
1972 thetaY +=
sin(angle);
1974 Matrix3 weight = inverseOfSumOfInverses * (*iter);
1975 accumulatedPose += weight * pose;
1980 thetaX /= rMeans.size();
1981 thetaY /= rMeans.size();
1984 return accumulatedPose;
1988 const Name& rSensorName,
2001 for (; rStartNum < nScans; rStartNum++)
2005 if (pCandidateScan ==
NULL)
2016 if (find(nearLinkedScans.begin(), nearLinkedScans.end(), pCandidateScan) != nearLinkedScans.end())
2022 chain.push_back(pCandidateScan);
2046 if (pSolver !=
NULL)
2085 m_Initialized(false),
2086 m_Deserialized(false),
2087 m_pSequentialScanMatcher(
NULL),
2088 m_pMapperSensorManager(
NULL),
2090 m_pScanOptimizer(
NULL)
2124 "When set to true, the mapper will use a scan matching algorithm. " 2125 "In most real-world situations this should be set to true so that the " 2126 "mapper algorithm can correct for noise and errors in odometry and " 2127 "scan data. In some simulator environments where the simulated scan " 2128 "and odometry data are very accurate, the scan matching algorithm can " 2129 "produce worse results. In those cases set this to false to improve " 2135 "UseScanBarycenter",
2136 "Use the barycenter of scan endpoints to define distances between " 2141 "MinimumTimeInterval",
2142 "Sets the minimum time between scans. If a new scan's time stamp is " 2143 "longer than MinimumTimeInterval from the previously processed scan, " 2144 "the mapper will use the data from the new scan. Otherwise, it will " 2145 "discard the new scan if it also does not meet the minimum travel " 2146 "distance and heading requirements. For performance reasons, it is " 2147 "generally it is a good idea to only process scans if a reasonable " 2148 "amount of time has passed. This parameter is particularly useful " 2149 "when there is a need to process scans while the robot is stationary.",
2153 "MinimumTravelDistance",
2154 "Sets the minimum travel between scans. If a new scan's position is " 2155 "more than minimumTravelDistance from the previous scan, the mapper " 2156 "will use the data from the new scan. Otherwise, it will discard the " 2157 "new scan if it also does not meet the minimum change in heading " 2158 "requirement. For performance reasons, generally it is a good idea to " 2159 "only process scans if the robot has moved a reasonable amount.",
2163 "MinimumTravelHeading",
2164 "Sets the minimum heading change between scans. If a new scan's " 2165 "heading is more than MinimumTravelHeading from the previous scan, the " 2166 "mapper will use the data from the new scan. Otherwise, it will " 2167 "discard the new scan if it also does not meet the minimum travel " 2168 "distance requirement. For performance reasons, generally it is a good " 2169 "idea to only process scans if the robot has moved a reasonable " 2175 "Scan buffer size is the length of the scan chain stored for scan " 2176 "matching. \"ScanBufferSize\" should be set to approximately " 2177 "\"ScanBufferMaximumScanDistance\" / \"MinimumTravelDistance\". The " 2178 "idea is to get an area approximately 20 meters long for scan " 2179 "matching. For example, if we add scans every MinimumTravelDistance == " 2180 "0.3 meters, then \"scanBufferSize\" should be 20 / 0.3 = 67.)",
2184 "ScanBufferMaximumScanDistance",
2185 "Scan buffer maximum scan distance is the maximum distance between the " 2186 "first and last scans in the scan chain stored for matching.",
2190 "LinkMatchMinimumResponseFine",
2191 "Scans are linked only if the correlation response value is greater " 2196 "LinkScanMaximumDistance",
2197 "Maximum distance between linked scans. Scans that are farther apart " 2198 "will not be linked regardless of the correlation response value.",
2202 "LoopSearchMaximumDistance",
2203 "Scans less than this distance from the current position will be " 2204 "considered for a match in loop closure.",
2209 "Enable/disable loop closure.",
2213 "LoopMatchMinimumChainSize",
2214 "When the loop closure detection finds a candidate it must be part of " 2215 "a large set of linked scans. If the chain of scans is less than this " 2216 "value we do not attempt to close the loop.",
2220 "LoopMatchMaximumVarianceCoarse",
2221 "The co-variance values for a possible loop closure have to be less " 2222 "than this value to consider a viable solution. This applies to the " 2227 "LoopMatchMinimumResponseCoarse",
2228 "If response is larger then this, then initiate loop closure search at " 2229 "the coarse resolution.",
2233 "LoopMatchMinimumResponseFine",
2234 "If response is larger then this, then initiate loop closure search at " 2235 "the fine resolution.",
2242 "CorrelationSearchSpaceDimension",
2243 "The size of the search grid used by the matcher. The search grid will " 2244 "have the size CorrelationSearchSpaceDimension * " 2245 "CorrelationSearchSpaceDimension",
2249 "CorrelationSearchSpaceResolution",
2250 "The resolution (size of a grid cell) of the correlation grid.",
2254 "CorrelationSearchSpaceSmearDeviation",
2255 "The point readings are smeared by this value in X and Y to create a " 2256 "smoother response.",
2264 "LoopSearchSpaceDimension",
2265 "The size of the search grid used by the matcher.",
2269 "LoopSearchSpaceResolution",
2270 "The resolution (size of a grid cell) of the correlation grid.",
2274 "LoopSearchSpaceSmearDeviation",
2275 "The point readings are smeared by this value in X and Y to create a " 2276 "smoother response.",
2283 "DistanceVariancePenalty",
2284 "Variance of penalty for deviating from odometry when scan-matching. " 2285 "The penalty is a multiplier (less than 1.0) is a function of the " 2286 "delta of the scan position being tested and the odometric pose.",
2290 "AngleVariancePenalty",
2291 "See DistanceVariancePenalty.",
2295 "FineSearchAngleOffset",
2296 "The range of angles to search during a fine search.",
2300 "CoarseSearchAngleOffset",
2301 "The range of angles to search during a coarse search.",
2305 "CoarseAngleResolution",
2306 "Resolution of angles to search during a coarse search.",
2310 "MinimumAnglePenalty",
2311 "Minimum value of the angle penalty multiplier so scores do not become " 2316 "MinimumDistancePenalty",
2317 "Minimum value of the distance penalty multiplier so scores do not " 2318 "become too small.",
2322 "UseResponseExpansion",
2323 "Whether to increase the search space if no good matches are initially " 2671 printf(
"Save To File %s \n", filename.c_str());
2672 std::ofstream ofs(filename.c_str());
2673 boost::archive::binary_oarchive oa(ofs, boost::archive::no_codecvt);
2674 oa << BOOST_SERIALIZATION_NVP(*
this);
2679 printf(
"Load From File %s \n", filename.c_str());
2680 std::ifstream ifs(filename.c_str());
2681 boost::archive::binary_iarchive ia(ifs, boost::archive::no_codecvt);
2682 ia >> BOOST_SERIALIZATION_NVP(*
this);
2724 if (pLaserRangeFinder ==
NULL || pScan ==
NULL || pLaserRangeFinder->
Validate(pScan) ==
false)
2739 if (pLastScan !=
NULL)
2741 Transform lastTransform(pLastScan->GetOdometricPose(), pLastScan->GetCorrectedPose());
2801 if (pLaserRangeFinder ==
NULL || pScan ==
NULL ||
2802 pLaserRangeFinder->
Validate(pScan) ==
false)
2819 closetVertex->GetObject()->GetStateId());
2856 std::vector<Name> deviceNames =
2867 if (addScanToLocalizationBuffer)
2888 if (pLaserRangeFinder ==
NULL || pScan ==
NULL ||
2889 pLaserRangeFinder->
Validate(pScan) ==
false)
2905 if (pLastScan !=
NULL)
2907 Transform lastTransform(pLastScan->GetOdometricPose(),
2908 pLastScan->GetCorrectedPose());
2968 lsv.
vertex = scan_vertex;
2979 oldLSV.
vertex->RemoveObject();
2997 oldLSV.
vertex->RemoveObject();
3009 for (uint i = 0; i != names.size(); i++)
3021 std::vector<Vertex<LocalizedRangeScan>*> adjVerts =
3023 for (
int i = 0; i != adjVerts.size(); i++)
3025 std::vector<Edge<LocalizedRangeScan>*> adjEdges = adjVerts[i]->GetEdges();
3027 for (
int j=0; j!=adjEdges.size(); j++)
3029 if (adjEdges[j]->GetTarget() == vertex_to_remove ||
3030 adjEdges[j]->GetSource() == vertex_to_remove)
3032 adjVerts[i]->RemoveEdge(j);
3034 adjEdges[j]->GetSource()->GetObject()->GetUniqueId(),
3035 adjEdges[j]->GetTarget()->GetObject()->GetUniqueId());
3037 std::vector<Edge<LocalizedRangeScan>*>::iterator edgeGraphIt =
3038 std::find(edges.begin(), edges.end(), adjEdges[j]);
3040 if (edgeGraphIt == edges.end())
3042 std::cout <<
"Edge not found in graph to remove!" << std::endl;
3046 int posEdge = edgeGraphIt - edges.begin();
3048 delete *edgeGraphIt;
3049 *edgeGraphIt =
NULL;
3055 std::cout <<
"Failed to find any edge in adj. vertex" <<
3056 " with a matching vertex to current!" << std::endl;
3064 std::map<Name, std::map<int, Vertex<LocalizedRangeScan>*> >
3066 std::map<int, Vertex<LocalizedRangeScan>*> graphVertices =
3067 vertexMap[vertex_to_remove->
GetObject()->GetSensorName()];
3068 std::map<int, Vertex<LocalizedRangeScan>*>::iterator
3069 vertexGraphIt = graphVertices.find(vertex_to_remove->
GetObject()->GetStateId());
3070 if (vertexGraphIt != graphVertices.end())
3073 vertexGraphIt->second->GetObject()->GetStateId());
3077 std::cout <<
"Vertex not found in graph to remove!" << std::endl;
3092 if (pLaserRangeFinder ==
NULL || pScan ==
NULL ||
3093 pLaserRangeFinder->
Validate(pScan) ==
false)
3142 std::vector<Name> deviceNames =
3174 if (pLastScan ==
NULL)
3237 std::vector<MapperListener*>::iterator iter = std::find(
m_Listeners.begin(),
m_Listeners.end(), pListener);
3248 (*iter)->Info(rInfo);
3258 if (pListener !=
NULL)
3260 pListener->
Debug(rInfo);
3271 if (pListener !=
NULL)
3284 if (pListener !=
NULL)
3297 if (pListener !=
NULL)
std::vector< LocalizedRangeScanVector > FindNearChains(LocalizedRangeScan *pScan)
virtual kt_bool Process(LocalizedRangeScan *pScan)
std::map< Name, ScanManager * > ScanManagerMap
void InitializeParameters()
void RemoveScan(LocalizedRangeScan *pScan)
LaserRangeFinder * GetLaserRangeFinder() const
virtual std::vector< Vertex< T > * > TraverseForVertices(Vertex< T > *pStartVertex, Visitor< T > *pVisitor)
ScanMatcher * m_pSequentialScanMatcher
void RemoveListener(MapperListener *pListener)
virtual kt_bool Visit(Vertex< LocalizedRangeScan > *pVertex)
double getParamMinimumAnglePenalty()
double getParamLinkScanMaximumDistance()
#define DISTANCE_PENALTY_GAIN
bool getParamDoLoopClosing()
virtual kt_bool Validate()
void setParamCorrelationSearchSpaceResolution(double d)
void FireEndLoopClosure(const std::string &rInfo) const
void setParamLoopMatchMinimumChainSize(int i)
const kt_int32s INVALID_SCAN
Parameter< kt_double > * m_pLinkScanMaximumDistance
kt_double Round(kt_double value)
void LinkNearChains(LocalizedRangeScan *pScan, Pose2Vector &rMeans, std::vector< Matrix3 > &rCovariances)
virtual void AddNode(Vertex< LocalizedRangeScan > *)
void SetUniqueId(kt_int32u uniqueId)
Parameter< kt_double > * m_pCoarseAngleResolution
Pose2 GetSensorPose() const
kt_int32s GetStateId() const
virtual ScanMatcher * GetLoopScanMatcher() const
NearScanVisitor(LocalizedRangeScan *pScan, kt_double maxDistance, kt_bool useScanBarycenter)
const Pose2 & GetOdometricPose() const
Parameter< kt_double > * m_pLoopMatchMaximumVarianceCoarse
std::vector< Vector2< kt_double > > PointVectorDouble
Parameter< kt_double > * m_pMinimumTravelHeading
virtual void EndLoopClosure(const std::string &)
void SetValue(const T &rValue)
void setParamUseScanMatching(bool b)
void AddEdge(Edge< T > *pEdge)
kt_bool ProcessAgainstNode(LocalizedRangeScan *pScan, const int &nodeId)
int getParamLoopMatchMinimumChainSize()
void ComputeAngularCovariance(const Pose2 &rBestPose, kt_double bestResponse, const Pose2 &rSearchCenter, kt_double searchAngleOffset, kt_double searchAngleResolution, Matrix3 &rCovariance)
Parameter< kt_double > * m_pMinimumAnglePenalty
std::vector< MapperListener * > m_Listeners
double getParamCoarseSearchAngleOffset()
void SetRunningScanBufferMaximumDistance(const kt_int32u &rScanBufferMaxDistance)
void FireBeginLoopClosure(const std::string &rInfo) const
kt_bool m_UseScanBarycenter
kt_int32s * GetArrayPointer()
virtual void RemoveNode(kt_int32s)
const Pose2 & GetCorrectedPose() const
kt_int32u GetNumberOfRangeReadings() const
const Vector2< kt_double > & GetPosition() const
void SetRunningScanBufferSize(const kt_int32u &rScanBufferSize)
void ClearLocalizationBuffer()
const T & Maximum(const T &value1, const T &value2)
virtual void RemoveConstraint(kt_int32s, kt_int32s)
kt_double DegreesToRadians(kt_double degrees)
double getParamCoarseAngleResolution()
std::map< Name, std::map< int, Vertex< LocalizedRangeScan > *> > VertexMap
std::vector< Name > GetSensorNames()
Vertex< LocalizedRangeScan > * vertex
double getParamMinimumDistancePenalty()
virtual void LoopClosureCheck(const std::string &)
Parameter< kt_double > * m_pLoopSearchSpaceSmearDeviation
kt_int32u GetSize() const
void setParamDoLoopClosing(bool b)
const std::vector< Edge< T > * > & GetEdges() const
virtual kt_bool Visit(Vertex< LocalizedRangeScan > *pVertex)
const PointVectorDouble & GetPointReadings(kt_bool wantFiltered=false) const
Parameter< kt_int32u > * m_pLoopMatchMinimumChainSize
void LoadFromFile(const std::string &filename)
void setParamCorrelationSearchSpaceSmearDeviation(double d)
Parameter< kt_double > * m_pCorrelationSearchSpaceResolution
void Initialize(kt_double rangeThreshold)
double getParamMinimumTimeInterval()
Parameter< kt_double > * m_pMinimumDistancePenalty
LocalizedRangeScanVector FindNearByScans(Name name, const Pose2 refPose, kt_double maxDistance)
void setParamDistanceVariancePenalty(double d)
void AddVertex(const Name &rName, Vertex< T > *pVertex)
void ComputePositionalCovariance(const Pose2 &rBestPose, kt_double bestResponse, const Pose2 &rSearchCenter, const Vector2< kt_double > &rSearchSpaceOffset, const Vector2< kt_double > &rSearchSpaceResolution, kt_double searchAngleResolution, Matrix3 &rCovariance)
virtual void AddConstraint(Edge< LocalizedRangeScan > *)
Parameter< kt_double > * m_pDistanceVariancePenalty
void SetStateId(kt_int32s stateId)
Parameter< kt_bool > * m_pUseScanMatching
Vertex< T > * GetTarget() const
Pose2 ComputeWeightedMean(const Pose2Vector &rMeans, const std::vector< Matrix3 > &rCovariances) const
LocalizedRangeScanVector & GetRunningScans(const Name &rSensorName)
#define forEach(listtype, list)
void setParamScanBufferSize(int i)
virtual ~BreadthFirstTraversal()
void AddScan(LocalizedRangeScan *pScan)
void setParamCorrelationSearchSpaceDimension(double d)
void SetSensorPose(const Pose2 &rScanPose)
LocalizedRangeScan * GetLastScan()
Pose2 GetSensorAt(const Pose2 &rPose) const
void setParamMinimumTimeInterval(double d)
kt_double GetResponse(kt_int32u angleIndex, kt_int32s gridPositionIndex) const
void SetLastScan(LocalizedRangeScan *pScan)
kt_double m_MaxDistanceSquared
LocalizedRangeScanVector m_RunningScans
kt_int32s GetUniqueId() const
#define ANGLE_PENALTY_GAIN
void LinkChainToScan(const LocalizedRangeScanVector &rChain, LocalizedRangeScan *pScan, const Pose2 &rMean, const Matrix3 &rCovariance)
double getParamLoopMatchMinimumResponseCoarse()
void LinkScans(LocalizedRangeScan *pFromScan, LocalizedRangeScan *pToScan, const Pose2 &rMean, const Matrix3 &rCovariance)
MapperSensorManager * m_pMapperSensorManager
void SetRunningScanBufferMaximumDistance(kt_double rScanBufferMaxDistance)
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
GraphTraversal< LocalizedRangeScan > * m_pTraversal
double getParamLoopMatchMinimumResponseFine()
kt_bool ProcessAgainstNodesNearBy(LocalizedRangeScan *pScan, kt_bool addScanToLocalizationBuffer=false)
Parameter< kt_bool > * m_pDoLoopClosing
virtual kt_bool Visit(Vertex< T > *pVertex)=0
BreadthFirstTraversal(Graph< T > *pGraph)
virtual ScanMatcher * GetSequentialScanMatcher() const
void setParamAngleVariancePenalty(double d)
Parameter< kt_double > * m_pFineSearchAngleOffset
std::vector< Vertex< LocalizedRangeScan > * > FindNearByVertices(Name name, const Pose2 refPose, kt_double maxDistance)
kt_int32u m_RunningBufferMaximumSize
LocalizedRangeScan * GetClosestScanToPose(const LocalizedRangeScanVector &rScans, const Pose2 &rPose) const
kt_double SquaredLength() const
kt_double RadiansToDegrees(kt_double radians)
Parameter< kt_double > * m_pScanBufferMaximumScanDistance
ScanSolver * m_pScanOptimizer
LocalizedRangeScan * scan
void setParamLoopMatchMaximumVarianceCoarse(double d)
virtual void Debug(const std::string &)
kt_int32u & GetRunningScanBufferSize()
void AddListener(MapperListener *pListener)
void AddScanToLocalizationBuffer(LocalizedRangeScan *pScan, Vertex< LocalizedRangeScan > *scan_vertex)
Parameter< kt_double > * m_pLoopSearchSpaceDimension
void setParamLinkScanMaximumDistance(double d)
kt_double SquaredDistance(const Vector2 &rOther) const
void SetLastScan(LocalizedRangeScan *pScan)
friend class boost::serialization::access
void setParamMinimumAnglePenalty(double d)
kt_double GetRangeThreshold() const
virtual MapperGraph * GetGraph() const
virtual ParameterManager * GetParameterManager()
const Name & GetSensorName() const
virtual const IdPoseVector & GetCorrections() const =0
void ClearRunningScans(const Name &rSensorName)
double getParamCorrelationSearchSpaceSmearDeviation()
ScanManager(kt_int32u runningBufferMaximumSize, kt_double runningBufferMaximumDistance)
Parameter< kt_double > * m_pMinimumTravelDistance
kt_bool ProcessLocalization(LocalizedRangeScan *pScan)
void AddRunningScan(LocalizedRangeScan *pScan)
void AddRunningScan(LocalizedRangeScan *pScan)
virtual std::vector< T * > TraverseForScans(Vertex< T > *pStartVertex, Visitor< T > *pVisitor)
RangeReadingsVector GetRangeReadingsVector() const
double getParamMinimumTravelHeading()
void setParamLoopSearchSpaceDimension(double d)
void setParamLoopSearchSpaceResolution(double d)
TFSIMD_FORCE_INLINE Quaternion inverse(const Quaternion &q)
static Grid * CreateGrid(kt_int32s width, kt_int32s height, kt_double resolution)
void setParamScanBufferMaximumScanDistance(double d)
void setParamMinimumDistancePenalty(double d)
void serialize(Archive &ar, const unsigned int version)
LocalizedRangeScanVector & GetRunningScans()
double getParamMinimumTravelDistance()
kt_bool m_UseScanBarycenter
std::vector< Pose2 > Pose2Vector
void serialize(Archive &ar, const unsigned int version)
double getParamLoopSearchSpaceSmearDeviation()
ScanMatcher * GetLoopScanMatcher() const
ScanSolver * getScanSolver()
double getParamFineSearchAngleOffset()
void setParamLoopSearchMaximumDistance(double d)
const T & GetValue() const
void SetRunningScanBufferSize(kt_int32u rScanBufferSize)
kt_bool ProcessAtDock(LocalizedRangeScan *pScan)
void setParamLoopMatchMinimumResponseCoarse(double d)
kt_bool HasMovedEnough(LocalizedRangeScan *pScan, LocalizedRangeScan *pLastScan) const
void serialize(Archive &ar, const unsigned int version)
void RemoveVertex(const Name &rName, const int &idx)
PointVectorDouble FindValidPoints(LocalizedRangeScan *pScan, const Vector2< kt_double > &rViewPoint) const
bool getParamUseScanBarycenter()
void FireDebug(const std::string &rInfo) const
kt_bool InRange(const T &value, const T &a, const T &b)
void AddScan(LocalizedRangeScan *pScan, kt_int32s uniqueId)
void setParamMinimumTravelDistance(double d)
const kt_double KT_TOLERANCE
kt_double NormalizeAngle(kt_double angle)
LocalizedRangeScan * GetScan(const Name &rSensorName, kt_int32s scanIndex)
bool getParamUseScanMatching()
#define const_forEach(listtype, list)
LocalizationScanVertices m_LocalizationScanVertices
double getParamScanBufferMaximumScanDistance()
void SetScanSolver(ScanSolver *pSolver)
virtual void BeginLoopClosure(const std::string &)
LocalizedRangeScanVector FindPossibleLoopClosure(LocalizedRangeScan *pScan, const Name &rSensorName, kt_int32u &rStartNum)
int getParamScanBufferSize()
bool getParamUseResponseExpansion()
double getParamCorrelationSearchSpaceDimension()
void SaveToFile(const std::string &filename)
std::vector< Vertex< T > * > GetAdjacentVertices() const
GridIndexLookup< kt_int8u > * m_pGridLookup
LocalizedRangeScanMap & GetScans(const Name &rSensorName)
Pose2 GetReferencePose(kt_bool useBarycenter) const
void SetOdometricPose(const Pose2 &rPose)
static CorrelationGrid * CreateGrid(kt_int32s width, kt_int32s height, kt_double resolution, kt_double smearDeviation)
kt_double GetTime() const
void AddScans(const LocalizedRangeScanVector &rScans, Vector2< kt_double > viewPoint)
void serialize(Archive &ar, const unsigned int version)
kt_double NormalizeAngleDifference(kt_double minuend, kt_double subtrahend)
void AddScan(LocalizedRangeScan *pScan, const Vector2< kt_double > &rViewPoint, kt_bool doSmear=true)
void setParamLinkMatchMinimumResponseFine(double d)
CorrelationGrid * m_pCorrelationGrid
kt_double CorrelateScan(LocalizedRangeScan *pScan, const Pose2 &rSearchCenter, const Vector2< kt_double > &rSearchSpaceOffset, const Vector2< kt_double > &rSearchSpaceResolution, kt_double searchAngleOffset, kt_double searchAngleResolution, kt_bool doPenalize, Pose2 &rMean, Matrix3 &rCovariance, kt_bool doingFineMatch)
Pose2 GetCorrectedAt(const Pose2 &sPose) const
Computes the pose of the robot if the sensor were at the given pose.
Parameter< kt_double > * m_pLoopSearchSpaceResolution
void RemoveEdge(const int &idx)
void UpdateLoopScanMatcher(kt_double rangeThreshold)
Parameter< kt_double > * m_pCorrelationSearchSpaceDimension
kt_int32u GetRunningScanBufferSize(const Name &rSensorName)
void SetCorrectedPoseAndUpdate(const Pose2 &rPose)
void setParamCoarseSearchAngleOffset(double d)
double getParamDistanceVariancePenalty()
double getParamCorrelationSearchSpaceResolution()
kt_double MatchScan(LocalizedRangeScan *pScan, const T &rBaseScans, Pose2 &rMean, Matrix3 &rCovariance, kt_bool doPenalize=true, kt_bool doRefineMatch=true)
void RegisterSensor(const Name &rSensorName)
std::vector< std::pair< kt_int32s, Pose2 > > IdPoseVector
void SetCorrectedPose(const Pose2 &rPose)
LocalizedRangeScanVector GetAllScans()
void setParamFineSearchAngleOffset(double d)
void RemoveScan(LocalizedRangeScan *pScan)
Parameter< kt_double > * m_pLinkMatchMinimumResponseFine
Vertex< LocalizedRangeScan > * GetVertex(LocalizedRangeScan *pScan)
void FireInfo(const std::string &rInfo) const
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
void ClearLastScan(LocalizedRangeScan *pScan)
BOOST_CLASS_EXPORT(karto::MapperGraph)
double getParamAngleVariancePenalty()
static ScanMatcher * Create(Mapper *pMapper, kt_double searchSize, kt_double resolution, kt_double smearDeviation, kt_double rangeThreshold)
ScanMatcher * m_pLoopScanMatcher
void SetLabel(EdgeLabel *pLabel)
Grid< kt_double > * m_pSearchSpaceProbs
kt_bool DoubleEqual(kt_double a, kt_double b)
Edge< LocalizedRangeScan > * AddEdge(LocalizedRangeScan *pSourceScan, LocalizedRangeScan *pTargetScan, kt_bool &rIsNewEdge)
void SetHeading(kt_double heading)
LocalizedRangeScanVector FindNearLinkedScans(LocalizedRangeScan *pScan, kt_double maxDistance)
double getParamLoopSearchSpaceResolution()
Parameter< kt_double > * m_pCorrelationSearchSpaceSmearDeviation
void setParamMinimumTravelHeading(double d)
void AddEdges(LocalizedRangeScan *pScan, const Matrix3 &rCovariance)
double getParamLoopSearchMaximumDistance()
void setParamUseResponseExpansion(bool b)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Vertex< LocalizedRangeScan > * AddVertex(LocalizedRangeScan *pScan)
Parameter< kt_double > * m_pLoopMatchMinimumResponseCoarse
void FireLoopClosureCheck(const std::string &rInfo) const
double getParamLoopMatchMaximumVarianceCoarse()
kt_bool TryCloseLoop(LocalizedRangeScan *pScan, const Name &rSensorName)
LocalizedRangeScan * m_pLastScan
double getParamLinkMatchMinimumResponseFine()
void operator()(const kt_double &y) const
kt_double m_RunningBufferMaximumDistance
const VertexMap & GetVertices() const
Parameter< kt_double > * m_pCoarseSearchAngleOffset
void setParamLoopMatchMinimumResponseFine(double d)
std::vector< Vertex< LocalizedRangeScan > * > FindNearLinkedVertices(LocalizedRangeScan *pScan, kt_double maxDistance)
Parameter< kt_double > * m_pLoopSearchMaximumDistance
NearPoseVisitor(Pose2 refPose, kt_double maxDistance, kt_bool useScanBarycenter)
void setParamUseScanBarycenter(bool b)
Parameter< kt_double > * m_pAngleVariancePenalty
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
double getParamLoopSearchSpaceDimension()
LocalizedRangeScanMap m_Scans
LocalizedRangeScanMap & GetScans()
Parameter< kt_double > * m_pMinimumTimeInterval
Parameter< kt_bool > * m_pUseResponseExpansion
Parameter< kt_int32u > * m_pScanBufferSize
virtual const LocalizedRangeScanVector GetAllProcessedScans() const
kt_bool IsUpTo(const T &value, const T &maximum)
const std::string response
LocalizedRangeScan * GetLastScan(const Name &rSensorName)
void setParamLoopSearchSpaceSmearDeviation(double d)
std::vector< LocalizedRangeScan * > LocalizedRangeScanVector
Parameter< kt_bool > * m_pUseScanBarycenter
std::map< int, LocalizedRangeScan * > LocalizedRangeScanMap
Parameter< kt_double > * m_pLoopMatchMinimumResponseFine
void setParamCoarseAngleResolution(double d)
Vertex< LocalizedRangeScan > * FindNearByScan(Name name, const Pose2 refPose)
kt_double GetHeading() const
kt_bool RemoveNodeFromGraph(Vertex< LocalizedRangeScan > *)
kt_double m_MaxDistanceSquared