Go to the documentation of this file.
30 , m_pCellPassCnt(
Grid<
kt_int32u>::CreateGrid(0, 0, resolution))
31 , m_pCellHitsCnt(
Grid<
kt_int32u>::CreateGrid(0, 0, resolution))
32 , m_pCellUpdater(NULL)
38 throw Exception(
"Resolution cannot be 0");
48 OccupancyGrid::~OccupancyGrid()
62 return pOccupancyGrid;
69 throw Exception(
"OccupancyGrid::CreateFromScans - Not supported in Windows. Please Use CreateFromScans(const LocalizedLaserScanList& rScans, kt_double resolution).");
86 if (rScans.
Size() == 0)
97 return pOccupancyGrid;
112 if (pLocalizedLaserScan != NULL)
162 if (range >= maxRange || range < minRange)
167 else if (range >= rangeThreshold)
170 kt_double ratio = rangeThreshold / range;
173 point.
SetX(scanPosition.
GetX() + ratio * dx);
174 point.
SetY(scanPosition.
GetY() + ratio * dy);
177 if (
RayTrace(scanPosition, point, isEndPointValid, doUpdate))
197 kt_double xStop = x + maxRange * cosTheta;
198 kt_double xSteps = 1 + fabs(xStop - x) * scale;
200 kt_double yStop = y + maxRange * sinTheta;
201 kt_double ySteps = 1 + fabs(yStop - y) * scale;
215 distance = (i + 1) * delta;
223 return (distance < maxRange) ? distance : maxRange;
247 pCellPassCntPtr[index]++;
248 pCellHitCntPtr[index]++;
252 (*m_pCellUpdater)(index);
290 for (
kt_int32u i = 0; i < nBytes; i++, pDataPtr++, pCellPassCntPtr++, pCellHitCntPtr++)
292 UpdateCell(pDataPtr, *pCellPassCntPtr, *pCellHitCntPtr);
#define const_forEach(listtype, list)
kt_double Round(kt_double value)
kt_bool IsFree(const Vector2i &rGridIndex) const
kt_double GetMinimumRange() const
const kt_double KT_TOLERANCE
virtual void operator()(kt_int32u index)
kt_double Distance(const Vector2 &rOther) const
void SetSize(const Size2< kt_int32s > &rSize)
virtual kt_size_t Size() const
void Add(const Vector2d &rPoint)
OccupancyGrid * Clone() const
const Vector2d & GetPosition() const
#define karto_const_forEach(listtype, list)
SmartPointer< Parameter< kt_int32u > > m_pMinPassThrough
static OccupancyGrid * CreateFromScans(const LocalizedLaserScanList &rScans, kt_double resolution)
kt_double GetRangeThreshold() const
void SetScale(kt_double scale)
kt_int8u * GetDataPointer()
virtual void Resize(kt_int32s width, kt_int32s height)
SmartPointer< Grid< kt_int32u > > m_pCellPassCnt
const T & Maximum(const T &value1, const T &value2)
kt_double RayCast(const Pose2 &rPose2, kt_double maxRange) const
T * GetDataPointer(const Vector2i &rGrid)
CoordinateConverter * GetCoordinateConverter() const
const Vector2dList & GetPointReadings(kt_bool wantFiltered=false) const
kt_double GetScale() const
SmartPointer< Parameter< kt_double > > m_pOccupancyThreshold
const T GetHeight() const
const Size2< kt_int32s > GetSize() const
virtual void Resize(kt_int32s width, kt_int32s height)
static OccupancyGrid * CreateFromMapper(OpenMapper *pMapper, kt_double resolution)
Size2< kt_double > GetSize() const
kt_bool RayTrace(const Vector2d &rWorldFrom, const Vector2d &rWorldTo, kt_bool isEndPointValid, kt_bool doUpdate=false)
LaserRangeFinder * GetLaserRangeFinder() const
void UpdateCell(kt_int8u *pCell, kt_int32u cellPassCnt, kt_int32u cellHitCnt)
kt_bool AddScan(LocalizedLaserScan *pScan, kt_bool doUpdate=false)
const LocalizedLaserScanList GetAllProcessedScans() const
void SetOffset(const Vector2d &rOffset)
kt_int32s GetWidth() const
Vector2i WorldToGrid(const Vector2d &rWorld, kt_bool flipY=false) const
kt_double GetMaximumRange() const
OccupancyGrid * m_pOccupancyGrid
Vector2< kt_double > Vector2d
kt_bool DoubleEqual(kt_double a, kt_double b)
kt_bool IsValidGridIndex(const Vector2i &rGrid) const
kt_int32s GetDataSize() const
virtual void Add(const T &rValue)
const Vector2d & GetMinimum() const
CellUpdater * m_pCellUpdater
const BoundingBox2 & GetBoundingBox() const
static void ComputeDimensions(const LocalizedLaserScanList &rScans, kt_double resolution, kt_int32s &rWidth, kt_int32s &rHeight, Vector2d &rOffset)
SmartPointer< Grid< kt_int32u > > m_pCellHitsCnt
kt_double GetHeading() const
Pose2 GetSensorPose() const
OccupancyGrid(kt_int32s width, kt_int32s height, const Vector2d &rOffset, kt_double resolution)
kt_int32s GetHeight() const
nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Wed Mar 2 2022 00:37:22