MIRA
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
OccupancyGridMapping Class Reference

Inserts range scan into an occupancy map. More...

#include <mapping/OccupancyGridMapping.h>

Public Member Functions

 OccupancyGridMapping ()
 
 ~OccupancyGridMapping ()
 
void insertScan (OccupancyGrid &map, const Pose3 &pose, const robot::RangeScan &scan, float maxRange=5.0f)
 Inserts a range scan into the specified occupancy map at the specified robot pose. More...
 
void insertScan (OccupancyGrid &map, const Pose3 &poseStart, const Pose3 &poseEnd, const robot::RangeScan &scan, float maxRange=5.0f)
 Inserts a range scan into the specified occupancy map at the specified robot pose. More...
 
void setSensorReliabilitySigma (float sigma)
 Set sigma for distance reliability function. More...
 
float getSensorReliabilitySigma () const
 Returns the sigma for distance reliability function. More...
 
void setEstimationOccupancyLimits (uint8 min, uint8 max)
 Set the occupancy limits for current estimation. More...
 
void setMinEstimationOccupancyLimit (uint8 min)
 Sets the minimum occupancy estimated for current observation. More...
 
uint8 getMinEstimationOccupancyLimit () const
 
void setMaxEstimationOccupancyLimit (uint8 max)
 Sets the maximum occupancy estimated for current observation. More...
 
uint8 getMaxEstimationOccupancyLimit () const
 
void setMapOccupancyLimits (uint8 min, uint8 max)
 Set the occupancy limits for resulting map occupancy. More...
 
void setMinOccupancyLimit (uint8 min)
 Sets the minimum occupancy in the map. More...
 
uint8 getMinOccupancyLimit () const
 
void setMaxOccupancyLimit (uint8 max)
 Sets the maximum occupancy in the map. More...
 
uint8 getMaxOccupancyLimit () const
 
void setEnsureOccupancyLimitsAfterUpdate (bool enable)
 If set to true, the min and max limit of the occupancy values are clamped AFTER updating the map using the complete range scan, instead of limiting the occupancy values when inserting a single beam reading (the latter one is the default). More...
 
bool getEnsureOccupancyLimitsAfterUpdate () const
 
void setLocalCropRadius (float localRadius)
 Sets the local cropping radius for mapping. More...
 
float getLocalCropRadius () const
 
void setMinCertainty (float certainty)
 Sets the minimum certainty a scan must have to be taken into account. More...
 
float getMinCertainty () const
 

Static Public Member Functions

static void clampToMapOccupancyLimits (OccupancyGrid &map, const Rect2f &region, uint8 min, uint8 max)
 Clamps the occupancy values of the map in the given region to the specified limits. More...
 

Friends

template<bool useReliability, bool freeOnly>
class Visitor
 

Detailed Description

Inserts range scan into an occupancy map.

The range scans are inserted into the map according to the Bayes update rule. Additionally, a sensor reliability can be used optionally. Therefore a reliability function is multiplied to the sensor update values. As reliability function a Gaussian function is used that decreases the influence of the map update with a larger distance to the sensor.

For better performance, both, the Bayes update and the reliability function use two look-up tables, which however do not decrease the precision. Additionally, the updates are performed with subpixel accuracy to achieve a high precision.

Constructor & Destructor Documentation

◆ OccupancyGridMapping()

◆ ~OccupancyGridMapping()

Member Function Documentation

◆ insertScan() [1/2]

void insertScan ( OccupancyGrid map,
const Pose3 pose,
const robot::RangeScan &  scan,
float  maxRange = 5.0f 
)
inline

Inserts a range scan into the specified occupancy map at the specified robot pose.

The map is resized if necessary. Using the maxRange parameter the max. size of the update region can be limited. This function uses the Bayes update rule for inserting the scans. The laser mounting position (upright or upside down) is automatically determined from the pose.

◆ insertScan() [2/2]

void insertScan ( OccupancyGrid map,
const Pose3 poseStart,
const Pose3 poseEnd,
const robot::RangeScan &  scan,
float  maxRange = 5.0f 
)

Inserts a range scan into the specified occupancy map at the specified robot pose.

The pose is interpolated linearly between poseStart and poseEnd for each scan.

  • poseStart can be determined by getting the transform of the laser in the map at the timestamp of the scan
  • poseEnd can be determined by getting the transform of the laser in the map at the timestamp of the scan + scanTime

The map is resized if necessary. Using the maxRange parameter the max. size of the update region can be limited. This function uses the Bayes update rule for inserting the scans. The laser mounting position (upright or upside down) is automatically determined from the pose.

