Mapper.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010 SRI International
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <sstream>
19 #include <fstream>
20 #include <stdexcept>
21 #include <queue>
22 #include <set>
23 #include <list>
24 #include <iterator>
25 #include <karto_sdk/Types.h>
26 #include <math.h>
27 #include <assert.h>
28 #include <boost/serialization/vector.hpp>
29 
30 #include "karto_sdk/Mapper.h"
31 
40 namespace karto
41 {
42 
43  // enable this for verbose debug information
44  // #define KARTO_DEBUG
45 
46  #define MAX_VARIANCE 500.0
47  #define DISTANCE_PENALTY_GAIN 0.2
48  #define ANGLE_PENALTY_GAIN 0.2
49 
53 
58  {
59  public:
63  ScanManager(kt_int32u runningBufferMaximumSize, kt_double runningBufferMaximumDistance)
64  : m_pLastScan(NULL)
65  , m_RunningBufferMaximumSize(runningBufferMaximumSize)
66  , m_RunningBufferMaximumDistance(runningBufferMaximumDistance)
67  , m_NextStateId(0)
68  {
69  }
70 
72 
76  virtual ~ScanManager()
77  {
78  Clear();
79  }
80 
81  public:
86  inline void AddScan(LocalizedRangeScan* pScan, kt_int32s uniqueId)
87  {
88  // assign state id to scan
89  pScan->SetStateId(m_NextStateId);
90 
91  // assign unique id to scan
92  pScan->SetUniqueId(uniqueId);
93 
94  // add it to scan buffer
95  m_Scans.insert({pScan->GetStateId(), pScan});
96  m_NextStateId++;
97  }
98 
105  {
106  return m_pLastScan;
107  }
108 
113  inline void ClearLastScan()
114  {
115  m_pLastScan = NULL;
116  }
117 
123  {
124  m_pLastScan = pScan;
125  }
126 
132  {
133  return m_Scans;
134  }
135 
141  {
142  return m_RunningScans;
143  }
144 
150  {
152  }
153 
158  void SetRunningScanBufferSize(const kt_int32u & rScanBufferSize)
159  {
160  m_RunningBufferMaximumSize = rScanBufferSize;
161  }
162 
167  void SetRunningScanBufferMaximumDistance(const kt_int32u & rScanBufferMaxDistance)
168  {
169  m_RunningBufferMaximumDistance = rScanBufferMaxDistance;
170  }
171 
177  {
178  m_RunningScans.push_back(pScan);
179 
180  // vector has at least one element (first line of this function), so this is valid
181  Pose2 frontScanPose = m_RunningScans.front()->GetSensorPose();
182  Pose2 backScanPose = m_RunningScans.back()->GetSensorPose();
183 
184  // cap vector size and remove all scans from front of vector that are too far from end of vector
185  kt_double squaredDistance = frontScanPose.GetPosition().SquaredDistance(backScanPose.GetPosition());
186  while (m_RunningScans.size() > m_RunningBufferMaximumSize ||
188  {
189  // remove front of running scans
190  m_RunningScans.erase(m_RunningScans.begin());
191 
192  // recompute stats of running scans
193  frontScanPose = m_RunningScans.front()->GetSensorPose();
194  backScanPose = m_RunningScans.back()->GetSensorPose();
195  squaredDistance = frontScanPose.GetPosition().SquaredDistance(backScanPose.GetPosition());
196  }
197  }
198 
204  {
205  LocalizedRangeScanMap::iterator it = m_Scans.find(pScan->GetStateId());
206  if (it != m_Scans.end())
207  {
208  it->second = NULL;
209  m_Scans.erase(it);
210  }
211  else
212  {
213  std::cout << "Remove Scan: Failed to find scan in m_Scans" << std::endl;
214  }
215  }
216 
221  {
222  m_RunningScans.clear();
223  }
224 
228  void Clear()
229  {
230  m_Scans.clear();
231  m_RunningScans.clear();
232  }
233 
234  private:
236  template<class Archive>
237  void serialize(Archive &ar, const unsigned int version)
238  {
239  ar & BOOST_SERIALIZATION_NVP(m_Scans);
240  ar & BOOST_SERIALIZATION_NVP(m_RunningScans);
241  ar & BOOST_SERIALIZATION_NVP(m_pLastScan);
242  ar & BOOST_SERIALIZATION_NVP(m_RunningBufferMaximumSize);
243  ar & BOOST_SERIALIZATION_NVP(m_RunningBufferMaximumDistance);
244  ar & BOOST_SERIALIZATION_NVP(m_NextStateId);
245  }
246 
247  private:
252 
255  }; // ScanManager
256 
260 
261  void MapperSensorManager::RegisterSensor(const Name& rSensorName)
262  {
263  if (GetScanManager(rSensorName) == NULL)
264  {
266  }
267  }
268 
269 
277  {
278  ScanManager* pScanManager = GetScanManager(rSensorName);
279  if (pScanManager != NULL)
280  {
281  LocalizedRangeScanMap::iterator it = pScanManager->GetScans().find(scanIndex);
282  if (it != pScanManager->GetScans().end())
283  {
284  return it->second;
285  }
286  else
287  {
288  return nullptr;
289  }
290  }
291 
292  assert(false);
293  return NULL;
294  }
295 
302  {
303  RegisterSensor(rSensorName);
304 
305  return GetScanManager(rSensorName)->GetLastScan();
306  }
307 
313  {
314  GetScanManager(pScan)->SetLastScan(pScan);
315  }
316 
322  {
323  GetScanManager(pScan)->ClearLastScan();
324  }
325 
331  {
332  GetScanManager(name)->ClearLastScan();
333  }
334 
340  {
341  GetScanManager(pScan)->AddScan(pScan, m_NextScanId);
342  m_Scans.insert({m_NextScanId, pScan});
343  m_NextScanId++;
344  }
345 
351  {
352  GetScanManager(pScan)->AddRunningScan(pScan);
353  }
354 
360  {
361  GetScanManager(pScan)->RemoveScan(pScan);
362 
363  LocalizedRangeScanMap::iterator it = m_Scans.find(pScan->GetUniqueId());
364  if (it != m_Scans.end())
365  {
366  it->second = NULL;
367  m_Scans.erase(it);
368  }
369  else
370  {
371  std::cout << "RemoveScan: Failed to find scan in m_Scans" << std::endl;
372  }
373  }
374 
381  {
382  return GetScanManager(rSensorName)->GetScans();
383  }
384 
391  {
392  return GetScanManager(rSensorName)->GetRunningScans();
393  }
394 
396  {
397  GetScanManager(rSensorName)->ClearRunningScans();
398  return;
399  }
400 
402  {
403  return GetScanManager(rSensorName)->GetRunningScanBufferSize();
404  }
405 
407  {
408  m_RunningBufferMaximumSize = rScanBufferSize;
409 
410  std::vector<Name> names = GetSensorNames();
411  for (uint i = 0; i != names.size(); i++) {
412  GetScanManager(names[i])->SetRunningScanBufferSize(rScanBufferSize);
413  }
414  }
415 
417  {
418  m_RunningBufferMaximumDistance = rScanBufferMaxDistance;
419 
420  std::vector<Name> names = GetSensorNames();
421  for (uint i = 0; i != names.size(); i++) {
422  GetScanManager(names[i])->SetRunningScanBufferMaximumDistance(rScanBufferMaxDistance);
423  }
424  }
425 
431  {
433 
435  {
436  LocalizedRangeScanMap& rScans = iter->second->GetScans();
437 
438  LocalizedRangeScanMap::iterator it;
439  for (it = rScans.begin(); it != rScans.end(); ++it)
440  {
441  scans.push_back(it->second);
442  }
443  }
444 
445  return scans;
446  }
447 
452  {
453 // SensorManager::Clear();
454 
456  {
457  delete iter->second;
458  iter->second = nullptr;
459  }
460 
461  m_ScanManagers.clear();
462  }
463 
467 
469  {
470  if (m_pCorrelationGrid)
471  {
472  delete m_pCorrelationGrid;
473  }
475  {
476  delete m_pSearchSpaceProbs;
477  }
478  if (m_pGridLookup)
479  {
480  delete m_pGridLookup;
481  }
482 
483  }
484 
485  ScanMatcher* ScanMatcher::Create(Mapper* pMapper, kt_double searchSize, kt_double resolution,
486  kt_double smearDeviation, kt_double rangeThreshold)
487  {
488  // invalid parameters
489  if (resolution <= 0)
490  {
491  return NULL;
492  }
493  if (searchSize <= 0)
494  {
495  return NULL;
496  }
497  if (smearDeviation < 0)
498  {
499  return NULL;
500  }
501  if (rangeThreshold <= 0)
502  {
503  return NULL;
504  }
505 
506  assert(math::DoubleEqual(math::Round(searchSize / resolution), (searchSize / resolution)));
507 
508  // calculate search space in grid coordinates
509  kt_int32u searchSpaceSideSize = static_cast<kt_int32u>(math::Round(searchSize / resolution) + 1);
510 
511  // compute requisite size of correlation grid (pad grid so that scan points can't fall off the grid
512  // if a scan is on the border of the search space)
513  kt_int32u pointReadingMargin = static_cast<kt_int32u>(ceil(rangeThreshold / resolution));
514 
515  kt_int32s gridSize = searchSpaceSideSize + 2 * pointReadingMargin;
516 
517  // create correlation grid
518  assert(gridSize % 2 == 1);
519  CorrelationGrid* pCorrelationGrid = CorrelationGrid::CreateGrid(gridSize, gridSize, resolution, smearDeviation);
520 
521  // create search space probabilities
522  Grid<kt_double>* pSearchSpaceProbs = Grid<kt_double>::CreateGrid(searchSpaceSideSize,
523  searchSpaceSideSize, resolution);
524 
525  ScanMatcher* pScanMatcher = new ScanMatcher(pMapper);
526  pScanMatcher->m_pCorrelationGrid = pCorrelationGrid;
527  pScanMatcher->m_pSearchSpaceProbs = pSearchSpaceProbs;
528  pScanMatcher->m_pGridLookup = new GridIndexLookup<kt_int8u>(pCorrelationGrid);
529 
530  return pScanMatcher;
531  }
532 
543  template<class T>
544  kt_double ScanMatcher::MatchScan(LocalizedRangeScan* pScan, const T& rBaseScans, Pose2& rMean,
545  Matrix3& rCovariance, kt_bool doPenalize, kt_bool doRefineMatch)
546  {
548  // set scan pose to be center of grid
549 
550  // 1. get scan position
551  Pose2 scanPose = pScan->GetSensorPose();
552 
553  // scan has no readings; cannot do scan matching
554  // best guess of pose is based off of adjusted odometer reading
555  if (pScan->GetNumberOfRangeReadings() == 0)
556  {
557  rMean = scanPose;
558 
559  // maximum covariance
560  rCovariance(0, 0) = MAX_VARIANCE; // XX
561  rCovariance(1, 1) = MAX_VARIANCE; // YY
562  rCovariance(2, 2) = 4 * math::Square(m_pMapper->m_pCoarseAngleResolution->GetValue()); // TH*TH
563 
564  return 0.0;
565  }
566 
567  // 2. get size of grid
569 
570  // 3. compute offset (in meters - lower left corner)
571  Vector2<kt_double> offset;
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()));
574 
575  // 4. set offset
577 
579 
580  // set up correlation grid
581  AddScans(rBaseScans, scanPose.GetPosition());
582 
583  // compute how far to search in each direction
585  Vector2<kt_double> coarseSearchOffset(0.5 * (searchDimensions.GetX() - 1) * m_pCorrelationGrid->GetResolution(),
586  0.5 * (searchDimensions.GetY() - 1) * m_pCorrelationGrid->GetResolution());
587 
588  // a coarse search only checks half the cells in each dimension
589  Vector2<kt_double> coarseSearchResolution(2 * m_pCorrelationGrid->GetResolution(),
591 
592  // actual scan-matching
593  kt_double bestResponse = CorrelateScan(pScan, scanPose, coarseSearchOffset, coarseSearchResolution,
596  doPenalize, rMean, rCovariance, false);
597 
599  {
600  if (math::DoubleEqual(bestResponse, 0.0))
601  {
602 #ifdef KARTO_DEBUG
603  std::cout << "Mapper Info: Expanding response search space!" << std::endl;
604 #endif
605  // try and increase search angle offset with 20 degrees and do another match
606  kt_double newSearchAngleOffset = m_pMapper->m_pCoarseSearchAngleOffset->GetValue();
607  for (kt_int32u i = 0; i < 3; i++)
608  {
609  newSearchAngleOffset += math::DegreesToRadians(20);
610 
611  bestResponse = CorrelateScan(pScan, scanPose, coarseSearchOffset, coarseSearchResolution,
612  newSearchAngleOffset, m_pMapper->m_pCoarseAngleResolution->GetValue(),
613  doPenalize, rMean, rCovariance, false);
614 
615  if (math::DoubleEqual(bestResponse, 0.0) == false)
616  {
617  break;
618  }
619  }
620 
621 #ifdef KARTO_DEBUG
622  if (math::DoubleEqual(bestResponse, 0.0))
623  {
624  std::cout << "Mapper Warning: Unable to calculate response!" << std::endl;
625  }
626 #endif
627  }
628  }
629 
630  if (doRefineMatch)
631  {
632  Vector2<kt_double> fineSearchOffset(coarseSearchResolution * 0.5);
634  bestResponse = CorrelateScan(pScan, rMean, fineSearchOffset, fineSearchResolution,
637  doPenalize, rMean, rCovariance, true);
638  }
639 
640 #ifdef KARTO_DEBUG
641  std::cout << " BEST POSE = " << rMean << " BEST RESPONSE = " << bestResponse << ", VARIANCE = "
642  << rCovariance(0, 0) << ", " << rCovariance(1, 1) << std::endl;
643 #endif
644  assert(math::InRange(rMean.GetHeading(), -KT_PI, KT_PI));
645 
646  return bestResponse;
647  }
648 
649  void ScanMatcher::operator() (const kt_double& y) const
650  {
651  kt_int32u poseResponseCounter;
652  kt_int32u x_pose;
653  kt_int32u y_pose = std::find(m_yPoses.begin(), m_yPoses.end(), y) - m_yPoses.begin();
654 
655  const kt_int32u size_x = m_xPoses.size();
656 
657  kt_double newPositionY = m_rSearchCenter.GetY() + y;
658  kt_double squareY = math::Square(y);
659 
660  for ( std::vector<kt_double>::const_iterator xIter = m_xPoses.begin(); xIter != m_xPoses.end(); ++xIter )
661  {
662  x_pose = std::distance(m_xPoses.begin(), xIter);
663  kt_double x = *xIter;
664  kt_double newPositionX = m_rSearchCenter.GetX() + x;
665  kt_double squareX = math::Square(x);
666 
667  Vector2<kt_int32s> gridPoint = m_pCorrelationGrid->WorldToGrid(Vector2<kt_double>(newPositionX, newPositionY));
668  kt_int32s gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
669  assert(gridIndex >= 0);
670 
671  kt_double angle = 0.0;
673  for (kt_int32u angleIndex = 0; angleIndex < m_nAngles; angleIndex++)
674  {
675  angle = startAngle + angleIndex * m_searchAngleResolution;
676 
677  kt_double response = GetResponse(angleIndex, gridIndex);
678  if (m_doPenalize && (math::DoubleEqual(response, 0.0) == false))
679  {
680  // simple model (approximate Gaussian) to take odometry into account
681  kt_double squaredDistance = squareX + squareY;
682  kt_double distancePenalty = 1.0 - (DISTANCE_PENALTY_GAIN *
683  squaredDistance / m_pMapper->m_pDistanceVariancePenalty->GetValue());
684  distancePenalty = math::Maximum(distancePenalty, m_pMapper->m_pMinimumDistancePenalty->GetValue());
685 
686  kt_double squaredAngleDistance = math::Square(angle - m_rSearchCenter.GetHeading());
687  kt_double anglePenalty = 1.0 - (ANGLE_PENALTY_GAIN *
688  squaredAngleDistance / m_pMapper->m_pAngleVariancePenalty->GetValue());
689  anglePenalty = math::Maximum(anglePenalty, m_pMapper->m_pMinimumAnglePenalty->GetValue());
690 
691  response *= (distancePenalty * anglePenalty);
692  }
693 
694  // store response and pose
695  poseResponseCounter = (y_pose*size_x + x_pose)*(m_nAngles) + angleIndex;
696  m_pPoseResponse[poseResponseCounter] = std::pair<kt_double, Pose2>(response, Pose2(newPositionX, newPositionY,
698  }
699  }
700  return;
701  }
702 
720  const Vector2<kt_double>& rSearchSpaceOffset,
721  const Vector2<kt_double>& rSearchSpaceResolution,
722  kt_double searchAngleOffset, kt_double searchAngleResolution,
723  kt_bool doPenalize, Pose2& rMean, Matrix3& rCovariance, kt_bool doingFineMatch)
724  {
725  assert(searchAngleResolution != 0.0);
726 
727  // setup lookup arrays
728  m_pGridLookup->ComputeOffsets(pScan, rSearchCenter.GetHeading(), searchAngleOffset, searchAngleResolution);
729 
730  // only initialize probability grid if computing positional covariance (during coarse match)
731  if (!doingFineMatch)
732  {
734 
735  // position search grid - finds lower left corner of search grid
736  Vector2<kt_double> offset(rSearchCenter.GetPosition() - rSearchSpaceOffset);
738  }
739 
740  // calculate position arrays
741 
742  m_xPoses.clear();
743  kt_int32u nX = static_cast<kt_int32u>(math::Round(rSearchSpaceOffset.GetX() *
744  2.0 / rSearchSpaceResolution.GetX()) + 1);
745  kt_double startX = -rSearchSpaceOffset.GetX();
746  for (kt_int32u xIndex = 0; xIndex < nX; xIndex++)
747  {
748  m_xPoses.push_back(startX + xIndex * rSearchSpaceResolution.GetX());
749  }
750  assert(math::DoubleEqual(m_xPoses.back(), -startX));
751 
752  m_yPoses.clear();
753  kt_int32u nY = static_cast<kt_int32u>(math::Round(rSearchSpaceOffset.GetY() *
754  2.0 / rSearchSpaceResolution.GetY()) + 1);
755  kt_double startY = -rSearchSpaceOffset.GetY();
756  for (kt_int32u yIndex = 0; yIndex < nY; yIndex++)
757  {
758  m_yPoses.push_back(startY + yIndex * rSearchSpaceResolution.GetY());
759  }
760  assert(math::DoubleEqual(m_yPoses.back(), -startY));
761 
762  // calculate pose response array size
763  kt_int32u nAngles = static_cast<kt_int32u>(math::Round(searchAngleOffset * 2.0 / searchAngleResolution) + 1);
764 
765  kt_int32u poseResponseSize = static_cast<kt_int32u>(m_xPoses.size() * m_yPoses.size() * nAngles);
766 
767  // allocate array
768  m_pPoseResponse = new std::pair<kt_double, Pose2>[poseResponseSize];
769 
771  + startX, rSearchCenter.GetY() + startY));
772 
773  // this isn't good but its the fastest way to iterate. Should clean up later.
774  m_rSearchCenter = rSearchCenter;
775  m_searchAngleOffset = searchAngleOffset;
776  m_nAngles = nAngles;
777  m_searchAngleResolution = searchAngleResolution;
778  m_doPenalize = doPenalize;
779  tbb::parallel_do(m_yPoses, (*this) );
780 
781  // find value of best response (in [0; 1])
782  kt_double bestResponse = -1;
783  for (kt_int32u i = 0; i < poseResponseSize; i++)
784  {
785  bestResponse = math::Maximum(bestResponse, m_pPoseResponse[i].first);
786 
787  // will compute positional covariance, save best relative probability for each cell
788  if (!doingFineMatch)
789  {
790  const Pose2& rPose = m_pPoseResponse[i].second;
792  kt_double* ptr;
793 
794  try
795  {
797  }
798  catch(...)
799  {
800  throw std::runtime_error("Mapper FATAL ERROR - unable to get pointer in probability search!");
801  }
802 
803  if (ptr == NULL)
804  {
805  throw std::runtime_error("Mapper FATAL ERROR - Index out of range in probability search!");
806  }
807 
808  *ptr = math::Maximum(m_pPoseResponse[i].first, *ptr);
809  }
810  }
811 
812  // average all poses with same highest response
813  Vector2<kt_double> averagePosition;
814  kt_double thetaX = 0.0;
815  kt_double thetaY = 0.0;
816  kt_int32s averagePoseCount = 0;
817  for (kt_int32u i = 0; i < poseResponseSize; i++)
818  {
819  if (math::DoubleEqual(m_pPoseResponse[i].first, bestResponse))
820  {
821  averagePosition += m_pPoseResponse[i].second.GetPosition();
822 
823  kt_double heading = m_pPoseResponse[i].second.GetHeading();
824  thetaX += cos(heading);
825  thetaY += sin(heading);
826 
827  averagePoseCount++;
828  }
829  }
830 
831  Pose2 averagePose;
832  if (averagePoseCount > 0)
833  {
834  averagePosition /= averagePoseCount;
835 
836  thetaX /= averagePoseCount;
837  thetaY /= averagePoseCount;
838 
839  averagePose = Pose2(averagePosition, atan2(thetaY, thetaX));
840  }
841  else
842  {
843  throw std::runtime_error("Mapper FATAL ERROR - Unable to find best position");
844  }
845 
846  // delete pose response array
847  delete [] m_pPoseResponse;
848  m_pPoseResponse = nullptr;
849 
850 #ifdef KARTO_DEBUG
851  std::cout << "bestPose: " << averagePose << std::endl;
852  std::cout << "bestResponse: " << bestResponse << std::endl;
853 #endif
854 
855  if (!doingFineMatch)
856  {
857  ComputePositionalCovariance(averagePose, bestResponse, rSearchCenter, rSearchSpaceOffset,
858  rSearchSpaceResolution, searchAngleResolution, rCovariance);
859  }
860  else
861  {
862  ComputeAngularCovariance(averagePose, bestResponse, rSearchCenter,
863  searchAngleOffset, searchAngleResolution, rCovariance);
864  }
865 
866  rMean = averagePose;
867 
868 #ifdef KARTO_DEBUG
869  std::cout << "bestPose: " << averagePose << std::endl;
870 #endif
871 
872  if (bestResponse > 1.0)
873  {
874  bestResponse = 1.0;
875  }
876 
877  assert(math::InRange(bestResponse, 0.0, 1.0));
878  assert(math::InRange(rMean.GetHeading(), -KT_PI, KT_PI));
879 
880  return bestResponse;
881  }
882 
893  void ScanMatcher::ComputePositionalCovariance(const Pose2& rBestPose, kt_double bestResponse,
894  const Pose2& rSearchCenter,
895  const Vector2<kt_double>& rSearchSpaceOffset,
896  const Vector2<kt_double>& rSearchSpaceResolution,
897  kt_double searchAngleResolution, Matrix3& rCovariance)
898  {
899  // reset covariance to identity matrix
900  rCovariance.SetToIdentity();
901 
902  // if best response is vary small return max variance
903  if (bestResponse < KT_TOLERANCE)
904  {
905  rCovariance(0, 0) = MAX_VARIANCE; // XX
906  rCovariance(1, 1) = MAX_VARIANCE; // YY
907  rCovariance(2, 2) = 4 * math::Square(searchAngleResolution); // TH*TH
908 
909  return;
910  }
911 
912  kt_double accumulatedVarianceXX = 0;
913  kt_double accumulatedVarianceXY = 0;
914  kt_double accumulatedVarianceYY = 0;
915  kt_double norm = 0;
916 
917  kt_double dx = rBestPose.GetX() - rSearchCenter.GetX();
918  kt_double dy = rBestPose.GetY() - rSearchCenter.GetY();
919 
920  kt_double offsetX = rSearchSpaceOffset.GetX();
921  kt_double offsetY = rSearchSpaceOffset.GetY();
922 
923  kt_int32u nX = static_cast<kt_int32u>(math::Round(offsetX * 2.0 / rSearchSpaceResolution.GetX()) + 1);
924  kt_double startX = -offsetX;
925  assert(math::DoubleEqual(startX + (nX - 1) * rSearchSpaceResolution.GetX(), -startX));
926 
927  kt_int32u nY = static_cast<kt_int32u>(math::Round(offsetY * 2.0 / rSearchSpaceResolution.GetY()) + 1);
928  kt_double startY = -offsetY;
929  assert(math::DoubleEqual(startY + (nY - 1) * rSearchSpaceResolution.GetY(), -startY));
930 
931  for (kt_int32u yIndex = 0; yIndex < nY; yIndex++)
932  {
933  kt_double y = startY + yIndex * rSearchSpaceResolution.GetY();
934 
935  for (kt_int32u xIndex = 0; xIndex < nX; xIndex++)
936  {
937  kt_double x = startX + xIndex * rSearchSpaceResolution.GetX();
938 
940  rSearchCenter.GetY() + y));
942 
943  // response is not a low response
944  if (response >= (bestResponse - 0.1))
945  {
946  norm += response;
947  accumulatedVarianceXX += (math::Square(x - dx) * response);
948  accumulatedVarianceXY += ((x - dx) * (y - dy) * response);
949  accumulatedVarianceYY += (math::Square(y - dy) * response);
950  }
951  }
952  }
953 
954  if (norm > KT_TOLERANCE)
955  {
956  kt_double varianceXX = accumulatedVarianceXX / norm;
957  kt_double varianceXY = accumulatedVarianceXY / norm;
958  kt_double varianceYY = accumulatedVarianceYY / norm;
959  kt_double varianceTHTH = 4 * math::Square(searchAngleResolution);
960 
961  // lower-bound variances so that they are not too small;
962  // ensures that links are not too tight
963  kt_double minVarianceXX = 0.1 * math::Square(rSearchSpaceResolution.GetX());
964  kt_double minVarianceYY = 0.1 * math::Square(rSearchSpaceResolution.GetY());
965  varianceXX = math::Maximum(varianceXX, minVarianceXX);
966  varianceYY = math::Maximum(varianceYY, minVarianceYY);
967 
968  // increase variance for poorer responses
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; // this value will be set in ComputeAngularCovariance
975  }
976 
977  // if values are 0, set to MAX_VARIANCE
978  // values might be 0 if points are too sparse and thus don't hit other points
979  if (math::DoubleEqual(rCovariance(0, 0), 0.0))
980  {
981  rCovariance(0, 0) = MAX_VARIANCE;
982  }
983 
984  if (math::DoubleEqual(rCovariance(1, 1), 0.0))
985  {
986  rCovariance(1, 1) = MAX_VARIANCE;
987  }
988  }
989 
1000  kt_double bestResponse,
1001  const Pose2& rSearchCenter,
1002  kt_double searchAngleOffset,
1003  kt_double searchAngleResolution,
1004  Matrix3& rCovariance)
1005  {
1006  // NOTE: do not reset covariance matrix
1007 
1008  // normalize angle difference
1009  kt_double bestAngle = math::NormalizeAngleDifference(rBestPose.GetHeading(), rSearchCenter.GetHeading());
1010 
1012  kt_int32s gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
1013 
1014  kt_int32u nAngles = static_cast<kt_int32u>(math::Round(searchAngleOffset * 2 / searchAngleResolution) + 1);
1015 
1016  kt_double angle = 0.0;
1017  kt_double startAngle = rSearchCenter.GetHeading() - searchAngleOffset;
1018 
1019  kt_double norm = 0.0;
1020  kt_double accumulatedVarianceThTh = 0.0;
1021  for (kt_int32u angleIndex = 0; angleIndex < nAngles; angleIndex++)
1022  {
1023  angle = startAngle + angleIndex * searchAngleResolution;
1024  kt_double response = GetResponse(angleIndex, gridIndex);
1025 
1026  // response is not a low response
1027  if (response >= (bestResponse - 0.1))
1028  {
1029  norm += response;
1030  accumulatedVarianceThTh += (math::Square(angle - bestAngle) * response);
1031  }
1032  }
1033  assert(math::DoubleEqual(angle, rSearchCenter.GetHeading() + searchAngleOffset));
1034 
1035  if (norm > KT_TOLERANCE)
1036  {
1037  if (accumulatedVarianceThTh < KT_TOLERANCE)
1038  {
1039  accumulatedVarianceThTh = math::Square(searchAngleResolution);
1040  }
1041 
1042  accumulatedVarianceThTh /= norm;
1043  }
1044  else
1045  {
1046  accumulatedVarianceThTh = 1000 * math::Square(searchAngleResolution);
1047  }
1048 
1049  rCovariance(2, 2) = accumulatedVarianceThTh;
1050  }
1051 
1058  {
1060 
1061  // add all scans to grid
1063  {
1064  if (*iter == NULL)
1065  {
1066  continue;
1067  }
1068 
1069  AddScan(*iter, viewPoint);
1070  }
1071  }
1072 
1079  {
1081 
1082  // add all scans to grid
1084  {
1085  if (iter->second == NULL)
1086  {
1087  continue;
1088  }
1089 
1090  AddScan(iter->second, viewPoint);
1091  }
1092  }
1093 
1100  void ScanMatcher::AddScan(LocalizedRangeScan* pScan, const Vector2<kt_double>& rViewPoint, kt_bool doSmear)
1101  {
1102  PointVectorDouble validPoints = FindValidPoints(pScan, rViewPoint);
1103 
1104  // put in all valid points
1105  const_forEach(PointVectorDouble, &validPoints)
1106  {
1108  if (!math::IsUpTo(gridPoint.GetX(), m_pCorrelationGrid->GetROI().GetWidth()) ||
1109  !math::IsUpTo(gridPoint.GetY(), m_pCorrelationGrid->GetROI().GetHeight()))
1110  {
1111  // point not in grid
1112  continue;
1113  }
1114 
1115  int gridIndex = m_pCorrelationGrid->GridIndex(gridPoint);
1116 
1117  // set grid cell as occupied
1119  {
1120  // value already set
1121  continue;
1122  }
1123 
1125 
1126  // smear grid
1127  if (doSmear == true)
1128  {
1129  m_pCorrelationGrid->SmearPoint(gridPoint);
1130  }
1131  }
1132  }
1133 
1141  {
1142  const PointVectorDouble& rPointReadings = pScan->GetPointReadings();
1143 
1144  // points must be at least 10 cm away when making comparisons of inside/outside of viewpoint
1145  const kt_double minSquareDistance = math::Square(0.1); // in m^2
1146 
1147  // this iterator lags from the main iterator adding points only when the points are on
1148  // the same side as the viewpoint
1149  PointVectorDouble::const_iterator trailingPointIter = rPointReadings.begin();
1150  PointVectorDouble validPoints;
1151 
1152  Vector2<kt_double> firstPoint;
1153  kt_bool firstTime = true;
1154  const_forEach(PointVectorDouble, &rPointReadings)
1155  {
1156  Vector2<kt_double> currentPoint = *iter;
1157 
1158  if (firstTime && !std::isnan(currentPoint.GetX()) && !std::isnan(currentPoint.GetY()))
1159  {
1160  firstPoint = currentPoint;
1161  firstTime = false;
1162  }
1163 
1164  Vector2<kt_double> delta = firstPoint - currentPoint;
1165  if (delta.SquaredLength() > minSquareDistance)
1166  {
1167  // This compute the Determinant (viewPoint FirstPoint, viewPoint currentPoint)
1168  // Which computes the direction of rotation, if the rotation is counterclock
1169  // wise then we are looking at data we should keep. If it's negative rotation
1170  // we should not included in in the matching
1171  // have enough distance, check viewpoint
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;
1176 
1177  // reset beginning point
1178  firstPoint = currentPoint;
1179 
1180  if (ss < 0.0) // wrong side, skip and keep going
1181  {
1182  trailingPointIter = iter;
1183  }
1184  else
1185  {
1186  for (; trailingPointIter != iter; ++trailingPointIter)
1187  {
1188  validPoints.push_back(*trailingPointIter);
1189  }
1190  }
1191  }
1192  }
1193 
1194  return validPoints;
1195  }
1196 
1203  kt_double ScanMatcher::GetResponse(kt_int32u angleIndex, kt_int32s gridPositionIndex) const
1204  {
1205  kt_double response = 0.0;
1206 
1207  // add up value for each point
1208  kt_int8u* pByte = m_pCorrelationGrid->GetDataPointer() + gridPositionIndex;
1209 
1210  const LookupArray* pOffsets = m_pGridLookup->GetLookupArray(angleIndex);
1211  assert(pOffsets != NULL);
1212 
1213  // get number of points in offset list
1214  kt_int32u nPoints = pOffsets->GetSize();
1215  if (nPoints == 0)
1216  {
1217  return response;
1218  }
1219 
1220  // calculate response
1221  kt_int32s* pAngleIndexPointer = pOffsets->GetArrayPointer();
1222  for (kt_int32u i = 0; i < nPoints; i++)
1223  {
1224  // ignore points that fall off the grid
1225  kt_int32s pointGridIndex = gridPositionIndex + pAngleIndexPointer[i];
1226  if (!math::IsUpTo(pointGridIndex, m_pCorrelationGrid->GetDataSize()) || pAngleIndexPointer[i] == INVALID_SCAN)
1227  {
1228  continue;
1229  }
1230 
1231  // uses index offsets to efficiently find location of point in the grid
1232  response += pByte[pAngleIndexPointer[i]];
1233  }
1234 
1235  // normalize response
1236  response /= (nPoints * GridStates_Occupied);
1237  assert(fabs(response) <= 1.0);
1238 
1239  return response;
1240  }
1241 
1242 
1246 
1247  template<typename T>
1249  {
1250  public:
1255  {
1256  }
1258  : GraphTraversal<T>(pGraph)
1259  {
1260  }
1261 
1266  {
1267  }
1268 
1269  public:
1276  virtual std::vector<T*> TraverseForScans(Vertex<T>* pStartVertex, Visitor<T>* pVisitor)
1277  {
1278  std::vector<Vertex<T>*> validVertices = TraverseForVertices(pStartVertex, pVisitor);
1279 
1280  std::vector<T*> objects;
1281  forEach(typename std::vector<Vertex<T>*>, &validVertices)
1282  {
1283  objects.push_back((*iter)->GetObject());
1284  }
1285 
1286  return objects;
1287  }
1288 
1295  virtual std::vector<Vertex<T>*> TraverseForVertices(Vertex<T>* pStartVertex, Visitor<T>* pVisitor)
1296  {
1297  std::queue<Vertex<T>*> toVisit;
1298  std::set<Vertex<T>*> seenVertices;
1299  std::vector<Vertex<T>*> validVertices;
1300 
1301  toVisit.push(pStartVertex);
1302  seenVertices.insert(pStartVertex);
1303 
1304  do
1305  {
1306  Vertex<T>* pNext = toVisit.front();
1307  toVisit.pop();
1308 
1309  if (pNext != NULL && pVisitor->Visit(pNext))
1310  {
1311  // vertex is valid, explore neighbors
1312  validVertices.push_back(pNext);
1313 
1314  std::vector<Vertex<T>*> adjacentVertices = pNext->GetAdjacentVertices();
1315  forEach(typename std::vector<Vertex<T>*>, &adjacentVertices)
1316  {
1317  Vertex<T>* pAdjacent = *iter;
1318 
1319  // adjacent vertex has not yet been seen, add to queue for processing
1320  if (seenVertices.find(pAdjacent) == seenVertices.end())
1321  {
1322  toVisit.push(pAdjacent);
1323  seenVertices.insert(pAdjacent);
1324  }
1325  }
1326  }
1327  } while (toVisit.empty() == false);
1328 
1329  return validVertices;
1330  }
1331 
1333  template<class Archive>
1334  void serialize(Archive &ar, const unsigned int version)
1335  {
1336  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(GraphTraversal<T>);
1337  }
1338  }; // class BreadthFirstTraversal
1339 
1343 
1344  class NearScanVisitor : public Visitor<LocalizedRangeScan>
1345  {
1346  public:
1347  NearScanVisitor(LocalizedRangeScan* pScan, kt_double maxDistance, kt_bool useScanBarycenter)
1348  : m_MaxDistanceSquared(math::Square(maxDistance))
1349  , m_UseScanBarycenter(useScanBarycenter)
1350  {
1352  }
1353 
1355  {
1356  try
1357  {
1358  LocalizedRangeScan* pScan = pVertex->GetObject();
1360  kt_double squaredDistance = pose.GetPosition().SquaredDistance(m_CenterPose.GetPosition());
1361  return (squaredDistance <= m_MaxDistanceSquared - KT_TOLERANCE);
1362  }
1363  catch(...)
1364  {
1365  // relocalization vertex elements missing
1366  std::cout << "Unable to visit valid vertex elements!" << std::endl;
1367  return false;
1368  }
1369  }
1370 
1371  protected:
1376  template<class Archive>
1377  void serialize(Archive &ar, const unsigned int version)
1378  {
1379  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Visitor<LocalizedRangeScan>);
1380  ar & BOOST_SERIALIZATION_NVP(m_CenterPose);
1381  ar & BOOST_SERIALIZATION_NVP(m_MaxDistanceSquared);
1382  ar & BOOST_SERIALIZATION_NVP(m_UseScanBarycenter);
1383  }
1384  }; // NearScanVisitor
1385 
1389 
1390  class NearPoseVisitor : public Visitor<LocalizedRangeScan>
1391  {
1392  public:
1393  NearPoseVisitor(Pose2 refPose, kt_double maxDistance, kt_bool useScanBarycenter)
1394  : m_MaxDistanceSquared(math::Square(maxDistance))
1395  , m_UseScanBarycenter(useScanBarycenter)
1396  {
1397  m_CenterPose = refPose;
1398  }
1399 
1401  {
1402  LocalizedRangeScan* pScan = pVertex->GetObject();
1403 
1405 
1406  kt_double squaredDistance = pose.GetPosition().SquaredDistance(m_CenterPose.GetPosition());
1407  return (squaredDistance <= m_MaxDistanceSquared - KT_TOLERANCE);
1408  }
1409 
1410  protected:
1415  template<class Archive>
1416  void serialize(Archive &ar, const unsigned int version)
1417  {
1418  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Visitor<LocalizedRangeScan>);
1419  ar & BOOST_SERIALIZATION_NVP(m_CenterPose);
1420  ar & BOOST_SERIALIZATION_NVP(m_MaxDistanceSquared);
1421  ar & BOOST_SERIALIZATION_NVP(m_UseScanBarycenter);
1422  }
1423  }; // NearPoseVisitor
1424 
1428 
1429 
1430  MapperGraph::MapperGraph(Mapper* pMapper, kt_double rangeThreshold)
1431  : m_pMapper(pMapper)
1432  {
1436  assert(m_pLoopScanMatcher);
1437 
1439  }
1440 
1442  {
1443  if (m_pLoopScanMatcher)
1444  {
1445  delete m_pLoopScanMatcher;
1446  m_pLoopScanMatcher = NULL;
1447  }
1448  if (m_pTraversal)
1449  {
1450  delete m_pTraversal;
1451  m_pTraversal = NULL;
1452  }
1453  }
1454 
1456  {
1457  assert(pScan);
1458 
1459  if (pScan != NULL)
1460  {
1463  if (m_pMapper->m_pScanOptimizer != NULL)
1464  {
1465  m_pMapper->m_pScanOptimizer->AddNode(pVertex);
1466  }
1467  return pVertex;
1468  }
1469 
1470  return nullptr;
1471  }
1472 
1473  void MapperGraph::AddEdges(LocalizedRangeScan* pScan, const Matrix3& rCovariance)
1474  {
1476 
1477  const Name rSensorName = pScan->GetSensorName();
1478 
1479  // link to previous scan
1480  kt_int32s previousScanNum = pScan->GetStateId() - 1;
1481  if (pSensorManager->GetLastScan(rSensorName) != NULL)
1482  {
1483  assert(previousScanNum >= 0);
1484  LocalizedRangeScan* pPrevScan = pSensorManager->GetScan(rSensorName, previousScanNum);
1485  if (!pPrevScan)
1486  {
1487  return;
1488  }
1489  LinkScans(pPrevScan, pScan, pScan->GetSensorPose(), rCovariance);
1490  }
1491 
1492  Pose2Vector means;
1493  std::vector<Matrix3> covariances;
1494 
1495  // first scan (link to first scan of other robots)
1496  if (pSensorManager->GetLastScan(rSensorName) == NULL)
1497  {
1498  assert(pSensorManager->GetScans(rSensorName).size() == 1);
1499 
1500  std::vector<Name> deviceNames = pSensorManager->GetSensorNames();
1501  forEach(std::vector<Name>, &deviceNames)
1502  {
1503  const Name& rCandidateSensorName = *iter;
1504 
1505  // skip if candidate device is the same or other device has no scans
1506  if ((rCandidateSensorName == rSensorName) || (pSensorManager->GetScans(rCandidateSensorName).empty()))
1507  {
1508  continue;
1509  }
1510 
1511  Pose2 bestPose;
1512  Matrix3 covariance;
1514  pSensorManager->GetScans(rCandidateSensorName),
1515  bestPose, covariance);
1516  LinkScans(pScan, pSensorManager->GetScan(rCandidateSensorName, 0), bestPose, covariance);
1517 
1518  // only add to means and covariances if response was high "enough"
1520  {
1521  means.push_back(bestPose);
1522  covariances.push_back(covariance);
1523  }
1524  }
1525  }
1526  else
1527  {
1528  // link to running scans
1529  Pose2 scanPose = pScan->GetSensorPose();
1530  means.push_back(scanPose);
1531  covariances.push_back(rCovariance);
1532  LinkChainToScan(pSensorManager->GetRunningScans(rSensorName), pScan, scanPose, rCovariance);
1533  }
1534 
1535  // link to other near chains (chains that include new scan are invalid)
1536  LinkNearChains(pScan, means, covariances);
1537 
1538  if (!means.empty())
1539  {
1540  pScan->SetSensorPose(ComputeWeightedMean(means, covariances));
1541  }
1542  }
1543 
1545  {
1546  kt_bool loopClosed = false;
1547 
1548  kt_int32u scanIndex = 0;
1549 
1550  LocalizedRangeScanVector candidateChain = FindPossibleLoopClosure(pScan, rSensorName, scanIndex);
1551 
1552  while (!candidateChain.empty())
1553  {
1554  Pose2 bestPose;
1555  Matrix3 covariance;
1556  kt_double coarseResponse = m_pLoopScanMatcher->MatchScan(pScan, candidateChain,
1557  bestPose, covariance, false, false);
1558 
1559  std::stringstream stream;
1560  stream << "COARSE RESPONSE: " << coarseResponse
1561  << " (> " << m_pMapper->m_pLoopMatchMinimumResponseCoarse->GetValue() << ")"
1562  << std::endl;
1563  stream << " var: " << covariance(0, 0) << ", " << covariance(1, 1)
1564  << " (< " << m_pMapper->m_pLoopMatchMaximumVarianceCoarse->GetValue() << ")";
1565 
1566  m_pMapper->FireLoopClosureCheck(stream.str());
1567 
1568  if ((coarseResponse > m_pMapper->m_pLoopMatchMinimumResponseCoarse->GetValue()) &&
1569  (covariance(0, 0) < m_pMapper->m_pLoopMatchMaximumVarianceCoarse->GetValue()) &&
1570  (covariance(1, 1) < m_pMapper->m_pLoopMatchMaximumVarianceCoarse->GetValue()))
1571  {
1572  LocalizedRangeScan tmpScan(pScan->GetSensorName(), pScan->GetRangeReadingsVector());
1573  tmpScan.SetUniqueId(pScan->GetUniqueId());
1574  tmpScan.SetTime(pScan->GetTime());
1575  tmpScan.SetStateId(pScan->GetStateId());
1576  tmpScan.SetCorrectedPose(pScan->GetCorrectedPose());
1577  tmpScan.SetSensorPose(bestPose); // This also updates OdometricPose.
1578  kt_double fineResponse = m_pMapper->m_pSequentialScanMatcher->MatchScan(&tmpScan, candidateChain,
1579  bestPose, covariance, false);
1580 
1581  std::stringstream stream1;
1582  stream1 << "FINE RESPONSE: " << fineResponse << " (>"
1583  << m_pMapper->m_pLoopMatchMinimumResponseFine->GetValue() << ")" << std::endl;
1584  m_pMapper->FireLoopClosureCheck(stream1.str());
1585 
1586  if (fineResponse < m_pMapper->m_pLoopMatchMinimumResponseFine->GetValue())
1587  {
1588  m_pMapper->FireLoopClosureCheck("REJECTED!");
1589  }
1590  else
1591  {
1592  m_pMapper->FireBeginLoopClosure("Closing loop...");
1593 
1594  pScan->SetSensorPose(bestPose);
1595  LinkChainToScan(candidateChain, pScan, bestPose, covariance);
1596  CorrectPoses();
1597 
1598  m_pMapper->FireEndLoopClosure("Loop closed!");
1599 
1600  loopClosed = true;
1601  }
1602  }
1603 
1604  candidateChain = FindPossibleLoopClosure(pScan, rSensorName, scanIndex);
1605  }
1606 
1607  return loopClosed;
1608  }
1609 
1611  const Pose2& rPose) const
1612  {
1613  LocalizedRangeScan* pClosestScan = NULL;
1614  kt_double bestSquaredDistance = DBL_MAX;
1615 
1617  {
1618  Pose2 scanPose = (*iter)->GetReferencePose(m_pMapper->m_pUseScanBarycenter->GetValue());
1619 
1620  kt_double squaredDistance = rPose.GetPosition().SquaredDistance(scanPose.GetPosition());
1621  if (squaredDistance < bestSquaredDistance)
1622  {
1623  bestSquaredDistance = squaredDistance;
1624  pClosestScan = *iter;
1625  }
1626  }
1627 
1628  return pClosestScan;
1629  }
1630 
1632  LocalizedRangeScan* pTargetScan, kt_bool& rIsNewEdge)
1633  {
1634  std::map<int, Vertex<LocalizedRangeScan>* >::iterator v1 = m_Vertices[pSourceScan->GetSensorName()].find(pSourceScan->GetStateId());
1635  std::map<int, Vertex<LocalizedRangeScan>* >::iterator v2 = m_Vertices[pTargetScan->GetSensorName()].find(pTargetScan->GetStateId());
1636 
1637  if (v1 == m_Vertices[pSourceScan->GetSensorName()].end() ||
1638  v2 == m_Vertices[pSourceScan->GetSensorName()].end())
1639  {
1640  std::cout << "AddEdge: At least one vertex is invalid." << std::endl;
1641  return NULL;
1642  }
1643 
1644  // see if edge already exists
1645  const_forEach(std::vector<Edge<LocalizedRangeScan>*>, &(v1->second->GetEdges()))
1646  {
1647  Edge<LocalizedRangeScan>* pEdge = *iter;
1648 
1649  if (pEdge->GetTarget() == v2->second)
1650  {
1651  rIsNewEdge = false;
1652  return pEdge;
1653  }
1654  }
1655 
1656  Edge<LocalizedRangeScan>* pEdge = new Edge<LocalizedRangeScan>(v1->second, v2->second);
1658  rIsNewEdge = true;
1659  return pEdge;
1660  }
1661 
1663  const Pose2& rMean, const Matrix3& rCovariance)
1664  {
1665  kt_bool isNewEdge = true;
1666  Edge<LocalizedRangeScan>* pEdge = AddEdge(pFromScan, pToScan, isNewEdge);
1667 
1668  if (pEdge == NULL)
1669  {
1670  return;
1671  }
1672 
1673  // only attach link information if the edge is new
1674  if (isNewEdge == true)
1675  {
1676  pEdge->SetLabel(new LinkInfo(pFromScan->GetCorrectedPose(), pToScan->GetCorrectedAt(rMean), rCovariance));
1677  if (m_pMapper->m_pScanOptimizer != NULL)
1678  {
1680  }
1681  }
1682  }
1683 
1684  void MapperGraph::LinkNearChains(LocalizedRangeScan* pScan, Pose2Vector& rMeans, std::vector<Matrix3>& rCovariances)
1685  {
1686  const std::vector<LocalizedRangeScanVector> nearChains = FindNearChains(pScan);
1687  const_forEach(std::vector<LocalizedRangeScanVector>, &nearChains)
1688  {
1689  if (iter->size() < m_pMapper->m_pLoopMatchMinimumChainSize->GetValue())
1690  {
1691  continue;
1692  }
1693 
1694  Pose2 mean;
1695  Matrix3 covariance;
1696  // match scan against "near" chain
1697  kt_double response = m_pMapper->m_pSequentialScanMatcher->MatchScan(pScan, *iter, mean, covariance, false);
1699  {
1700  rMeans.push_back(mean);
1701  rCovariances.push_back(covariance);
1702  LinkChainToScan(*iter, pScan, mean, covariance);
1703  }
1704  }
1705  }
1706 
1708  const Pose2& rMean, const Matrix3& rCovariance)
1709  {
1711 
1712  LocalizedRangeScan* pClosestScan = GetClosestScanToPose(rChain, pose);
1713  assert(pClosestScan != NULL);
1714 
1715  Pose2 closestScanPose = pClosestScan->GetReferencePose(m_pMapper->m_pUseScanBarycenter->GetValue());
1716 
1717  kt_double squaredDistance = pose.GetPosition().SquaredDistance(closestScanPose.GetPosition());
1719  {
1720  LinkScans(pClosestScan, pScan, rMean, rCovariance);
1721  }
1722  }
1723 
1724  std::vector<LocalizedRangeScanVector> MapperGraph::FindNearChains(LocalizedRangeScan* pScan)
1725  {
1726  std::vector<LocalizedRangeScanVector> nearChains;
1727 
1729 
1730  // to keep track of which scans have been added to a chain
1731  LocalizedRangeScanVector processed;
1732 
1733  const LocalizedRangeScanVector nearLinkedScans = FindNearLinkedScans(pScan,
1735  const_forEach(LocalizedRangeScanVector, &nearLinkedScans)
1736  {
1737  LocalizedRangeScan* pNearScan = *iter;
1738 
1739  if (pNearScan == pScan)
1740  {
1741  continue;
1742  }
1743 
1744  // scan has already been processed, skip
1745  if (find(processed.begin(), processed.end(), pNearScan) != processed.end())
1746  {
1747  continue;
1748  }
1749 
1750  processed.push_back(pNearScan);
1751 
1752  // build up chain
1753  kt_bool isValidChain = true;
1754  std::list<LocalizedRangeScan*> chain;
1755 
1756  // add scans before current scan being processed
1757  for (kt_int32s candidateScanNum = pNearScan->GetStateId() - 1; candidateScanNum >= 0; candidateScanNum--)
1758  {
1759  LocalizedRangeScan* pCandidateScan = m_pMapper->m_pMapperSensorManager->GetScan(pNearScan->GetSensorName(),
1760  candidateScanNum);
1761 
1762  // chain is invalid--contains scan being added
1763  if (pCandidateScan == pScan)
1764  {
1765  isValidChain = false;
1766  }
1767 
1768  // probably removed in localization mode
1769  if (pCandidateScan == NULL)
1770  {
1771  continue;
1772  }
1773 
1774  Pose2 candidatePose = pCandidateScan->GetReferencePose(m_pMapper->m_pUseScanBarycenter->GetValue());
1775  kt_double squaredDistance = scanPose.GetPosition().SquaredDistance(candidatePose.GetPosition());
1776 
1778  {
1779  chain.push_front(pCandidateScan);
1780  processed.push_back(pCandidateScan);
1781  }
1782  else
1783  {
1784  break;
1785  }
1786  }
1787 
1788  chain.push_back(pNearScan);
1789 
1790  // add scans after current scan being processed
1791  kt_int32u end = static_cast<kt_int32u>(m_pMapper->m_pMapperSensorManager->GetScans(pNearScan->GetSensorName()).size());
1792  for (kt_int32u candidateScanNum = pNearScan->GetStateId() + 1; candidateScanNum < end; candidateScanNum++)
1793  {
1794  LocalizedRangeScan* pCandidateScan = m_pMapper->m_pMapperSensorManager->GetScan(pNearScan->GetSensorName(),
1795  candidateScanNum);
1796 
1797  if (pCandidateScan == pScan)
1798  {
1799  isValidChain = false;
1800  }
1801 
1802  // probably removed in localization mode
1803  if (pCandidateScan == NULL)
1804  {
1805  continue;
1806  }
1807 
1808  Pose2 candidatePose = pCandidateScan->GetReferencePose(m_pMapper->m_pUseScanBarycenter->GetValue());;
1809  kt_double squaredDistance = scanPose.GetPosition().SquaredDistance(candidatePose.GetPosition());
1810 
1812  {
1813  chain.push_back(pCandidateScan);
1814  processed.push_back(pCandidateScan);
1815  }
1816  else
1817  {
1818  break;
1819  }
1820  }
1821 
1822  if (isValidChain)
1823  {
1824  // change list to vector
1825  LocalizedRangeScanVector tempChain;
1826  std::copy(chain.begin(), chain.end(), std::inserter(tempChain, tempChain.begin()));
1827  // add chain to collection
1828  nearChains.push_back(tempChain);
1829  }
1830  }
1831 
1832  return nearChains;
1833  }
1834 
1836  {
1837  NearScanVisitor* pVisitor = new NearScanVisitor(pScan, maxDistance, m_pMapper->m_pUseScanBarycenter->GetValue());
1838  LocalizedRangeScanVector nearLinkedScans = m_pTraversal->TraverseForScans(GetVertex(pScan), pVisitor);
1839  delete pVisitor;
1840 
1841  return nearLinkedScans;
1842  }
1843 
1844  std::vector<Vertex<LocalizedRangeScan>*> MapperGraph::FindNearLinkedVertices(LocalizedRangeScan* pScan, kt_double maxDistance)
1845  {
1846  NearScanVisitor* pVisitor = new NearScanVisitor(pScan, maxDistance, m_pMapper->m_pUseScanBarycenter->GetValue());
1847  std::vector<Vertex<LocalizedRangeScan>*> nearLinkedVertices = m_pTraversal->TraverseForVertices(GetVertex(pScan), pVisitor);
1848  delete pVisitor;
1849 
1850  return nearLinkedVertices;
1851  }
1852 
1854  {
1855  NearPoseVisitor* pVisitor = new NearPoseVisitor(refPose, maxDistance, m_pMapper->m_pUseScanBarycenter->GetValue());
1856 
1857  Vertex<LocalizedRangeScan>* closestVertex = FindNearByScan(name, refPose);
1858 
1859  LocalizedRangeScanVector nearLinkedScans = m_pTraversal->TraverseForScans(closestVertex, pVisitor);
1860  delete pVisitor;
1861 
1862  return nearLinkedScans;
1863  }
1864 
1865  std::vector<Vertex<LocalizedRangeScan>*> MapperGraph::FindNearByVertices(Name name, const Pose2 refPose, kt_double maxDistance)
1866  {
1867  VertexMap vertexMap = GetVertices();
1868  std::map<int, Vertex<LocalizedRangeScan>*>& vertices = vertexMap[name];
1869 
1870  std::vector<Vertex<LocalizedRangeScan>*> vertices_to_search;
1871  std::map<int, Vertex<LocalizedRangeScan>*>::iterator it;
1872  for (it = vertices.begin(); it != vertices.end(); ++it)
1873  {
1874  if (it->second)
1875  {
1876  vertices_to_search.push_back(it->second);
1877  }
1878  }
1879 
1880  const size_t dim = 2;
1881 
1883  const P2KD p2kd(vertices_to_search);
1884 
1886 
1887  my_kd_tree_t index(dim, p2kd, nanoflann::KDTreeSingleIndexAdaptorParams(10) );
1888  index.buildIndex();
1889 
1890  std::vector<std::pair<size_t,double> > ret_matches;
1891  const double query_pt[2] = {refPose.GetX(), refPose.GetY()};
1892  nanoflann::SearchParams params;
1893  const size_t num_results = index.radiusSearch(&query_pt[0], maxDistance, ret_matches, params);
1894 
1895  std::vector<Vertex<LocalizedRangeScan>*> rtn_vertices;
1896  rtn_vertices.reserve(ret_matches.size());
1897  for (uint i = 0; i != ret_matches.size(); i++)
1898  {
1899  rtn_vertices.push_back(vertices_to_search[ret_matches[i].first]);
1900  }
1901  return rtn_vertices;
1902  }
1903 
1905  {
1906  VertexMap vertexMap = GetVertices();
1907  std::map<int, Vertex<LocalizedRangeScan>*>& vertices = vertexMap[name];
1908 
1909  std::vector<Vertex<LocalizedRangeScan>*> vertices_to_search;
1910  std::map<int, Vertex<LocalizedRangeScan>*>::iterator it;
1911  for (it = vertices.begin(); it != vertices.end(); ++it)
1912  {
1913  if (it->second)
1914  {
1915  vertices_to_search.push_back(it->second);
1916  }
1917  }
1918 
1919  size_t num_results = 1;
1920  const size_t dim = 2;
1921 
1923  const P2KD p2kd(vertices_to_search);
1924 
1926 
1927  my_kd_tree_t index(dim, p2kd, nanoflann::KDTreeSingleIndexAdaptorParams(10) );
1928  index.buildIndex();
1929 
1930  std::vector<size_t> ret_index(num_results);
1931  std::vector<double> out_dist_sqr(num_results);
1932  const double query_pt[2] = {refPose.GetX(), refPose.GetY()};
1933  num_results = index.knnSearch(&query_pt[0], num_results, &ret_index[0], &out_dist_sqr[0]);
1934 
1935  if (num_results > 0)
1936  {
1937  return vertices_to_search[ret_index[0]];
1938  }
1939  else
1940  {
1941  return NULL;
1942  }
1943  }
1944 
1945  Pose2 MapperGraph::ComputeWeightedMean(const Pose2Vector& rMeans, const std::vector<Matrix3>& rCovariances) const
1946  {
1947  assert(rMeans.size() == rCovariances.size());
1948 
1949  // compute sum of inverses and create inverse list
1950  std::vector<Matrix3> inverses;
1951  inverses.reserve(rCovariances.size());
1952 
1953  Matrix3 sumOfInverses;
1954  const_forEach(std::vector<Matrix3>, &rCovariances)
1955  {
1956  Matrix3 inverse = iter->Inverse();
1957  inverses.push_back(inverse);
1958 
1959  sumOfInverses += inverse;
1960  }
1961  Matrix3 inverseOfSumOfInverses = sumOfInverses.Inverse();
1962 
1963  // compute weighted mean
1964  Pose2 accumulatedPose;
1965  kt_double thetaX = 0.0;
1966  kt_double thetaY = 0.0;
1967 
1968  Pose2Vector::const_iterator meansIter = rMeans.begin();
1969  const_forEach(std::vector<Matrix3>, &inverses)
1970  {
1971  Pose2 pose = *meansIter;
1972  kt_double angle = pose.GetHeading();
1973  thetaX += cos(angle);
1974  thetaY += sin(angle);
1975 
1976  Matrix3 weight = inverseOfSumOfInverses * (*iter);
1977  accumulatedPose += weight * pose;
1978 
1979  ++meansIter;
1980  }
1981 
1982  thetaX /= rMeans.size();
1983  thetaY /= rMeans.size();
1984  accumulatedPose.SetHeading(atan2(thetaY, thetaX));
1985 
1986  return accumulatedPose;
1987  }
1988 
1990  const Name& rSensorName,
1991  kt_int32u& rStartNum)
1992  {
1993  LocalizedRangeScanVector chain; // return value
1994 
1996 
1997  // possible loop closure chain should not include close scans that have a
1998  // path of links to the scan of interest
1999  const LocalizedRangeScanVector nearLinkedScans =
2001 
2002  kt_int32u nScans = static_cast<kt_int32u>(m_pMapper->m_pMapperSensorManager->GetScans(rSensorName).size());
2003  for (; rStartNum < nScans; rStartNum++)
2004  {
2005  LocalizedRangeScan* pCandidateScan = m_pMapper->m_pMapperSensorManager->GetScan(rSensorName, rStartNum);
2006 
2007  if (pCandidateScan == NULL)
2008  {
2009  continue;
2010  }
2011 
2012  Pose2 candidateScanPose = pCandidateScan->GetReferencePose(m_pMapper->m_pUseScanBarycenter->GetValue());
2013 
2014  kt_double squaredDistance = candidateScanPose.GetPosition().SquaredDistance(pose.GetPosition());
2016  {
2017  // a linked scan cannot be in the chain
2018  if (find(nearLinkedScans.begin(), nearLinkedScans.end(), pCandidateScan) != nearLinkedScans.end())
2019  {
2020  chain.clear();
2021  }
2022  else
2023  {
2024  chain.push_back(pCandidateScan);
2025  }
2026  }
2027  else
2028  {
2029  // return chain if it is long "enough"
2030  if (chain.size() >= m_pMapper->m_pLoopMatchMinimumChainSize->GetValue())
2031  {
2032  return chain;
2033  }
2034  else
2035  {
2036  chain.clear();
2037  }
2038  }
2039  }
2040 
2041  return chain;
2042  }
2043 
2045  {
2046  // optimize scans!
2048  if (pSolver != NULL)
2049  {
2050  pSolver->Compute();
2051 
2053  {
2055  if (scan == NULL)
2056  {
2057  continue;
2058  }
2059  scan->SetCorrectedPoseAndUpdate(iter->second);
2060  }
2061 
2062  pSolver->Clear();
2063  }
2064  }
2065 
2067  {
2068  if (m_pLoopScanMatcher) {
2069  delete m_pLoopScanMatcher;
2070  }
2075  assert(m_pLoopScanMatcher);
2076  }
2077 
2081 
2086  : Module("Mapper"),
2087  m_Initialized(false),
2088  m_Deserialized(false),
2089  m_pSequentialScanMatcher(NULL),
2090  m_pMapperSensorManager(NULL),
2091  m_pGraph(NULL),
2092  m_pScanOptimizer(NULL)
2093  {
2095  }
2096 
2100  Mapper::Mapper(const std::string & rName)
2101  : Module(rName),
2102  m_Initialized(false),
2103  m_Deserialized(false),
2104  m_pSequentialScanMatcher(NULL),
2105  m_pMapperSensorManager(NULL),
2106  m_pGraph(NULL),
2107  m_pScanOptimizer(NULL)
2108  {
2110  }
2111 
2116  {
2117  Reset();
2118 
2119  delete m_pMapperSensorManager;
2120  }
2121 
2123  {
2125  "UseScanMatching",
2126  "When set to true, the mapper will use a scan matching algorithm. "
2127  "In most real-world situations this should be set to true so that the "
2128  "mapper algorithm can correct for noise and errors in odometry and "
2129  "scan data. In some simulator environments where the simulated scan "
2130  "and odometry data are very accurate, the scan matching algorithm can "
2131  "produce worse results. In those cases set this to false to improve "
2132  "results.",
2133  true,
2135 
2137  "UseScanBarycenter",
2138  "Use the barycenter of scan endpoints to define distances between "
2139  "scans.",
2140  true, GetParameterManager());
2141 
2143  "MinimumTimeInterval",
2144  "Sets the minimum time between scans. If a new scan's time stamp is "
2145  "longer than MinimumTimeInterval from the previously processed scan, "
2146  "the mapper will use the data from the new scan. Otherwise, it will "
2147  "discard the new scan if it also does not meet the minimum travel "
2148  "distance and heading requirements. For performance reasons, it is "
2149  "generally it is a good idea to only process scans if a reasonable "
2150  "amount of time has passed. This parameter is particularly useful "
2151  "when there is a need to process scans while the robot is stationary.",
2152  3600, GetParameterManager());
2153 
2155  "MinimumTravelDistance",
2156  "Sets the minimum travel between scans. If a new scan's position is "
2157  "more than minimumTravelDistance from the previous scan, the mapper "
2158  "will use the data from the new scan. Otherwise, it will discard the "
2159  "new scan if it also does not meet the minimum change in heading "
2160  "requirement. For performance reasons, generally it is a good idea to "
2161  "only process scans if the robot has moved a reasonable amount.",
2162  0.2, GetParameterManager());
2163 
2165  "MinimumTravelHeading",
2166  "Sets the minimum heading change between scans. If a new scan's "
2167  "heading is more than MinimumTravelHeading from the previous scan, the "
2168  "mapper will use the data from the new scan. Otherwise, it will "
2169  "discard the new scan if it also does not meet the minimum travel "
2170  "distance requirement. For performance reasons, generally it is a good "
2171  "idea to only process scans if the robot has moved a reasonable "
2172  "amount.",
2174 
2176  "ScanBufferSize",
2177  "Scan buffer size is the length of the scan chain stored for scan "
2178  "matching. \"ScanBufferSize\" should be set to approximately "
2179  "\"ScanBufferMaximumScanDistance\" / \"MinimumTravelDistance\". The "
2180  "idea is to get an area approximately 20 meters long for scan "
2181  "matching. For example, if we add scans every MinimumTravelDistance == "
2182  "0.3 meters, then \"scanBufferSize\" should be 20 / 0.3 = 67.)",
2183  70, GetParameterManager());
2184 
2186  "ScanBufferMaximumScanDistance",
2187  "Scan buffer maximum scan distance is the maximum distance between the "
2188  "first and last scans in the scan chain stored for matching.",
2189  20.0, GetParameterManager());
2190 
2192  "LinkMatchMinimumResponseFine",
2193  "Scans are linked only if the correlation response value is greater "
2194  "than this value.",
2195  0.8, GetParameterManager());
2196 
2198  "LinkScanMaximumDistance",
2199  "Maximum distance between linked scans. Scans that are farther apart "
2200  "will not be linked regardless of the correlation response value.",
2201  10.0, GetParameterManager());
2202 
2204  "LoopSearchMaximumDistance",
2205  "Scans less than this distance from the current position will be "
2206  "considered for a match in loop closure.",
2207  4.0, GetParameterManager());
2208 
2210  "DoLoopClosing",
2211  "Enable/disable loop closure.",
2212  true, GetParameterManager());
2213 
2215  "LoopMatchMinimumChainSize",
2216  "When the loop closure detection finds a candidate it must be part of "
2217  "a large set of linked scans. If the chain of scans is less than this "
2218  "value we do not attempt to close the loop.",
2219  10, GetParameterManager());
2220 
2222  "LoopMatchMaximumVarianceCoarse",
2223  "The co-variance values for a possible loop closure have to be less "
2224  "than this value to consider a viable solution. This applies to the "
2225  "coarse search.",
2227 
2229  "LoopMatchMinimumResponseCoarse",
2230  "If response is larger then this, then initiate loop closure search at "
2231  "the coarse resolution.",
2232  0.8, GetParameterManager());
2233 
2235  "LoopMatchMinimumResponseFine",
2236  "If response is larger then this, then initiate loop closure search at "
2237  "the fine resolution.",
2238  0.8, GetParameterManager());
2239 
2241  // CorrelationParameters correlationParameters;
2242 
2244  "CorrelationSearchSpaceDimension",
2245  "The size of the search grid used by the matcher. The search grid will "
2246  "have the size CorrelationSearchSpaceDimension * "
2247  "CorrelationSearchSpaceDimension",
2248  0.3, GetParameterManager());
2249 
2251  "CorrelationSearchSpaceResolution",
2252  "The resolution (size of a grid cell) of the correlation grid.",
2253  0.01, GetParameterManager());
2254 
2256  "CorrelationSearchSpaceSmearDeviation",
2257  "The point readings are smeared by this value in X and Y to create a "
2258  "smoother response.",
2259  0.03, GetParameterManager());
2260 
2261 
2263  // CorrelationParameters loopCorrelationParameters;
2264 
2266  "LoopSearchSpaceDimension",
2267  "The size of the search grid used by the matcher.",
2268  8.0, GetParameterManager());
2269 
2271  "LoopSearchSpaceResolution",
2272  "The resolution (size of a grid cell) of the correlation grid.",
2273  0.05, GetParameterManager());
2274 
2276  "LoopSearchSpaceSmearDeviation",
2277  "The point readings are smeared by this value in X and Y to create a "
2278  "smoother response.",
2279  0.03, GetParameterManager());
2280 
2282  // ScanMatcherParameters;
2283 
2285  "DistanceVariancePenalty",
2286  "Variance of penalty for deviating from odometry when scan-matching. "
2287  "The penalty is a multiplier (less than 1.0) is a function of the "
2288  "delta of the scan position being tested and the odometric pose.",
2290 
2292  "AngleVariancePenalty",
2293  "See DistanceVariancePenalty.",
2295 
2297  "FineSearchAngleOffset",
2298  "The range of angles to search during a fine search.",
2300 
2302  "CoarseSearchAngleOffset",
2303  "The range of angles to search during a coarse search.",
2305 
2307  "CoarseAngleResolution",
2308  "Resolution of angles to search during a coarse search.",
2310 
2312  "MinimumAnglePenalty",
2313  "Minimum value of the angle penalty multiplier so scores do not become "
2314  "too small.",
2315  0.9, GetParameterManager());
2316 
2318  "MinimumDistancePenalty",
2319  "Minimum value of the distance penalty multiplier so scores do not "
2320  "become too small.",
2321  0.5, GetParameterManager());
2322 
2324  "UseResponseExpansion",
2325  "Whether to increase the search space if no good matches are initially "
2326  "found.",
2327  false, GetParameterManager());
2328  }
2329  /* Adding in getters and setters here for easy parameter access */
2330 
2331  // General Parameters
2332 
2334  {
2335  return static_cast<bool>(m_pUseScanMatching->GetValue());
2336  }
2337 
2339  {
2340  return static_cast<bool>(m_pUseScanBarycenter->GetValue());
2341  }
2342 
2344  {
2345  return static_cast<double>(m_pMinimumTimeInterval->GetValue());
2346  }
2347 
2349  {
2350  return static_cast<double>(m_pMinimumTravelDistance->GetValue());
2351  }
2352 
2354  {
2355  return math::RadiansToDegrees(static_cast<double>(m_pMinimumTravelHeading->GetValue()));
2356  }
2357 
2359  {
2360  return static_cast<int>(m_pScanBufferSize->GetValue());
2361  }
2362 
2364  {
2365  return static_cast<double>(m_pScanBufferMaximumScanDistance->GetValue());
2366  }
2367 
2369  {
2370  return static_cast<double>(m_pLinkMatchMinimumResponseFine->GetValue());
2371  }
2372 
2374  {
2375  return static_cast<double>(m_pLinkScanMaximumDistance->GetValue());
2376  }
2377 
2379  {
2380  return static_cast<double>(m_pLoopSearchMaximumDistance->GetValue());
2381  }
2382 
2384  {
2385  return static_cast<bool>(m_pDoLoopClosing->GetValue());
2386  }
2387 
2389  {
2390  return static_cast<int>(m_pLoopMatchMinimumChainSize->GetValue());
2391  }
2392 
2394  {
2395  return static_cast<double>(std::sqrt(m_pLoopMatchMaximumVarianceCoarse->GetValue()));
2396  }
2397 
2399  {
2400  return static_cast<double>(m_pLoopMatchMinimumResponseCoarse->GetValue());
2401  }
2402 
2404  {
2405  return static_cast<double>(m_pLoopMatchMinimumResponseFine->GetValue());
2406  }
2407 
2408  // Correlation Parameters - Correlation Parameters
2409 
2411  {
2412  return static_cast<double>(m_pCorrelationSearchSpaceDimension->GetValue());
2413  }
2414 
2416  {
2417  return static_cast<double>(m_pCorrelationSearchSpaceResolution->GetValue());
2418  }
2419 
2421  {
2422  return static_cast<double>(m_pCorrelationSearchSpaceSmearDeviation->GetValue());
2423  }
2424 
2425  // Correlation Parameters - Loop Correlation Parameters
2426 
2428  {
2429  return static_cast<double>(m_pLoopSearchSpaceDimension->GetValue());
2430  }
2431 
2433  {
2434  return static_cast<double>(m_pLoopSearchSpaceResolution->GetValue());
2435  }
2436 
2438  {
2439  return static_cast<double>(m_pLoopSearchSpaceSmearDeviation->GetValue());
2440  }
2441 
2442  // ScanMatcher Parameters
2443 
2445  {
2446  return std::sqrt(static_cast<double>(m_pDistanceVariancePenalty->GetValue()));
2447  }
2448 
2450  {
2451  return std::sqrt(static_cast<double>(m_pAngleVariancePenalty->GetValue()));
2452  }
2453 
2455  {
2456  return static_cast<double>(m_pFineSearchAngleOffset->GetValue());
2457  }
2458 
2460  {
2461  return static_cast<double>(m_pCoarseSearchAngleOffset->GetValue());
2462  }
2463 
2465  {
2466  return static_cast<double>(m_pCoarseAngleResolution->GetValue());
2467  }
2468 
2470  {
2471  return static_cast<double>(m_pMinimumAnglePenalty->GetValue());
2472  }
2473 
2475  {
2476  return static_cast<double>(m_pMinimumDistancePenalty->GetValue());
2477  }
2478 
2480  {
2481  return static_cast<bool>(m_pUseResponseExpansion->GetValue());
2482  }
2483 
2484  /* Setters for parameters */
2485  // General Parameters
2487  {
2489  }
2490 
2492  {
2494  }
2495 
2497  {
2499  }
2500 
2502  {
2504  }
2505 
2507  {
2509  }
2510 
2512  {
2514  }
2515 
2517  {
2519  }
2520 
2522  {
2524  }
2525 
2527  {
2529  }
2530 
2532  {
2534  }
2535 
2537  {
2539  }
2540 
2542  {
2544  }
2545 
2547  {
2549  }
2550 
2552  {
2554  }
2555 
2557  {
2559  }
2560 
2561  // Correlation Parameters - Correlation Parameters
2563  {
2565  }
2566 
2568  {
2570  }
2571 
2573  {
2575  }
2576 
2577 
2578  // Correlation Parameters - Loop Closure Parameters
2580  {
2582  }
2583 
2585  {
2587  }
2588 
2590  {
2592  }
2593 
2594 
2595  // Scan Matcher Parameters
2597  {
2599  }
2600 
2602  {
2604  }
2605 
2607  {
2609  }
2610 
2612  {
2614  }
2615 
2617  {
2619  }
2620 
2622  {
2624  }
2625 
2627  {
2629  }
2630 
2632  {
2634  }
2635 
2636 
2637 
2638  void Mapper::Initialize(kt_double rangeThreshold)
2639  {
2640  if (m_Initialized)
2641  {
2642  return;
2643  }
2644  // create sequential scan and loop matcher, update if deserialized
2645 
2647  delete m_pSequentialScanMatcher;
2648  }
2653  rangeThreshold);
2654  assert(m_pSequentialScanMatcher);
2655 
2656  if (m_Deserialized) {
2659 
2660  m_pGraph->UpdateLoopScanMatcher(rangeThreshold);
2661  } else {
2664 
2665  m_pGraph = new MapperGraph(this, rangeThreshold);
2666  }
2667 
2668  m_Initialized = true;
2669  }
2670 
2671  void Mapper::SaveToFile(const std::string& filename)
2672  {
2673  printf("Save To File %s \n", filename.c_str());
2674  std::ofstream ofs(filename.c_str());
2675  boost::archive::binary_oarchive oa(ofs, boost::archive::no_codecvt);
2676  oa << BOOST_SERIALIZATION_NVP(*this);
2677  }
2678 
2679  void Mapper::LoadFromFile(const std::string& filename)
2680  {
2681  printf("Load From File %s \n", filename.c_str());
2682  std::ifstream ifs(filename.c_str());
2683  boost::archive::binary_iarchive ia(ifs, boost::archive::no_codecvt);
2684  ia >> BOOST_SERIALIZATION_NVP(*this);
2685  m_Deserialized = true;
2686  m_Initialized = false;
2687  }
2688 
2690  {
2692  {
2693  delete m_pSequentialScanMatcher;
2694  m_pSequentialScanMatcher = NULL;
2695  }
2696  if (m_pGraph)
2697  {
2698  delete m_pGraph;
2699  m_pGraph = NULL;
2700  }
2702  {
2703  delete m_pMapperSensorManager;
2704  m_pMapperSensorManager = NULL;
2705  }
2706  m_Initialized = false;
2707  m_Deserialized = false;
2708  while (!m_LocalizationScanVertices.empty())
2709  {
2711  }
2712  }
2713 
2715  {
2716  return true;
2717  }
2718 
2720  {
2721  if (pScan != NULL)
2722  {
2723  karto::LaserRangeFinder* pLaserRangeFinder = pScan->GetLaserRangeFinder();
2724 
2725  // validate scan
2726  if (pLaserRangeFinder == NULL || pScan == NULL || pLaserRangeFinder->Validate(pScan) == false)
2727  {
2728  return false;
2729  }
2730 
2731  if (m_Initialized == false)
2732  {
2733  // initialize mapper with range threshold from device
2734  Initialize(pLaserRangeFinder->GetRangeThreshold());
2735  }
2736 
2737  // get last scan
2739 
2740  // update scans corrected pose based on last correction
2741  if (pLastScan != NULL)
2742  {
2743  Transform lastTransform(pLastScan->GetOdometricPose(), pLastScan->GetCorrectedPose());
2744  pScan->SetCorrectedPose(lastTransform.TransformPose(pScan->GetOdometricPose()));
2745  }
2746 
2747  // test if scan is outside minimum boundary or if heading is larger then minimum heading
2748  if (!HasMovedEnough(pScan, pLastScan))
2749  {
2750  return false;
2751  }
2752 
2753  Matrix3 cov;
2754  cov.SetToIdentity();
2755 
2756  // correct scan (if not first scan)
2757  if (m_pUseScanMatching->GetValue() && pLastScan != NULL)
2758  {
2759  Pose2 bestPose;
2762  bestPose,
2763  cov);
2764  pScan->SetSensorPose(bestPose);
2765  if (covariance) {
2766  *covariance = cov;
2767  }
2768  }
2769 
2770  // add scan to buffer and assign id
2772 
2774  {
2775  // add to graph
2776  m_pGraph->AddVertex(pScan);
2777  m_pGraph->AddEdges(pScan, cov);
2778 
2780 
2781  if (m_pDoLoopClosing->GetValue())
2782  {
2783  std::vector<Name> deviceNames = m_pMapperSensorManager->GetSensorNames();
2784  const_forEach(std::vector<Name>, &deviceNames)
2785  {
2786  m_pGraph->TryCloseLoop(pScan, *iter);
2787  }
2788  }
2789  }
2790 
2792 
2793  return true;
2794  }
2795 
2796  return false;
2797  }
2798 
2799  kt_bool Mapper::ProcessAgainstNodesNearBy(LocalizedRangeScan* pScan, kt_bool addScanToLocalizationBuffer, Matrix3 * covariance)
2800  {
2801  if (pScan != NULL)
2802  {
2803  karto::LaserRangeFinder* pLaserRangeFinder = pScan->GetLaserRangeFinder();
2804 
2805  // validate scan
2806  if (pLaserRangeFinder == NULL || pScan == NULL ||
2807  pLaserRangeFinder->Validate(pScan) == false)
2808  {
2809  return false;
2810  }
2811 
2812  if (m_Initialized == false)
2813  {
2814  // initialize mapper with range threshold from device
2815  Initialize(pLaserRangeFinder->GetRangeThreshold());
2816  }
2817 
2819  pScan->GetSensorName(), pScan->GetOdometricPose());
2820  LocalizedRangeScan* pLastScan = NULL;
2821  if (closetVertex)
2822  {
2823  pLastScan = m_pMapperSensorManager->GetScan(pScan->GetSensorName(),
2824  closetVertex->GetObject()->GetStateId());
2827  m_pMapperSensorManager->SetLastScan(pLastScan);
2828  }
2829 
2830  Matrix3 cov;
2831  cov.SetToIdentity();
2832 
2833  // correct scan (if not first scan)
2834  if (m_pUseScanMatching->GetValue() && pLastScan != NULL)
2835  {
2836  Pose2 bestPose;
2839  bestPose,
2840  cov);
2841  pScan->SetSensorPose(bestPose);
2842  }
2843 
2844  pScan->SetOdometricPose(pScan->GetCorrectedPose());
2845 
2846  if (covariance) {
2847  *covariance = cov;
2848  }
2849 
2850  // add scan to buffer and assign id
2852 
2853  Vertex<LocalizedRangeScan>* scan_vertex = NULL;
2855  {
2856  scan_vertex = m_pGraph->AddVertex(pScan);
2857  // add to graph
2858  m_pGraph->AddVertex(pScan);
2859  m_pGraph->AddEdges(pScan, cov);
2860 
2862 
2863  if (m_pDoLoopClosing->GetValue())
2864  {
2865  std::vector<Name> deviceNames =
2867  const_forEach(std::vector<Name>, &deviceNames)
2868  {
2869  m_pGraph->TryCloseLoop(pScan, *iter);
2870  }
2871  }
2872  }
2873 
2875 
2876  if (addScanToLocalizationBuffer)
2877  {
2878  AddScanToLocalizationBuffer(pScan, scan_vertex);
2879  }
2880 
2881  return true;
2882  }
2883 
2884  return false;
2885  }
2886 
2888  {
2889  if (pScan == NULL)
2890  {
2891  return false;
2892  }
2893 
2894  karto::LaserRangeFinder* pLaserRangeFinder = pScan->GetLaserRangeFinder();
2895 
2896  // validate scan
2897  if (pLaserRangeFinder == NULL || pScan == NULL ||
2898  pLaserRangeFinder->Validate(pScan) == false)
2899  {
2900  return false;
2901  }
2902 
2903  if (m_Initialized == false)
2904  {
2905  // initialize mapper with range threshold from device
2906  Initialize(pLaserRangeFinder->GetRangeThreshold());
2907  }
2908 
2909  // get last scan
2911  pScan->GetSensorName());
2912 
2913  // update scans corrected pose based on last correction
2914  if (pLastScan != NULL)
2915  {
2916  Transform lastTransform(pLastScan->GetOdometricPose(),
2917  pLastScan->GetCorrectedPose());
2918  pScan->SetCorrectedPose(lastTransform.TransformPose(
2919  pScan->GetOdometricPose()));
2920  }
2921 
2922  // test if scan is outside minimum boundary
2923  // or if heading is larger then minimum heading
2924  if (!HasMovedEnough(pScan, pLastScan))
2925  {
2926  return false;
2927  }
2928 
2929  Matrix3 cov;
2930  cov.SetToIdentity();
2931 
2932  // correct scan (if not first scan)
2933  if (m_pUseScanMatching->GetValue() && pLastScan != NULL)
2934  {
2935  Pose2 bestPose;
2938  bestPose,
2939  cov);
2940  pScan->SetSensorPose(bestPose);
2941  if (covariance) {
2942  *covariance = cov;
2943  }
2944  }
2945 
2946  // add scan to buffer and assign id
2948 
2949  Vertex<LocalizedRangeScan>* scan_vertex = NULL;
2951  {
2952  // add to graph
2953  scan_vertex = m_pGraph->AddVertex(pScan);
2954  m_pGraph->AddEdges(pScan, cov);
2955 
2957 
2958  if (m_pDoLoopClosing->GetValue())
2959  {
2960  std::vector<Name> deviceNames = m_pMapperSensorManager->GetSensorNames();
2961  const_forEach(std::vector<Name>, &deviceNames)
2962  {
2963  m_pGraph->TryCloseLoop(pScan, *iter);
2964  }
2965  }
2966  }
2967 
2969  AddScanToLocalizationBuffer(pScan, scan_vertex);
2970 
2971  return true;
2972  }
2973 
2975  {
2976 
2977  // generate the info to store and later decay, outside of dataset
2979  lsv.scan = pScan;
2980  lsv.vertex = scan_vertex;
2981  m_LocalizationScanVertices.push(lsv);
2982 
2984  {
2986  RemoveNodeFromGraph(oldLSV.vertex);
2987 
2988  // delete node and scans
2989  // free hat!
2990  // No need to delete from m_scans as those pointers will be freed memory
2991  oldLSV.vertex->RemoveObject();
2993  if (oldLSV.scan)
2994  {
2995  delete oldLSV.scan;
2996  oldLSV.scan = NULL;
2997  }
2998 
3000  }
3001  }
3002 
3004  {
3005  while (!m_LocalizationScanVertices.empty())
3006  {
3008  RemoveNodeFromGraph(oldLSV.vertex);
3009  oldLSV.vertex->RemoveObject();
3011  if (oldLSV.scan)
3012  {
3013  delete oldLSV.scan;
3014  oldLSV.scan = NULL;
3015  }
3016 
3018  }
3019 
3020  std::vector<Name> names = m_pMapperSensorManager->GetSensorNames();
3021  for (uint i = 0; i != names.size(); i++)
3022  {
3025  }
3026 
3027  return;
3028  }
3029 
3031  {
3032  // 1) delete edges in adjacent vertices, graph, and optimizer
3033  std::vector<Vertex<LocalizedRangeScan>*> adjVerts =
3034  vertex_to_remove->GetAdjacentVertices();
3035  for (int i = 0; i != adjVerts.size(); i++)
3036  {
3037  std::vector<Edge<LocalizedRangeScan>*> adjEdges = adjVerts[i]->GetEdges();
3038  bool found = false;
3039  for (int j=0; j!=adjEdges.size(); j++)
3040  {
3041  if (adjEdges[j]->GetTarget() == vertex_to_remove ||
3042  adjEdges[j]->GetSource() == vertex_to_remove)
3043  {
3044  adjVerts[i]->RemoveEdge(j);
3046  adjEdges[j]->GetSource()->GetObject()->GetUniqueId(),
3047  adjEdges[j]->GetTarget()->GetObject()->GetUniqueId());
3048  std::vector<Edge<LocalizedRangeScan>*> edges = m_pGraph->GetEdges();
3049  std::vector<Edge<LocalizedRangeScan>*>::iterator edgeGraphIt =
3050  std::find(edges.begin(), edges.end(), adjEdges[j]);
3051 
3052  if (edgeGraphIt == edges.end())
3053  {
3054  std::cout << "Edge not found in graph to remove!" << std::endl;
3055  continue;
3056  }
3057 
3058  int posEdge = edgeGraphIt - edges.begin();
3059  m_pGraph->RemoveEdge(posEdge); // remove from graph
3060  delete *edgeGraphIt; // free hat!
3061  *edgeGraphIt = NULL;
3062  found = true;
3063  }
3064  }
3065  if (!found)
3066  {
3067  std::cout << "Failed to find any edge in adj. vertex" <<
3068  " with a matching vertex to current!" << std::endl;
3069  }
3070  }
3071 
3072  // 2) delete vertex from optimizer
3073  m_pScanOptimizer->RemoveNode(vertex_to_remove->GetObject()->GetUniqueId());
3074 
3075  // 3) delete from vertex map
3076  std::map<Name, std::map<int, Vertex<LocalizedRangeScan>*> >
3077  vertexMap = m_pGraph->GetVertices();
3078  std::map<int, Vertex<LocalizedRangeScan>*> graphVertices =
3079  vertexMap[vertex_to_remove->GetObject()->GetSensorName()];
3080  std::map<int, Vertex<LocalizedRangeScan>*>::iterator
3081  vertexGraphIt = graphVertices.find(vertex_to_remove->GetObject()->GetStateId());
3082  if (vertexGraphIt != graphVertices.end())
3083  {
3084  m_pGraph->RemoveVertex(vertex_to_remove->GetObject()->GetSensorName(),
3085  vertexGraphIt->second->GetObject()->GetStateId());
3086  }
3087  else
3088  {
3089  std::cout << "Vertex not found in graph to remove!" << std::endl;
3090  return false;
3091  }
3092 
3093  return true;
3094  }
3095 
3097  LocalizedRangeScan * pScan,
3098  const int & nodeId,
3099  Matrix3 * covariance)
3100  {
3101  if (pScan != NULL)
3102  {
3103  karto::LaserRangeFinder* pLaserRangeFinder = pScan->GetLaserRangeFinder();
3104 
3105  // validate scan
3106  if (pLaserRangeFinder == NULL || pScan == NULL ||
3107  pLaserRangeFinder->Validate(pScan) == false)
3108  {
3109  return false;
3110  }
3111 
3112  if (m_Initialized == false)
3113  {
3114  // initialize mapper with range threshold from device
3115  Initialize(pLaserRangeFinder->GetRangeThreshold());
3116  }
3117 
3118  // If we're matching against a node from an older mapping session
3119  // lets get the first scan as the last scan and populate running scans
3120  // with the first few from that run as well.
3121  LocalizedRangeScan* pLastScan =
3122  m_pMapperSensorManager->GetScan(pScan->GetSensorName(), nodeId);
3125  m_pMapperSensorManager->SetLastScan(pLastScan);
3126 
3127  Matrix3 cov;
3128  cov.SetToIdentity();
3129 
3130  // correct scan (if not first scan)
3131  if (m_pUseScanMatching->GetValue() && pLastScan != NULL)
3132  {
3133  Pose2 bestPose;
3136  bestPose,
3137  cov);
3138  pScan->SetSensorPose(bestPose);
3139  }
3140 
3141  pScan->SetOdometricPose(pScan->GetCorrectedPose());
3142  if (covariance) {
3143  *covariance = cov;
3144  }
3145 
3146  // add scan to buffer and assign id
3148 
3150  {
3151  // add to graph
3152  m_pGraph->AddVertex(pScan);
3153  m_pGraph->AddEdges(pScan, cov);
3154 
3156 
3157  if (m_pDoLoopClosing->GetValue())
3158  {
3159  std::vector<Name> deviceNames =
3161  const_forEach(std::vector<Name>, &deviceNames)
3162  {
3163  m_pGraph->TryCloseLoop(pScan, *iter);
3164  }
3165  }
3166  }
3167 
3169 
3170  return true;
3171  }
3172 
3173  return false;
3174  }
3175 
3177  {
3178  // Special case of processing against node where node is the starting point
3179  return ProcessAgainstNode(pScan, 0, covariance);
3180  }
3181 
3189  {
3190  // test if first scan
3191  if (pLastScan == NULL)
3192  {
3193  return true;
3194  }
3195 
3196  // test if enough time has passed
3197  kt_double timeInterval = pScan->GetTime() - pLastScan->GetTime();
3198  if (timeInterval >= m_pMinimumTimeInterval->GetValue())
3199  {
3200  return true;
3201  }
3202 
3203  Pose2 lastScannerPose = pLastScan->GetSensorAt(pLastScan->GetOdometricPose());
3204  Pose2 scannerPose = pScan->GetSensorAt(pScan->GetOdometricPose());
3205 
3206  // test if we have turned enough
3207  kt_double deltaHeading = math::NormalizeAngle(scannerPose.GetHeading() - lastScannerPose.GetHeading());
3208  if (fabs(deltaHeading) >= m_pMinimumTravelHeading->GetValue())
3209  {
3210  return true;
3211  }
3212 
3213  // test if we have moved enough
3214  kt_double squaredTravelDistance = lastScannerPose.GetPosition().SquaredDistance(scannerPose.GetPosition());
3215  if (squaredTravelDistance >= math::Square(m_pMinimumTravelDistance->GetValue()) - KT_TOLERANCE)
3216  {
3217  return true;
3218  }
3219 
3220  return false;
3221  }
3222 
3228  {
3229  LocalizedRangeScanVector allScans;
3230 
3231  if (m_pMapperSensorManager != NULL)
3232  {
3233  allScans = m_pMapperSensorManager->GetAllScans();
3234  }
3235 
3236  return allScans;
3237  }
3238 
3244  {
3245  m_Listeners.push_back(pListener);
3246  }
3247 
3253  {
3254  std::vector<MapperListener*>::iterator iter = std::find(m_Listeners.begin(), m_Listeners.end(), pListener);
3255  if (iter != m_Listeners.end())
3256  {
3257  m_Listeners.erase(iter);
3258  }
3259  }
3260 
3261  void Mapper::FireInfo(const std::string& rInfo) const
3262  {
3263  const_forEach(std::vector<MapperListener*>, &m_Listeners)
3264  {
3265  (*iter)->Info(rInfo);
3266  }
3267  }
3268 
3269  void Mapper::FireDebug(const std::string& rInfo) const
3270  {
3271  const_forEach(std::vector<MapperListener*>, &m_Listeners)
3272  {
3273  MapperDebugListener* pListener = dynamic_cast<MapperDebugListener*>(*iter);
3274 
3275  if (pListener != NULL)
3276  {
3277  pListener->Debug(rInfo);
3278  }
3279  }
3280  }
3281 
3282  void Mapper::FireLoopClosureCheck(const std::string& rInfo) const
3283  {
3284  const_forEach(std::vector<MapperListener*>, &m_Listeners)
3285  {
3286  MapperLoopClosureListener* pListener = dynamic_cast<MapperLoopClosureListener*>(*iter);
3287 
3288  if (pListener != NULL)
3289  {
3290  pListener->LoopClosureCheck(rInfo);
3291  }
3292  }
3293  }
3294 
3295  void Mapper::FireBeginLoopClosure(const std::string& rInfo) const
3296  {
3297  const_forEach(std::vector<MapperListener*>, &m_Listeners)
3298  {
3299  MapperLoopClosureListener* pListener = dynamic_cast<MapperLoopClosureListener*>(*iter);
3300 
3301  if (pListener != NULL)
3302  {
3303  pListener->BeginLoopClosure(rInfo);
3304  }
3305  }
3306  }
3307 
3308  void Mapper::FireEndLoopClosure(const std::string& rInfo) const
3309  {
3310  const_forEach(std::vector<MapperListener*>, &m_Listeners)
3311  {
3312  MapperLoopClosureListener* pListener = dynamic_cast<MapperLoopClosureListener*>(*iter);
3313 
3314  if (pListener != NULL)
3315  {
3316  pListener->EndLoopClosure(rInfo);
3317  }
3318  }
3319  }
3320 
3321  void Mapper::SetScanSolver(ScanSolver* pScanOptimizer)
3322  {
3323  m_pScanOptimizer = pScanOptimizer;
3324  }
3325 
3327  {
3328  return m_pScanOptimizer;
3329  }
3330 
3332  {
3333  return m_pGraph;
3334  }
3335 
3337  {
3338  return m_pSequentialScanMatcher;
3339  }
3340 
3342  {
3343  return m_pGraph->GetLoopScanMatcher();
3344  }
3345 } // namespace karto
karto::MapperDebugListener
Definition: Mapper.h:63
karto::Name
Definition: Karto.h:389
response
const std::string response
const_forEach
#define const_forEach(listtype, list)
Definition: Macros.h:72
karto::math::Round
kt_double Round(kt_double value)
Definition: Math.h:87
karto::NearPoseVisitor::Visit
virtual kt_bool Visit(Vertex< LocalizedRangeScan > *pVertex)
Definition: Mapper.cpp:1400
karto::ScanMatcher::m_pGridLookup
GridIndexLookup< kt_int8u > * m_pGridLookup
Definition: Mapper.h:1478
karto::Mapper::getParamCoarseAngleResolution
double getParamCoarseAngleResolution()
Definition: Mapper.cpp:2464
karto::Mapper
Definition: Mapper.h:1928
karto::Mapper::m_pAngleVariancePenalty
Parameter< kt_double > * m_pAngleVariancePenalty
Definition: Mapper.h:2325
karto::ScanSolver
Definition: Mapper.h:947
karto::ScanSolver::AddConstraint
virtual void AddConstraint(Edge< LocalizedRangeScan > *)
Definition: Mapper.h:998
karto::Mapper::getParamLoopMatchMinimumChainSize
int getParamLoopMatchMinimumChainSize()
Definition: Mapper.cpp:2388
karto::KT_TOLERANCE
const kt_double KT_TOLERANCE
Definition: Math.h:41
karto::Transform::TransformPose
Pose2 TransformPose(const Pose2 &rSourcePose)
Definition: Karto.h:3004
karto::MapperGraph::MapperGraph
MapperGraph()
Definition: Mapper.h:722
karto::Rectangle2< kt_int32s >
karto::ScanSolver::RemoveConstraint
virtual void RemoveConstraint(kt_int32s, kt_int32s)
Definition: Mapper.h:1005
karto::Mapper::getParamLoopMatchMinimumResponseCoarse
double getParamLoopMatchMinimumResponseCoarse()
Definition: Mapper.cpp:2398
karto::Mapper::m_pDoLoopClosing
Parameter< kt_bool > * m_pDoLoopClosing
Definition: Mapper.h:2239
karto::Mapper::getParamScanBufferMaximumScanDistance
double getParamScanBufferMaximumScanDistance()
Definition: Mapper.cpp:2363
karto::Mapper::ProcessAtDock
kt_bool ProcessAtDock(LocalizedRangeScan *pScan, Matrix3 *covariance=nullptr)
Definition: Mapper.cpp:3176
karto::BreadthFirstTraversal::TraverseForVertices
virtual std::vector< Vertex< T > * > TraverseForVertices(Vertex< T > *pStartVertex, Visitor< T > *pVisitor)
Definition: Mapper.cpp:1295
karto::Mapper::FireLoopClosureCheck
void FireLoopClosureCheck(const std::string &rInfo) const
Definition: Mapper.cpp:3282
karto::ScanMatcher::m_rSearchCenter
Pose2 m_rSearchCenter
Definition: Mapper.h:1482
karto::GridIndexLookup::ComputeOffsets
void ComputeOffsets(LocalizedRangeScan *pScan, kt_double angleCenter, kt_double angleOffset, kt_double angleResolution)
Definition: Karto.h:6945
karto::KT_PI
const kt_double KT_PI
Definition: Math.h:32
karto::Pose2Vector
std::vector< Pose2 > Pose2Vector
Definition: Karto.h:2271
karto::BreadthFirstTraversal::~BreadthFirstTraversal
virtual ~BreadthFirstTraversal()
Definition: Mapper.cpp:1265
VertexVectorPoseNanoFlannAdaptor
Definition: nanoflann_adaptors.h:24
karto::MapperGraph::TryCloseLoop
kt_bool TryCloseLoop(LocalizedRangeScan *pScan, const Name &rSensorName)
Definition: Mapper.cpp:1544
karto::ScanManager::Clear
void Clear()
Definition: Mapper.cpp:228
karto::LaserRangeScan::GetLaserRangeFinder
LaserRangeFinder * GetLaserRangeFinder() const
Definition: Karto.h:5397
karto::Visitor::Visit
virtual kt_bool Visit(Vertex< T > *pVertex)=0
karto::Mapper::getParamMinimumTravelHeading
double getParamMinimumTravelHeading()
Definition: Mapper.cpp:2353
karto::Visitor
Definition: Mapper.h:494
kt_double
double kt_double
Definition: Types.h:67
karto::ScanManager::ScanManager
ScanManager(kt_int32u runningBufferMaximumSize, kt_double runningBufferMaximumDistance)
Definition: Mapper.cpp:63
karto::LocalizedRangeScan::GetOdometricPose
const Pose2 & GetOdometricPose() const
Definition: Karto.h:5540
karto::LaserRangeFinder
Definition: Karto.h:3922
karto::LocalizedRangeScan::GetReferencePose
Pose2 GetReferencePose(kt_bool useBarycenter) const
Definition: Karto.h:5616
karto::Mapper::SaveToFile
void SaveToFile(const std::string &filename)
Definition: Mapper.cpp:2671
karto::ScanMatcher::AddScans
void AddScans(const LocalizedRangeScanVector &rScans, Vector2< kt_double > viewPoint)
Definition: Mapper.cpp:1057
karto::ScanManager::GetLastScan
LocalizedRangeScan * GetLastScan()
Definition: Mapper.cpp:104
angle
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
karto::Pose2::GetPosition
const Vector2< kt_double > & GetPosition() const
Definition: Karto.h:2135
karto::MapperGraph::LinkChainToScan
void LinkChainToScan(const LocalizedRangeScanVector &rChain, LocalizedRangeScan *pScan, const Pose2 &rMean, const Matrix3 &rCovariance)
Definition: Mapper.cpp:1707
Types.h
karto::LocalizedRangeScan::GetSensorPose
Pose2 GetSensorPose() const
Definition: Karto.h:5634
karto::MapperGraph::GetLoopScanMatcher
ScanMatcher * GetLoopScanMatcher() const
Definition: Mapper.h:806
karto::Mapper::getParamCorrelationSearchSpaceResolution
double getParamCorrelationSearchSpaceResolution()
Definition: Mapper.cpp:2415
karto::Mapper::FireEndLoopClosure
void FireEndLoopClosure(const std::string &rInfo) const
Definition: Mapper.cpp:3308
karto::LocalizationScanVertex::scan
LocalizedRangeScan * scan
Definition: Mapper.h:1921
karto::MapperSensorManager::SetRunningScanBufferSize
void SetRunningScanBufferSize(kt_int32u rScanBufferSize)
Definition: Mapper.cpp:406
karto::Mapper::GetGraph
virtual MapperGraph * GetGraph() const
Definition: Mapper.cpp:3331
karto::Parameter::SetValue
void SetValue(const T &rValue)
Definition: Karto.h:3282
karto::Module
Definition: Karto.h:818
MAX_VARIANCE
#define MAX_VARIANCE
Definition: Mapper.cpp:46
karto::Mapper::FireDebug
void FireDebug(const std::string &rInfo) const
Definition: Mapper.cpp:3269
karto::NearScanVisitor
Definition: Mapper.cpp:1344
karto::Mapper::GetLoopScanMatcher
virtual ScanMatcher * GetLoopScanMatcher() const
Definition: Mapper.cpp:3341
karto::Mapper::setParamDoLoopClosing
void setParamDoLoopClosing(bool b)
Definition: Mapper.cpp:2536
karto::math::DegreesToRadians
kt_double DegreesToRadians(kt_double degrees)
Definition: Math.h:56
karto::Pose2::GetY
kt_double GetY() const
Definition: Karto.h:2117
karto::Mapper::setParamLinkMatchMinimumResponseFine
void setParamLinkMatchMinimumResponseFine(double d)
Definition: Mapper.cpp:2521
karto::Mapper::setParamCoarseAngleResolution
void setParamCoarseAngleResolution(double d)
Definition: Mapper.cpp:2616
karto::Mapper::InitializeParameters
void InitializeParameters()
Definition: Mapper.cpp:2122
karto::Mapper::m_pLoopSearchMaximumDistance
Parameter< kt_double > * m_pLoopSearchMaximumDistance
Definition: Mapper.h:2246
karto::MapperGraph::LinkScans
void LinkScans(LocalizedRangeScan *pFromScan, LocalizedRangeScan *pToScan, const Pose2 &rMean, const Matrix3 &rCovariance)
Definition: Mapper.cpp:1662
DISTANCE_PENALTY_GAIN
#define DISTANCE_PENALTY_GAIN
Definition: Mapper.cpp:47
karto::Mapper::setParamMinimumAnglePenalty
void setParamMinimumAnglePenalty(double d)
Definition: Mapper.cpp:2621
karto::MapperGraph::~MapperGraph
virtual ~MapperGraph()
Definition: Mapper.cpp:1441
karto::MapperGraph::m_pMapper
Mapper * m_pMapper
Definition: Mapper.h:909
karto::ScanMatcher::CorrelateScan
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)
Definition: Mapper.cpp:719
karto::ScanSolver::Compute
virtual void Compute()=0
karto::Mapper::setParamScanBufferMaximumScanDistance
void setParamScanBufferMaximumScanDistance(double d)
Definition: Mapper.cpp:2516
karto::MapperSensorManager::GetScans
LocalizedRangeScanMap & GetScans(const Name &rSensorName)
Definition: Mapper.cpp:380
karto::ScanManager::ClearLastScan
void ClearLastScan()
Definition: Mapper.cpp:113
karto::LookupArray
Definition: Karto.h:6747
karto::LaserRangeFinder::GetRangeThreshold
kt_double GetRangeThreshold() const
Definition: Karto.h:3985
karto::MapperGraph::FindPossibleLoopClosure
LocalizedRangeScanVector FindPossibleLoopClosure(LocalizedRangeScan *pScan, const Name &rSensorName, kt_int32u &rStartNum)
Definition: Mapper.cpp:1989
karto::LocalizedRangeScan::SetOdometricPose
void SetOdometricPose(const Pose2 &rPose)
Definition: Karto.h:5549
karto::Mapper::HasMovedEnough
kt_bool HasMovedEnough(LocalizedRangeScan *pScan, LocalizedRangeScan *pLastScan) const
Definition: Mapper.cpp:3188
karto::MapperGraph::GetClosestScanToPose
LocalizedRangeScan * GetClosestScanToPose(const LocalizedRangeScanVector &rScans, const Pose2 &rPose) const
Definition: Mapper.cpp:1610
karto::Vector2::GetX
const T & GetX() const
Definition: Karto.h:1028
karto::ScanManager::~ScanManager
virtual ~ScanManager()
Definition: Mapper.cpp:76
karto::BreadthFirstTraversal::BreadthFirstTraversal
BreadthFirstTraversal(Graph< T > *pGraph)
Definition: Mapper.cpp:1257
karto::Mapper::LoadFromFile
void LoadFromFile(const std::string &filename)
Definition: Mapper.cpp:2679
karto::MapperGraph::AddEdges
void AddEdges(LocalizedRangeScan *pScan, const Matrix3 &rCovariance)
Definition: Mapper.cpp:1473
karto::LocalizedRangeScan
Definition: Karto.h:5505
BOOST_CLASS_EXPORT
BOOST_CLASS_EXPORT(karto::MapperGraph)
karto::BreadthFirstTraversal::BreadthFirstTraversal
BreadthFirstTraversal()
Definition: Mapper.cpp:1254
karto::ScanManager::RemoveScan
void RemoveScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:203
karto::ScanManager::AddScan
void AddScan(LocalizedRangeScan *pScan, kt_int32s uniqueId)
Definition: Mapper.cpp:86
karto::MapperSensorManager::GetRunningScans
LocalizedRangeScanVector & GetRunningScans(const Name &rSensorName)
Definition: Mapper.cpp:390
karto::Mapper::getParamCoarseSearchAngleOffset
double getParamCoarseSearchAngleOffset()
Definition: Mapper.cpp:2459
karto::LookupArray::GetArrayPointer
kt_int32s * GetArrayPointer()
Definition: Karto.h:6838
karto::Mapper::Process
virtual kt_bool Process(LocalizedRangeScan *pScan, Matrix3 *covariance=nullptr)
Definition: Mapper.cpp:2719
karto::NearScanVisitor::NearScanVisitor
NearScanVisitor(LocalizedRangeScan *pScan, kt_double maxDistance, kt_bool useScanBarycenter)
Definition: Mapper.cpp:1347
karto::MapperSensorManager::m_Scans
std::map< int, LocalizedRangeScan * > m_Scans
Definition: Mapper.h:1753
karto::MapperLoopClosureListener::EndLoopClosure
virtual void EndLoopClosure(const std::string &)
Definition: Mapper.h:96
karto::LocalizedRangeScan::GetPointReadings
const PointVectorDouble & GetPointReadings(kt_bool wantFiltered=false) const
Definition: Karto.h:5710
karto::ScanMatcher::m_pSearchSpaceProbs
Grid< kt_double > * m_pSearchSpaceProbs
Definition: Mapper.h:1477
karto::BreadthFirstTraversal
Definition: Mapper.cpp:1248
karto::Mapper::m_pScanBufferMaximumScanDistance
Parameter< kt_double > * m_pScanBufferMaximumScanDistance
Definition: Mapper.h:2220
karto::NearScanVisitor::m_MaxDistanceSquared
kt_double m_MaxDistanceSquared
Definition: Mapper.cpp:1373
karto::Mapper::m_pMinimumTimeInterval
Parameter< kt_double > * m_pMinimumTimeInterval
Definition: Mapper.h:2183
kt_int32s
int32_t kt_int32s
Definition: Types.h:51
karto::NearPoseVisitor::access
friend class boost::serialization::access
Definition: Mapper.cpp:1414
karto::ScanMatcher::m_searchAngleResolution
kt_double m_searchAngleResolution
Definition: Mapper.h:1485
karto::math::Maximum
const T & Maximum(const T &value1, const T &value2)
Definition: Math.h:111
karto::LocalizedRangeScan::SetSensorPose
void SetSensorPose(const Pose2 &rScanPose)
Definition: Karto.h:5648
karto::Mapper::setParamScanBufferSize
void setParamScanBufferSize(int i)
Definition: Mapper.cpp:2511
karto::Graph< LocalizedRangeScan >::VertexMap
std::map< Name, std::map< int, Vertex< LocalizedRangeScan > * > > VertexMap
Definition: Mapper.h:567
karto::Matrix3::SetToIdentity
void SetToIdentity()
Definition: Karto.h:2467
karto::Mapper::setParamLoopSearchSpaceDimension
void setParamLoopSearchSpaceDimension(double d)
Definition: Mapper.cpp:2579
karto::ScanManager::GetRunningScans
LocalizedRangeScanVector & GetRunningScans()
Definition: Mapper.cpp:140
karto::ScanManager::ClearRunningScans
void ClearRunningScans()
Definition: Mapper.cpp:220
karto::Mapper::getParamLoopMatchMinimumResponseFine
double getParamLoopMatchMinimumResponseFine()
Definition: Mapper.cpp:2403
karto::SensorData::SetUniqueId
void SetUniqueId(kt_int32u uniqueId)
Definition: Karto.h:5172
karto::MapperSensorManager::GetAllScans
LocalizedRangeScanVector GetAllScans()
Definition: Mapper.cpp:430
karto::Matrix3
Definition: Karto.h:2444
karto::Mapper::setParamAngleVariancePenalty
void setParamAngleVariancePenalty(double d)
Definition: Mapper.cpp:2601
karto::ScanSolver::IdPoseVector
std::vector< std::pair< kt_int32s, Pose2 > > IdPoseVector
Definition: Mapper.h:953
karto::Mapper::getParamMinimumTravelDistance
double getParamMinimumTravelDistance()
Definition: Mapper.cpp:2348
karto::Grid< kt_double >
karto::NearPoseVisitor
Definition: Mapper.cpp:1390
karto::NearPoseVisitor::m_CenterPose
Pose2 m_CenterPose
Definition: Mapper.cpp:1411
karto::MapperGraph::GetVertex
Vertex< LocalizedRangeScan > * GetVertex(LocalizedRangeScan *pScan)
Definition: Mapper.h:823
karto::ScanMatcher::m_nAngles
kt_int32u m_nAngles
Definition: Mapper.h:1484
karto::Mapper::getParamUseResponseExpansion
bool getParamUseResponseExpansion()
Definition: Mapper.cpp:2479
karto::LocalizedRangeScan::GetSensorAt
Pose2 GetSensorAt(const Pose2 &rPose) const
Definition: Karto.h:5660
karto::ScanManager::access
friend class boost::serialization::access
Definition: Mapper.cpp:235
karto::MapperLoopClosureListener::LoopClosureCheck
virtual void LoopClosureCheck(const std::string &)
Definition: Mapper.h:86
karto::Matrix3::Inverse
Matrix3 Inverse() const
Definition: Karto.h:2545
karto::MapperSensorManager
Definition: Mapper.h:1539
karto::Mapper::ProcessAgainstNode
kt_bool ProcessAgainstNode(LocalizedRangeScan *pScan, const int &nodeId, Matrix3 *covariance=nullptr)
Definition: Mapper.cpp:3096
karto::Mapper::Reset
virtual void Reset()
Definition: Mapper.cpp:2689
karto::Mapper::setParamCorrelationSearchSpaceSmearDeviation
void setParamCorrelationSearchSpaceSmearDeviation(double d)
Definition: Mapper.cpp:2572
karto::Vertex::GetObject
T * GetObject() const
Definition: Mapper.h:319
karto::Grid::GetCoordinateConverter
CoordinateConverter * GetCoordinateConverter() const
Definition: Karto.h:4917
karto::Grid::CreateGrid
static Grid * CreateGrid(kt_int32s width, kt_int32s height, kt_double resolution)
Definition: Karto.h:4655
karto::math::RadiansToDegrees
kt_double RadiansToDegrees(kt_double radians)
Definition: Math.h:66
karto::Mapper::m_pLoopMatchMaximumVarianceCoarse
Parameter< kt_double > * m_pLoopMatchMaximumVarianceCoarse
Definition: Mapper.h:2261
nanoflann::KDTreeSingleIndexAdaptorParams
Definition: nanoflann.hpp:546
karto::MapperGraph::m_pTraversal
GraphTraversal< LocalizedRangeScan > * m_pTraversal
Definition: Mapper.h:919
karto::MapperGraph::UpdateLoopScanMatcher
void UpdateLoopScanMatcher(kt_double rangeThreshold)
Definition: Mapper.cpp:2066
karto::MapperListener
Definition: Mapper.h:46
karto::LinkInfo
Definition: Mapper.h:141
karto::ScanManager::GetRunningScanBufferSize
kt_int32u & GetRunningScanBufferSize()
Definition: Mapper.cpp:149
karto::ScanMatcher::m_searchAngleOffset
kt_double m_searchAngleOffset
Definition: Mapper.h:1483
karto::math::NormalizeAngle
kt_double NormalizeAngle(kt_double angle)
Definition: Math.h:182
karto::ScanMatcher::ComputeAngularCovariance
void ComputeAngularCovariance(const Pose2 &rBestPose, kt_double bestResponse, const Pose2 &rSearchCenter, kt_double searchAngleOffset, kt_double searchAngleResolution, Matrix3 &rCovariance)
Definition: Mapper.cpp:999
karto::Mapper::GetAllProcessedScans
virtual const LocalizedRangeScanVector GetAllProcessedScans() const
Definition: Mapper.cpp:3227
nanoflann::KDTreeSingleIndexAdaptor
Definition: nanoflann.hpp:1116
karto::SensorData::GetStateId
kt_int32s GetStateId() const
Definition: Karto.h:5145
karto::Mapper::setParamLoopSearchSpaceResolution
void setParamLoopSearchSpaceResolution(double d)
Definition: Mapper.cpp:2584
karto::MapperGraph
Definition: Mapper.h:713
karto::MapperSensorManager::SetRunningScanBufferMaximumDistance
void SetRunningScanBufferMaximumDistance(kt_double rScanBufferMaxDistance)
Definition: Mapper.cpp:416
karto::Mapper::SetScanSolver
void SetScanSolver(ScanSolver *pSolver)
Definition: Mapper.cpp:3321
karto::Vector2::GetY
const T & GetY() const
Definition: Karto.h:1046
karto::ScanMatcher::m_pCorrelationGrid
CorrelationGrid * m_pCorrelationGrid
Definition: Mapper.h:1476
karto::MapperSensorManager::m_ScanManagers
ScanManagerMap m_ScanManagers
Definition: Mapper.h:1746
karto::Mapper::getParamLoopSearchSpaceDimension
double getParamLoopSearchSpaceDimension()
Definition: Mapper.cpp:2427
karto::Mapper::m_pMapperSensorManager
MapperSensorManager * m_pMapperSensorManager
Definition: Mapper.h:2148
karto::Grid::GetDataPointer
T * GetDataPointer(const Vector2< kt_int32s > &rGrid)
Definition: Karto.h:4822
karto::ScanMatcher::ComputePositionalCovariance
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)
Definition: Mapper.cpp:893
karto::Mapper::getParamLoopSearchMaximumDistance
double getParamLoopSearchMaximumDistance()
Definition: Mapper.cpp:2378
karto::Graph< LocalizedRangeScan >::m_Vertices
VertexMap m_Vertices
Definition: Mapper.h:683
karto::MapperLoopClosureListener
Definition: Mapper.h:80
karto::LocalizedRangeScanVector
std::vector< LocalizedRangeScan * > LocalizedRangeScanVector
Definition: Karto.h:5879
karto::MapperSensorManager::GetSensorNames
std::vector< Name > GetSensorNames()
Definition: Mapper.h:1585
karto::Parameter< kt_bool >
karto::ScanManager::ScanManager
ScanManager()
Definition: Mapper.cpp:71
karto::Grid::GetResolution
kt_double GetResolution() const
Definition: Karto.h:4926
karto::CorrelationGrid::CreateGrid
static CorrelationGrid * CreateGrid(kt_int32s width, kt_int32s height, kt_double resolution, kt_double smearDeviation)
Definition: Mapper.h:1088
karto::Mapper::setParamUseScanBarycenter
void setParamUseScanBarycenter(bool b)
Definition: Mapper.cpp:2491
karto::ScanMatcher::FindValidPoints
PointVectorDouble FindValidPoints(LocalizedRangeScan *pScan, const Vector2< kt_double > &rViewPoint) const
Definition: Mapper.cpp:1140
karto::Mapper::m_pMinimumTravelDistance
Parameter< kt_double > * m_pMinimumTravelDistance
Definition: Mapper.h:2193
karto::NearScanVisitor::m_UseScanBarycenter
kt_bool m_UseScanBarycenter
Definition: Mapper.cpp:1374
ANGLE_PENALTY_GAIN
#define ANGLE_PENALTY_GAIN
Definition: Mapper.cpp:48
karto::Mapper::getScanSolver
ScanSolver * getScanSolver()
Definition: Mapper.cpp:3326
karto::ScanManager::m_pLastScan
LocalizedRangeScan * m_pLastScan
Definition: Mapper.cpp:250
karto::Graph< LocalizedRangeScan >::GetVertices
const VertexMap & GetVertices() const
Definition: Mapper.h:674
karto::ScanSolver::RemoveNode
virtual void RemoveNode(kt_int32s)
Definition: Mapper.h:991
karto::Vertex::GetAdjacentVertices
std::vector< Vertex< T > * > GetAdjacentVertices() const
Definition: Mapper.h:336
nanoflann::SearchParams
Definition: nanoflann.hpp:554
karto::Mapper::Mapper
Mapper()
Definition: Mapper.cpp:2085
karto::Mapper::GetSequentialScanMatcher
virtual ScanMatcher * GetSequentialScanMatcher() const
Definition: Mapper.cpp:3336
karto::Mapper::m_Deserialized
kt_bool m_Deserialized
Definition: Mapper.h:2144
karto::Mapper::getParamScanBufferSize
int getParamScanBufferSize()
Definition: Mapper.cpp:2358
karto::NearPoseVisitor::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: Mapper.cpp:1416
karto::Mapper::m_pLoopSearchSpaceDimension
Parameter< kt_double > * m_pLoopSearchSpaceDimension
Definition: Mapper.h:2304
karto::SensorData::SetStateId
void SetStateId(kt_int32s stateId)
Definition: Karto.h:5154
karto::LaserRangeScan::GetNumberOfRangeReadings
kt_int32u GetNumberOfRangeReadings() const
Definition: Karto.h:5406
karto::GraphTraversal
Definition: Mapper.h:521
karto::Graph::RemoveEdge
void RemoveEdge(const int &idx)
Definition: Mapper.h:629
karto::Graph::AddEdge
void AddEdge(Edge< T > *pEdge)
Definition: Mapper.h:620
karto::MapperSensorManager::m_RunningBufferMaximumSize
kt_int32u m_RunningBufferMaximumSize
Definition: Mapper.h:1748
karto::Mapper::getParamUseScanBarycenter
bool getParamUseScanBarycenter()
Definition: Mapper.cpp:2338
karto::Mapper::m_pLinkScanMaximumDistance
Parameter< kt_double > * m_pLinkScanMaximumDistance
Definition: Mapper.h:2233
d
d
karto::LocalizedRangeScan::SetCorrectedPose
void SetCorrectedPose(const Pose2 &rPose)
Definition: Karto.h:5571
karto::GridIndexLookup::GetLookupArray
const LookupArray * GetLookupArray(kt_int32u index) const
Definition: Karto.h:6922
karto::ScanManager::SetLastScan
void SetLastScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:122
karto::Grid::GetWidth
kt_int32s GetWidth() const
Definition: Karto.h:4843
karto::Mapper::m_pLoopMatchMinimumChainSize
Parameter< kt_int32u > * m_pLoopMatchMinimumChainSize
Definition: Mapper.h:2254
karto::MapperGraph::FindNearByScans
LocalizedRangeScanVector FindNearByScans(Name name, const Pose2 refPose, kt_double maxDistance)
Definition: Mapper.cpp:1853
karto::LocalizedRangeScan::GetCorrectedPose
const Pose2 & GetCorrectedPose() const
Definition: Karto.h:5562
karto::Mapper::getParamFineSearchAngleOffset
double getParamFineSearchAngleOffset()
Definition: Mapper.cpp:2454
karto::Mapper::m_pLoopSearchSpaceSmearDeviation
Parameter< kt_double > * m_pLoopSearchSpaceSmearDeviation
Definition: Mapper.h:2316
karto::LocalizedRangeScan::SetCorrectedPoseAndUpdate
void SetCorrectedPoseAndUpdate(const Pose2 &rPose)
Definition: Karto.h:5582
karto::Rectangle2::GetHeight
T GetHeight() const
Definition: Karto.h:1925
karto::ScanMatcher::m_pPoseResponse
std::pair< kt_double, Pose2 > * m_pPoseResponse
Definition: Mapper.h:1479
karto::NearPoseVisitor::m_UseScanBarycenter
kt_bool m_UseScanBarycenter
Definition: Mapper.cpp:1413
karto::Mapper::m_pGraph
MapperGraph * m_pGraph
Definition: Mapper.h:2150
karto::ScanManager
Definition: Mapper.cpp:57
karto::Mapper::getParamLoopSearchSpaceSmearDeviation
double getParamLoopSearchSpaceSmearDeviation()
Definition: Mapper.cpp:2437
kt_bool
bool kt_bool
Definition: Types.h:64
karto::MapperGraph::LinkNearChains
void LinkNearChains(LocalizedRangeScan *pScan, Pose2Vector &rMeans, std::vector< Matrix3 > &rCovariances)
Definition: Mapper.cpp:1684
karto::Mapper::RemoveListener
void RemoveListener(MapperListener *pListener)
Definition: Mapper.cpp:3252
karto::ScanManager::SetRunningScanBufferSize
void SetRunningScanBufferSize(const kt_int32u &rScanBufferSize)
Definition: Mapper.cpp:158
karto::Mapper::m_pFineSearchAngleOffset
Parameter< kt_double > * m_pFineSearchAngleOffset
Definition: Mapper.h:2328
karto::ScanMatcher::m_xPoses
std::vector< kt_double > m_xPoses
Definition: Mapper.h:1480
karto::MapperGraph::FindNearLinkedScans
LocalizedRangeScanVector FindNearLinkedScans(LocalizedRangeScan *pScan, kt_double maxDistance)
Definition: Mapper.cpp:1835
karto::CoordinateConverter::SetOffset
void SetOffset(const Vector2< kt_double > &rOffset)
Definition: Karto.h:4559
karto::Mapper::setParamLoopSearchSpaceSmearDeviation
void setParamLoopSearchSpaceSmearDeviation(double d)
Definition: Mapper.cpp:2589
karto::Mapper::AddScanToLocalizationBuffer
void AddScanToLocalizationBuffer(LocalizedRangeScan *pScan, Vertex< LocalizedRangeScan > *scan_vertex)
Definition: Mapper.cpp:2974
karto::MapperSensorManager::ClearLastScan
void ClearLastScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:321
karto::MapperGraph::FindNearByVertices
std::vector< Vertex< LocalizedRangeScan > * > FindNearByVertices(Name name, const Pose2 refPose, kt_double maxDistance)
Definition: Mapper.cpp:1865
karto::MapperSensorManager::AddScan
void AddScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:339
karto::Mapper::setParamMinimumTimeInterval
void setParamMinimumTimeInterval(double d)
Definition: Mapper.cpp:2496
karto::ScanMatcher::m_yPoses
std::vector< kt_double > m_yPoses
Definition: Mapper.h:1481
karto::MapperSensorManager::ScanManagerMap
std::map< Name, ScanManager * > ScanManagerMap
Definition: Mapper.h:1541
karto::Graph::GetEdges
const std::vector< Edge< T > * > & GetEdges() const
Definition: Mapper.h:665
karto::math::InRange
kt_bool InRange(const T &value, const T &a, const T &b)
Definition: Math.h:172
karto::MapperSensorManager::m_NextScanId
kt_int32s m_NextScanId
Definition: Mapper.h:1751
karto::PointVectorDouble
std::vector< Vector2< kt_double > > PointVectorDouble
Definition: Karto.h:1283
karto::Mapper::setParamCoarseSearchAngleOffset
void setParamCoarseSearchAngleOffset(double d)
Definition: Mapper.cpp:2611
karto::LaserRangeFinder::Validate
virtual kt_bool Validate()
Definition: Karto.h:4152
karto::Mapper::ClearLocalizationBuffer
void ClearLocalizationBuffer()
Definition: Mapper.cpp:3003
karto::LocalizationScanVertex::vertex
Vertex< LocalizedRangeScan > * vertex
Definition: Mapper.h:1923
karto::Vector2< kt_double >
karto::Mapper::getParamUseScanMatching
bool getParamUseScanMatching()
Definition: Mapper.cpp:2333
karto::LookupArray::GetSize
kt_int32u GetSize() const
Definition: Karto.h:6784
karto::ScanSolver::GetCorrections
virtual const IdPoseVector & GetCorrections() const =0
karto::Mapper::m_pLinkMatchMinimumResponseFine
Parameter< kt_double > * m_pLinkMatchMinimumResponseFine
Definition: Mapper.h:2226
karto::Mapper::getParamDistanceVariancePenalty
double getParamDistanceVariancePenalty()
Definition: Mapper.cpp:2444
karto::MapperLoopClosureListener::BeginLoopClosure
virtual void BeginLoopClosure(const std::string &)
Definition: Mapper.h:91
karto::Mapper::m_pSequentialScanMatcher
ScanMatcher * m_pSequentialScanMatcher
Definition: Mapper.h:2146
karto::math::DoubleEqual
kt_bool DoubleEqual(kt_double a, kt_double b)
Definition: Math.h:135
karto::ScanManager::GetScans
LocalizedRangeScanMap & GetScans()
Definition: Mapper.cpp:131
karto::Mapper::setParamLoopMatchMinimumResponseCoarse
void setParamLoopMatchMinimumResponseCoarse(double d)
Definition: Mapper.cpp:2551
karto::Vector2::SetX
void SetX(const T &x)
Definition: Karto.h:1037
karto::CorrelationGrid::GetROI
const Rectangle2< kt_int32s > & GetROI() const
Definition: Mapper.h:1121
karto::ScanMatcher::ScanMatcher
ScanMatcher()
Definition: Mapper.h:1317
karto::Object::GetParameterManager
virtual ParameterManager * GetParameterManager()
Definition: Karto.h:679
karto::Mapper::m_pCorrelationSearchSpaceResolution
Parameter< kt_double > * m_pCorrelationSearchSpaceResolution
Definition: Mapper.h:2288
karto::Mapper::ProcessLocalization
kt_bool ProcessLocalization(LocalizedRangeScan *pScan, Matrix3 *covariance=nullptr)
Definition: Mapper.cpp:2887
karto::Grid::GetDataSize
kt_int32s GetDataSize() const
Definition: Karto.h:4897
karto::NearScanVisitor::access
friend class boost::serialization::access
Definition: Mapper.cpp:1375
karto::Mapper::setParamLoopMatchMinimumChainSize
void setParamLoopMatchMinimumChainSize(int i)
Definition: Mapper.cpp:2541
karto::Mapper::m_pCoarseSearchAngleOffset
Parameter< kt_double > * m_pCoarseSearchAngleOffset
Definition: Mapper.h:2329
karto::Edge::GetTarget
Vertex< T > * GetTarget() const
Definition: Mapper.h:448
karto::MapperGraph::AddVertex
Vertex< LocalizedRangeScan > * AddVertex(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:1455
karto::ScanManager::m_RunningScans
LocalizedRangeScanVector m_RunningScans
Definition: Mapper.cpp:249
karto::Mapper::m_pMinimumAnglePenalty
Parameter< kt_double > * m_pMinimumAnglePenalty
Definition: Mapper.h:2336
karto::BreadthFirstTraversal::TraverseForScans
virtual std::vector< T * > TraverseForScans(Vertex< T > *pStartVertex, Visitor< T > *pVisitor)
Definition: Mapper.cpp:1276
karto::Transform
Definition: Karto.h:2976
karto::MapperSensorManager::RemoveScan
void RemoveScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:359
karto::Mapper::RemoveNodeFromGraph
kt_bool RemoveNodeFromGraph(Vertex< LocalizedRangeScan > *)
Definition: Mapper.cpp:3030
karto::ScanMatcher::AddScan
void AddScan(LocalizedRangeScan *pScan, const Vector2< kt_double > &rViewPoint, kt_bool doSmear=true)
Definition: Mapper.cpp:1100
karto::SensorData::GetUniqueId
kt_int32s GetUniqueId() const
Definition: Karto.h:5163
karto::Edge::SetLabel
void SetLabel(EdgeLabel *pLabel)
Definition: Mapper.h:466
karto::MapperGraph::CorrectPoses
void CorrectPoses()
Definition: Mapper.cpp:2044
karto::Mapper::m_pScanBufferSize
Parameter< kt_int32u > * m_pScanBufferSize
Definition: Mapper.h:2213
karto::MapperDebugListener::Debug
virtual void Debug(const std::string &)
Definition: Mapper.h:69
karto::Mapper::setParamLinkScanMaximumDistance
void setParamLinkScanMaximumDistance(double d)
Definition: Mapper.cpp:2526
karto::ScanMatcher::operator()
void operator()(const kt_double &y) const
Definition: Mapper.cpp:649
karto::ScanMatcher::MatchScan
kt_double MatchScan(LocalizedRangeScan *pScan, const T &rBaseScans, Pose2 &rMean, Matrix3 &rCovariance, kt_bool doPenalize=true, kt_bool doRefineMatch=true)
Definition: Mapper.cpp:544
karto::ScanMatcher::m_pMapper
Mapper * m_pMapper
Definition: Mapper.h:1475
karto::ScanManager::m_Scans
LocalizedRangeScanMap m_Scans
Definition: Mapper.cpp:248
karto::Mapper::setParamLoopMatchMaximumVarianceCoarse
void setParamLoopMatchMaximumVarianceCoarse(double d)
Definition: Mapper.cpp:2546
karto::Mapper::m_pCoarseAngleResolution
Parameter< kt_double > * m_pCoarseAngleResolution
Definition: Mapper.h:2332
karto::Mapper::setParamMinimumTravelHeading
void setParamMinimumTravelHeading(double d)
Definition: Mapper.cpp:2506
karto::ScanMatcher::m_doPenalize
kt_bool m_doPenalize
Definition: Mapper.h:1486
karto::LocalizationScanVertex
Definition: Mapper.h:1918
karto::ScanMatcher::~ScanMatcher
virtual ~ScanMatcher()
Definition: Mapper.cpp:468
karto::Mapper::setParamDistanceVariancePenalty
void setParamDistanceVariancePenalty(double d)
Definition: Mapper.cpp:2596
karto::MapperSensorManager::GetLastScan
LocalizedRangeScan * GetLastScan(const Name &rSensorName)
Definition: Mapper.cpp:301
karto::math::Square
T Square(T value)
Definition: Math.h:77
karto::Mapper::getParamLoopMatchMaximumVarianceCoarse
double getParamLoopMatchMaximumVarianceCoarse()
Definition: Mapper.cpp:2393
kt_int32u
uint32_t kt_int32u
Definition: Types.h:52
karto::Pose2::GetX
kt_double GetX() const
Definition: Karto.h:2099
karto::Rectangle2::GetWidth
T GetWidth() const
Definition: Karto.h:1907
karto::Mapper::m_pUseScanBarycenter
Parameter< kt_bool > * m_pUseScanBarycenter
Definition: Mapper.h:2170
karto::ScanManager::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: Mapper.cpp:237
karto::Mapper::m_pUseScanMatching
Parameter< kt_bool > * m_pUseScanMatching
Definition: Mapper.h:2165
karto::Mapper::ProcessAgainstNodesNearBy
kt_bool ProcessAgainstNodesNearBy(LocalizedRangeScan *pScan, kt_bool addScanToLocalizationBuffer=false, Matrix3 *covariance=nullptr)
Definition: Mapper.cpp:2799
karto::Mapper::m_pLoopMatchMinimumResponseCoarse
Parameter< kt_double > * m_pLoopMatchMinimumResponseCoarse
Definition: Mapper.h:2267
karto::MapperGraph::FindNearByScan
Vertex< LocalizedRangeScan > * FindNearByScan(Name name, const Pose2 refPose)
Definition: Mapper.cpp:1904
karto::Mapper::getParamMinimumAnglePenalty
double getParamMinimumAnglePenalty()
Definition: Mapper.cpp:2469
karto::MapperSensorManager::AddRunningScan
void AddRunningScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:350
karto::Grid::Clear
void Clear()
Definition: Karto.h:4683
karto::CorrelationGrid::SmearPoint
void SmearPoint(const Vector2< kt_int32s > &rGridPoint)
Definition: Mapper.h:1139
karto::Vertex< karto::LocalizedRangeScan >
karto::Pose2::SetHeading
void SetHeading(kt_double heading)
Definition: Karto.h:2162
karto::Mapper::m_pDistanceVariancePenalty
Parameter< kt_double > * m_pDistanceVariancePenalty
Definition: Mapper.h:2324
karto::ScanManager::m_NextStateId
kt_int32u m_NextStateId
Definition: Mapper.cpp:251
karto::Mapper::m_pCorrelationSearchSpaceSmearDeviation
Parameter< kt_double > * m_pCorrelationSearchSpaceSmearDeviation
Definition: Mapper.h:2294
karto::Mapper::getParamLinkScanMaximumDistance
double getParamLinkScanMaximumDistance()
Definition: Mapper.cpp:2373
karto::Mapper::getParamCorrelationSearchSpaceSmearDeviation
double getParamCorrelationSearchSpaceSmearDeviation()
Definition: Mapper.cpp:2420
karto::GridIndexLookup< kt_int8u >
karto::Vector2::SetY
void SetY(const T &y)
Definition: Karto.h:1055
karto::Mapper::m_pLoopMatchMinimumResponseFine
Parameter< kt_double > * m_pLoopMatchMinimumResponseFine
Definition: Mapper.h:2273
karto::Mapper::setParamUseResponseExpansion
void setParamUseResponseExpansion(bool b)
Definition: Mapper.cpp:2631
karto::Mapper::m_pMinimumTravelHeading
Parameter< kt_double > * m_pMinimumTravelHeading
Definition: Mapper.h:2203
karto::ScanManager::SetRunningScanBufferMaximumDistance
void SetRunningScanBufferMaximumDistance(const kt_int32u &rScanBufferMaxDistance)
Definition: Mapper.cpp:167
karto::MapperGraph::FindNearChains
std::vector< LocalizedRangeScanVector > FindNearChains(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:1724
karto::MapperSensorManager::ClearRunningScans
void ClearRunningScans(const Name &rSensorName)
Definition: Mapper.cpp:395
karto::MapperSensorManager::m_RunningBufferMaximumDistance
kt_double m_RunningBufferMaximumDistance
Definition: Mapper.h:1749
karto::MapperGraph::ComputeWeightedMean
Pose2 ComputeWeightedMean(const Pose2Vector &rMeans, const std::vector< Matrix3 > &rCovariances) const
Definition: Mapper.cpp:1945
karto::Mapper::setParamMinimumDistancePenalty
void setParamMinimumDistancePenalty(double d)
Definition: Mapper.cpp:2626
karto::Mapper::AddListener
void AddListener(MapperListener *pListener)
Definition: Mapper.cpp:3243
process_constraints.filename
filename
Definition: process_constraints.py:114
Mapper.h
karto::Mapper::getParamDoLoopClosing
bool getParamDoLoopClosing()
Definition: Mapper.cpp:2383
karto::math::NormalizeAngleDifference
kt_double NormalizeAngleDifference(kt_double minuend, kt_double subtrahend)
Definition: Math.h:221
forEach
#define forEach(listtype, list)
Definition: Macros.h:66
inverse
TFSIMD_FORCE_INLINE Quaternion inverse(const Quaternion &q)
karto::Pose2
Definition: Karto.h:2046
karto::SensorData::SetTime
void SetTime(kt_double time)
Definition: Karto.h:5190
karto::ScanManager::m_RunningBufferMaximumDistance
kt_double m_RunningBufferMaximumDistance
Definition: Mapper.cpp:254
karto::BreadthFirstTraversal::access
friend class boost::serialization::access
Definition: Mapper.cpp:1332
karto::Mapper::setParamUseScanMatching
void setParamUseScanMatching(bool b)
Definition: Mapper.cpp:2486
karto::Object
Definition: Karto.h:634
karto::Mapper::MapperGraph
friend class MapperGraph
Definition: Mapper.h:1930
karto::Mapper::m_pMinimumDistancePenalty
Parameter< kt_double > * m_pMinimumDistancePenalty
Definition: Mapper.h:2337
karto::ScanMatcher::Create
static ScanMatcher * Create(Mapper *pMapper, kt_double searchSize, kt_double resolution, kt_double smearDeviation, kt_double rangeThreshold)
Definition: Mapper.cpp:485
karto::Graph::AddVertex
void AddVertex(const Name &rName, Vertex< T > *pVertex)
Definition: Mapper.h:591
karto::Mapper::m_Initialized
kt_bool m_Initialized
Definition: Mapper.h:2143
karto::Vector2::SquaredLength
kt_double SquaredLength() const
Definition: Karto.h:1084
karto::Mapper::getParamAngleVariancePenalty
double getParamAngleVariancePenalty()
Definition: Mapper.cpp:2449
karto::Mapper::setParamCorrelationSearchSpaceDimension
void setParamCorrelationSearchSpaceDimension(double d)
Definition: Mapper.cpp:2562
karto::EdgeLabel
Definition: Mapper.h:111
karto::Mapper::m_pLoopSearchSpaceResolution
Parameter< kt_double > * m_pLoopSearchSpaceResolution
Definition: Mapper.h:2310
karto::ScanMatcher
Definition: Mapper.h:1314
karto::math::IsUpTo
kt_bool IsUpTo(const T &value, const T &maximum)
Definition: Math.h:147
karto::Mapper::~Mapper
virtual ~Mapper()
Definition: Mapper.cpp:2115
karto::ScanManager::AddRunningScan
void AddRunningScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:176
karto::GridStates_Occupied
@ GridStates_Occupied
Definition: Karto.h:4447
karto::NearScanVisitor::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: Mapper.cpp:1377
assert.h
karto::CorrelationGrid
Definition: Mapper.h:1061
karto::MapperSensorManager::SetLastScan
void SetLastScan(LocalizedRangeScan *pScan)
Definition: Mapper.cpp:312
karto::Mapper::Initialize
void Initialize(kt_double rangeThreshold)
Definition: Mapper.cpp:2638
karto::Mapper::m_pScanOptimizer
ScanSolver * m_pScanOptimizer
Definition: Mapper.h:2151
karto::MapperGraph::m_pLoopScanMatcher
ScanMatcher * m_pLoopScanMatcher
Definition: Mapper.h:914
karto::Mapper::FireInfo
void FireInfo(const std::string &rInfo) const
Definition: Mapper.cpp:3261
kt_int8u
uint8_t kt_int8u
Definition: Types.h:46
karto::Mapper::FireBeginLoopClosure
void FireBeginLoopClosure(const std::string &rInfo) const
Definition: Mapper.cpp:3295
karto::Mapper::setParamCorrelationSearchSpaceResolution
void setParamCorrelationSearchSpaceResolution(double d)
Definition: Mapper.cpp:2567
karto::Grid::WorldToGrid
Vector2< kt_int32s > WorldToGrid(const Vector2< kt_double > &rWorld, kt_bool flipY=false) const
Definition: Karto.h:4801
karto::NearPoseVisitor::m_MaxDistanceSquared
kt_double m_MaxDistanceSquared
Definition: Mapper.cpp:1412
karto::Mapper::setParamFineSearchAngleOffset
void setParamFineSearchAngleOffset(double d)
Definition: Mapper.cpp:2606
karto::MapperSensorManager::GetRunningScanBufferSize
kt_int32u GetRunningScanBufferSize(const Name &rSensorName)
Definition: Mapper.cpp:401
karto::Mapper::m_LocalizationScanVertices
LocalizationScanVertices m_LocalizationScanVertices
Definition: Mapper.h:2152
karto::Mapper::m_Listeners
std::vector< MapperListener * > m_Listeners
Definition: Mapper.h:2155
karto::ScanSolver::Clear
virtual void Clear()
Definition: Mapper.h:1012
karto::NearScanVisitor::Visit
virtual kt_bool Visit(Vertex< LocalizedRangeScan > *pVertex)
Definition: Mapper.cpp:1354
karto::INVALID_SCAN
const kt_int32s INVALID_SCAN
Definition: Math.h:47
karto::Mapper::setParamLoopSearchMaximumDistance
void setParamLoopSearchMaximumDistance(double d)
Definition: Mapper.cpp:2531
karto::LocalizedRangeScan::GetCorrectedAt
Pose2 GetCorrectedAt(const Pose2 &sPose) const
Computes the pose of the robot if the sensor were at the given pose.
Definition: Karto.h:5670
karto::NearPoseVisitor::NearPoseVisitor
NearPoseVisitor(Pose2 refPose, kt_double maxDistance, kt_bool useScanBarycenter)
Definition: Mapper.cpp:1393
karto::ScanManager::m_RunningBufferMaximumSize
kt_int32u m_RunningBufferMaximumSize
Definition: Mapper.cpp:253
karto::Parameter::GetValue
const T & GetValue() const
Definition: Karto.h:3273
karto::MapperSensorManager::GetScan
LocalizedRangeScan * GetScan(const Name &rSensorName, kt_int32s scanIndex)
Definition: Mapper.cpp:276
karto::MapperSensorManager::RegisterSensor
void RegisterSensor(const Name &rSensorName)
Definition: Mapper.cpp:261
karto::ScanSolver::AddNode
virtual void AddNode(Vertex< LocalizedRangeScan > *)
Definition: Mapper.h:984
karto::MapperSensorManager::GetScanManager
ScanManager * GetScanManager(LocalizedRangeScan *pScan)
Definition: Mapper.h:1711
karto::Mapper::setParamMinimumTravelDistance
void setParamMinimumTravelDistance(double d)
Definition: Mapper.cpp:2501
karto::Mapper::getParamLinkMatchMinimumResponseFine
double getParamLinkMatchMinimumResponseFine()
Definition: Mapper.cpp:2368
karto::Mapper::getParamLoopSearchSpaceResolution
double getParamLoopSearchSpaceResolution()
Definition: Mapper.cpp:2432
karto::Graph::RemoveVertex
void RemoveVertex(const Name &rName, const int &idx)
Definition: Mapper.h:601
karto::Mapper::getParamMinimumDistancePenalty
double getParamMinimumDistancePenalty()
Definition: Mapper.cpp:2474
karto::Mapper::m_pUseResponseExpansion
Parameter< kt_bool > * m_pUseResponseExpansion
Definition: Mapper.h:2340
karto::Vector2::SquaredDistance
kt_double SquaredDistance(const Vector2 &rOther) const
Definition: Karto.h:1102
karto::Edge
Definition: Mapper.h:247
karto::CorrelationGrid::GridIndex
virtual kt_int32s GridIndex(const Vector2< kt_int32s > &rGrid, kt_bool boundaryCheck=true) const
Definition: Mapper.h:1109
karto::ScanMatcher::GetResponse
kt_double GetResponse(kt_int32u angleIndex, kt_int32s gridPositionIndex) const
Definition: Mapper.cpp:1203
karto::Pose2::GetHeading
kt_double GetHeading() const
Definition: Karto.h:2153
karto::MapperSensorManager::Clear
void Clear()
Definition: Mapper.cpp:451
karto::LaserRangeScan::GetRangeReadingsVector
RangeReadingsVector GetRangeReadingsVector() const
Definition: Karto.h:5345
karto::Mapper::setParamLoopMatchMinimumResponseFine
void setParamLoopMatchMinimumResponseFine(double d)
Definition: Mapper.cpp:2556
karto::SensorData::GetTime
kt_double GetTime() const
Definition: Karto.h:5181
karto::LocalizedRangeScanMap
std::map< int, LocalizedRangeScan * > LocalizedRangeScanMap
Definition: Karto.h:5880
karto::MapperGraph::FindNearLinkedVertices
std::vector< Vertex< LocalizedRangeScan > * > FindNearLinkedVertices(LocalizedRangeScan *pScan, kt_double maxDistance)
Definition: Mapper.cpp:1844
karto::Mapper::getParamCorrelationSearchSpaceDimension
double getParamCorrelationSearchSpaceDimension()
Definition: Mapper.cpp:2410
karto
Definition: Karto.h:88
karto::Mapper::m_pCorrelationSearchSpaceDimension
Parameter< kt_double > * m_pCorrelationSearchSpaceDimension
Definition: Mapper.h:2282
karto::BreadthFirstTraversal::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: Mapper.cpp:1334
karto::MapperGraph::AddEdge
Edge< LocalizedRangeScan > * AddEdge(LocalizedRangeScan *pSourceScan, LocalizedRangeScan *pTargetScan, kt_bool &rIsNewEdge)
Definition: Mapper.cpp:1631
karto::Mapper::getParamMinimumTimeInterval
double getParamMinimumTimeInterval()
Definition: Mapper.cpp:2343
karto::NearScanVisitor::m_CenterPose
Pose2 m_CenterPose
Definition: Mapper.cpp:1372
karto::Grid::GetHeight
kt_int32s GetHeight() const
Definition: Karto.h:4852
karto::SensorData::GetSensorName
const Name & GetSensorName() const
Definition: Karto.h:5199
karto::Graph< karto::LocalizedRangeScan >


slam_toolbox
Author(s): Steve Macenski
autogenerated on Thu Jan 11 2024 03:37:55