MapProcContainer.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2011, Stefan Kohlbrecher, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Simulation, Systems Optimization and Robotics
13 // group, TU Darmstadt nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //=================================================================================================
28 
29 #ifndef _hectormapproccontainer_h__
30 #define _hectormapproccontainer_h__
31 
32 #include "../map/GridMap.h"
33 #include "../map/OccGridMapUtilConfig.h"
34 #include "../matcher/ScanMatcher.h"
35 #include "../util/MapLockerInterface.h"
36 
37 class GridMap;
38 class ConcreteOccGridMapUtil;
39 class DataContainer;
40 
41 namespace hectorslam{
42 
44 {
45 public:
47  : gridMap(gridMapIn)
48  , gridMapUtil(gridMapUtilIn)
49  , scanMatcher(scanMatcherIn)
50  , mapMutex(0)
51  {}
52 
54  {}
55 
56  void cleanup()
57  {
58  delete gridMap;
59  delete gridMapUtil;
60  delete scanMatcher;
61 
62  if (mapMutex){
63  delete mapMutex;
64  }
65  }
66 
67  void reset()
68  {
69  gridMap->reset();
70  gridMapUtil->resetCachedData();
71  }
72 
74  {
75  gridMapUtil->resetCachedData();
76  }
77 
78  float getScaleToMap() const { return gridMap->getScaleToMap(); };
79 
80  const GridMap& getGridMap() const { return *gridMap; };
81  GridMap& getGridMap() { return *gridMap; };
82 
83  void addMapMutex(MapLockerInterface* mapMutexIn)
84  {
85  if (mapMutex)
86  {
87  delete mapMutex;
88  }
89 
90  mapMutex = mapMutexIn;
91  }
92 
94  {
95  return mapMutex;
96  }
97 
98  Eigen::Vector3f matchData(const Eigen::Vector3f& beginEstimateWorld, const DataContainer& dataContainer, Eigen::Matrix3f& covMatrix, int maxIterations)
99  {
100  return scanMatcher->matchData(beginEstimateWorld, *gridMapUtil, dataContainer, covMatrix, maxIterations);
101  }
102 
103  void updateByScan(const DataContainer& dataContainer, const Eigen::Vector3f& robotPoseWorld)
104  {
105  if (mapMutex)
106  {
107  mapMutex->lockMap();
108  }
109 
110  gridMap->updateByScan(dataContainer, robotPoseWorld);
111 
112  if (mapMutex)
113  {
114  mapMutex->unlockMap();
115  }
116  }
117 
122 };
123 
124 }
125 
126 #endif
MapProcContainer(GridMap *gridMapIn, OccGridMapUtilConfig< GridMap > *gridMapUtilIn, ScanMatcher< OccGridMapUtilConfig< GridMap > > *scanMatcherIn)
void updateByScan(const DataContainer &dataContainer, const Eigen::Vector3f &robotPoseWorld)
float getScaleToMap() const
Definition: GridMapBase.h:287
DataPointContainer< Eigen::Vector2f > DataContainer
ScanMatcher< OccGridMapUtilConfig< GridMap > > * scanMatcher
void addMapMutex(MapLockerInterface *mapMutexIn)
OccGridMapUtilConfig< GridMap > * gridMapUtil
Eigen::Vector3f matchData(const Eigen::Vector3f &beginEstimateWorld, const DataContainer &dataContainer, Eigen::Matrix3f &covMatrix, int maxIterations)
virtual void lockMap()=0
virtual void reset()
Definition: GridMapBase.h:69
MapLockerInterface * mapMutex
MapLockerInterface * getMapMutex()
void updateByScan(const DataContainer &dataContainer, const Eigen::Vector3f &robotPoseWorld)
const GridMap & getGridMap() const
OccGridMapBase< LogOddsCell, GridMapLogOddsFunctions > GridMap
Definition: GridMap.h:39
virtual void unlockMap()=0


hector_mapping
Author(s): Stefan Kohlbrecher
autogenerated on Sun Nov 3 2019 03:18:33