◆ clampToMapOccupancyLimits()

static void clampToMapOccupancyLimits ( OccupancyGrid map,
const Rect2f region,
uint8  min,
uint8  max 
)
static

Clamps the occupancy values of the map in the given region to the specified limits.

This method is called by insertScan(), if "ensureOccupancyLimitsAfterUpdate" is set to true.

◆ setSensorReliabilitySigma()

void setSensorReliabilitySigma ( float  sigma)
inline

Set sigma for distance reliability function.

In the map update, the sensor's reliability usually is considered decreasing with growing distance. reliability = exp(-distance^2/sigma^2)

If sigma is 0.0 then the reliability is not used.

Parameters
[in]sigmaSigma for reliability function

◆ getSensorReliabilitySigma()

float getSensorReliabilitySigma ( ) const
inline

Returns the sigma for distance reliability function.

◆ setEstimationOccupancyLimits()

void setEstimationOccupancyLimits ( uint8  min,
uint8  max 
)
inline

Set the occupancy limits for current estimation.

Convergence speed of occupancies can be controlled by setting limits for the current observation and for the overall map occupancy.

wide current observation limits -> faster map change narrow current observation limits -> slower map change

Parameters
[in]maxMaximum occupancy estimated for current observation (higher estimations are truncated)
[in]minMinimum occupancy estimated for current observation (lower estimations are truncated)

◆ setMinEstimationOccupancyLimit()

void setMinEstimationOccupancyLimit ( uint8  min)
inline

Sets the minimum occupancy estimated for current observation.

See also
setEstimationOccupancyLimits()

◆ getMinEstimationOccupancyLimit()

uint8 getMinEstimationOccupancyLimit ( ) const
inline

◆ setMaxEstimationOccupancyLimit()

void setMaxEstimationOccupancyLimit ( uint8  max)
inline

Sets the maximum occupancy estimated for current observation.

See also
setEstimationOccupancyLimits()

◆ getMaxEstimationOccupancyLimit()

uint8 getMaxEstimationOccupancyLimit ( ) const
inline

◆ setMapOccupancyLimits()

void setMapOccupancyLimits ( uint8  min,
uint8  max 
)

Set the occupancy limits for resulting map occupancy.

Convergence speed of occupancies can be controlled by setting limits for the current observation and for the overall map occupancy.

wide map occupancy limits -> strong convergence -> slow change narrow map occupancy limits -> weak convergence -> fast change

Parameters
[in]pMaxMaximum occupancy in the map (higher estimations are truncated)
[in]pMinMinimum occupancy in the map (lower estimations are truncated)

◆ setMinOccupancyLimit()

void setMinOccupancyLimit ( uint8  min)
inline

Sets the minimum occupancy in the map.

See also
setMapOccupancyLimits()

◆ getMinOccupancyLimit()

uint8 getMinOccupancyLimit ( ) const
inline

◆ setMaxOccupancyLimit()

void setMaxOccupancyLimit ( uint8  max)
inline

Sets the maximum occupancy in the map.

See also
setMapOccupancyLimits()

◆ getMaxOccupancyLimit()

uint8 getMaxOccupancyLimit ( ) const
inline

◆ setEnsureOccupancyLimitsAfterUpdate()

void setEnsureOccupancyLimitsAfterUpdate ( bool  enable)

If set to true, the min and max limit of the occupancy values are clamped AFTER updating the map using the complete range scan, instead of limiting the occupancy values when inserting a single beam reading (the latter one is the default).

◆ getEnsureOccupancyLimitsAfterUpdate()

bool getEnsureOccupancyLimitsAfterUpdate ( ) const
inline

◆ setLocalCropRadius()

void setLocalCropRadius ( float  localRadius)
inline

Sets the local cropping radius for mapping.

If the specified local radius is >0, then the map is cropped to an area with the specified local radius around the sensor with each update. This ensures that the map shows a local area around the sensor only and allows to create "local maps". If the radius is <= 0 (the default) the map grows only. This mode then allows to create "global maps".

◆ getLocalCropRadius()

float getLocalCropRadius ( ) const
inline

◆ setMinCertainty()

void setMinCertainty ( float  certainty)
inline

Sets the minimum certainty a scan must have to be taken into account.

Only used when range scan supports certainty vector

◆ getMinCertainty()

float getMinCertainty ( ) const
inline

Friends And Related Function Documentation

◆ Visitor

friend class Visitor
friend

The documentation for this class was generated from the following file: