|
MIRA
|
Namespaces | |
| polygon | |
Typedefs | |
| typedef std::list< Rect2i > | DirtyRegions |
| Dirty regions stored as vector of rects. More... | |
| typedef std::list< Rect2f > | DirtyRegionsWorld |
| typedef GridMap< uint8 > | OccupancyGrid |
| Occupancy Map, typedef for 1 channel GridMap containing 8-bit unsigned integers per cell. More... | |
| using | OccupancyGridInfo = GridMapInfo |
| Backward compatibility aliases. More... | |
| using | OccupancyGridFileInfoWithFrame = GridMapFileInfoWithFrame |
| using | OccupancyGridFileInfoWithFrameAndChannelName = GridMapFileInfoWithFrameAndChannelName |
| typedef PointCloud< Point3normal > | PointCloud3Normal |
| typedef PointCloud< Point2f > | PointCloud2 |
| typedef PointCloud< Point3f > | PointCloud3 |
| typedef PointCloud< Point2rgb > | PointCloud2rgb |
| typedef PointCloud< Point3rgb > | PointCloud3rgb |
| typedef PointCloud< Point3labeled > | PointCloud3labeled |
Functions | |
| template<typename Visitor , bool VisitorUsesWorldDistance = true> | |
| void | rasterSensorCone (const RangeScanCone &c, float maxRange, float cellSize, Visitor &visitor) |
| Function for fast rasterization of sensor cones cell by cell. More... | |
| DirtyRegions | mergeRegions (DirtyRegions regions) |
| template<typename T , int Channels = 1> | |
| GridMap< T, Channels > | loadGridMapFromImage (const Img<> &img, float cellSize, const Point2i &offset, T truncateTo=std::numeric_limits< T >::max()) |
| Loads the specified image as grid map. More... | |
| template<typename T , int Channels = 1> | |
| GridMap< T, Channels > | loadGridMapFromFile (const Path &filename, float cellSize, const Point2i &offset, T truncateTo=std::numeric_limits< T >::max()) |
| Loads the specified image file as grid map. More... | |
| template<typename T , int Channels = 1> | |
| GridMap< T, Channels > | loadGridMap (const GridMapInfo &info, T truncateTo=std::numeric_limits< T >::max()) |
| Loads the image specified by info as map. More... | |
| template<typename T , int Channels = 1> | |
| GridMap< T, Channels > | loadGridMap (const Path &descriptionFilename, T truncateTo=std::numeric_limits< T >::max()) |
| Loads the image from the description file (specifying an image file) as map. More... | |
| template<typename T , int Channels> | |
| void | saveGridMapToFile (Path filename, const GridMap< T, Channels > &map, bool fullImagePath=true) |
| Saves the specified grid map as image + description xml. More... | |
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid | loadOccupancyGrid (const OccupancyGridInfo &info, bool truncateTo254=true) |
| Loads the grayscale image specified by info as occupancy map. More... | |
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid | loadOccupancyGridFromFile (const Path &filename, float cellSize, const Point2i &offset, bool truncateTo254=true) |
| Loads the specified grayscale image from to as occupancy map. More... | |
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid | loadOccupancyGridFromImage (const Img<> &img, float cellSize, const Point2i &offset, bool truncateTo254=true) |
| Loads the specified grayscale image as occupancy map. More... | |
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid | loadOccupancyGridFromGM2File (const Path &filename) |
| Loads the specified GM2 map as occupancy map. More... | |
| MIRA_MAPPING_MAPS_EXPORT void | saveOccupancyGridToFile (Path filename, const OccupancyGrid &map, bool fullImagePath=true) |
| Saves the specified occupancy map as grayscale image and description xml. More... | |
| template<typename PointType > | |
| PCFormat | pointCloudFormat () |
| template<> | |
| PCFormat | pointCloudFormat< Point2f > () |
| template<> | |
| PCFormat | pointCloudFormat< Point3f > () |
| template<> | |
| PCFormat | pointCloudFormat< Eigen::Vector3f > () |
| typedef std::list<Rect2i> DirtyRegions |
Dirty regions stored as vector of rects.
| typedef std::list<Rect2f> DirtyRegionsWorld |
| typedef GridMap<uint8> OccupancyGrid |
Occupancy Map, typedef for 1 channel GridMap containing 8-bit unsigned integers per cell.
Each cell stores the occupancy values as a single byte coded from 0 (not occupied) to 254 (occupied):
Occupancy value Byte representation 0.0 0 0.5 127 1.0 254
Please note, that the value of 255 is reserved to mark a cell as "uninitialized". Hence, the max. allowed value is 254, representing an occupancy probability of 1.0. When an occupancy map is loaded from an image file, pixels with values larger than 254 will be truncated to 254.
| using OccupancyGridInfo = GridMapInfo |
Backward compatibility aliases.
| typedef PointCloud<Point3normal> PointCloud3Normal |
| typedef PointCloud<Point2f> PointCloud2 |
| typedef PointCloud<Point3f> PointCloud3 |
| typedef PointCloud<Point2rgb> PointCloud2rgb |
| typedef PointCloud<Point3rgb> PointCloud3rgb |
| typedef PointCloud<Point3labeled> PointCloud3labeled |
|
inline |
Function for fast rasterization of sensor cones cell by cell.
This function can be used for all algorithms that need to visit each cell of a sensor cone, like inserting sensor measurements to maps, creating virtual range scans, etc. The function is independent from any data structure or representation (like maps or images). The only assumption is, that the data, map or whatever can be partitioned into regular square cells, where the origin of the coordinate system intersects one cell in the middle of that cell. The size of these cells must be passed via the parameter cellSize.
This function works with subpixel precision, therefore the exact position of the origin of the sensor cone in relation to the coordinate system of the map is necessary. Since the sensor usually is mounted on a robot, the position of the cone origin depends on the sensor's mounting position relative to the robot coordinate system and the pose of the robot. The robot's pose is passed using the parameters x0,y0 and phi0. The sensor's mounting position and its configuration like cone angle is passed in the parameter c.
The rasterization of the cone is now performed as follows: The sensor cone is approximated by an enclosing isosceles triangle with one vertex in the cone origin. The position of the two other vertices are computed relative to the cone origin using the sensor's orientation and cone angle:
* cone origin
/ \ ^
/ \ |
/ \ |
/ \ | maxRange
/. cone . |
/ / \ |
/_____________\ v
enclosing triangle
The size of the triangle is determined by the cone angle and the maxRange. The maxRange parameter determines the max. range that is covered by the cone. However, the arms of the triangle may become longer than this max. range (see ASCII art above) and therefore the rastered region, too. This must be kept in mind to make sure to not read or write beyond the borders of the data.
TODO: a function for obtaining the bounding box of the triangle is needed!
Finally, the triangle is rastered scanline by scanline. For each cell in the scanline a visitor is called that must be passed in as the parameter 'visitor' (for more details on the visitor see below). For each cell the distance to the sensor is provided. Since a cell has a non-zero extent, the min. distance and the max. distance of the cell is passed. For obtaining the distances, the efficient DistantLUT singleton is used.
The actual algorithm for map building or computation of virtual scans must be implemented in the visitor. The visitor must implement the following concept:
concept RasterSensorConeVisitor { void beginScan(float origin_x, float origin_y, const RangeScanSensorConfig& c); void beginScanline(int y); void operator()(int x, int y, float min_d, float max_d); };
The method beginScan() is called to tell the visitor the origin of the sensor cone's origin (origin_x, origin_y) and additionally the sensor config c. The visitor will need these origin coordinates since all other methods specify the cell position relative to the origin of the sensor cone. A typical implementation of the visitor will use the coordinates to compute the cell indices of the cone origin in their data/map representation. These indices can then be used to compute the absolute cell indices from the relative ones that are passed by beginScanline() and operator(). beginScanline() is called for each scanline and can be used to obtain a pointer to the corresponding scanline for better performance. Afterwards the ()operator is called for each cell, where the cell's position is specified relative to the cones origin. Additionally, the min. and max. distance of the cell to the sensor 'plane' is passed as third and fourth parameter. The y-coordinate is the same as the one that was specified in beginScanline().
The following example shows a visitor that draws a sensor cone into an image, where the free space is drawn black and the occupied region is drawn white. The other pixels are left unchanged:
class DrawScanToImage
{
public:
Image image; // some image
float cellsize; // the cellsize int x0, y0; // the position of the origin
Pixels* scanline; // pointer to the beginning of the current scanlinefloat range; // the range measurement
void beginScan(const RangeScanCone& c)
{
// compute the position of the cone origin in the image
// (image origin is in the center of the image)
x0 = round(c.origin.x() / cellsize) + image.width/2;
y0 = round(c.origin.y() / cellsize) + image.height/2;
} void beginScanline(int y)
{
scanline = image.getScanline(y+y0);
} void operator()(int x, int y, float min_d, float max_d)
{
// process only cells that are in front of the sensor reading
if(min_d<=range) {
// if the min distance is in front of the measured range
// and the max distance of the cell is behind that range
// then the cell was hit and is occupied. If
// both, min. distance and max. distance are smaller then
// the sensor beam has traveld through this cell and
// this cell should be considered as free.
if(max_d>=range) {
// draw pixel (x+x0, y+y0) black
scanline[x+x0] = black;
} else {
// draw pixel (x+x0, y+y0) white
scanline[x+x0] = white;
}
}
}
};// Usage:
DrawScanToImage visitor; float maxRange = 5.0f; visitor.range = 3.0f; // measured 3 meters
// draw the cone: rasterSensorCone(x,y,phi, c, maxRange, visitor.cellsize, visitor);
increase maxRange to make sure we cover the whole scan region actually the arms of the isosceles triangle are extended:
origin
^ * ^
| |\ \
| | \ \ arm length = maxRange/cos(cone_angle/2)
maxRange | | \ \ | | \ \ v |____\ v
increase maxRange to make sure we cover the whole scan region actually the arms of the isosceles triangle are extended:
origin
^ * ^
| |\ \
| | \ \ arm length = maxRange/cos(cone_angle/2)
maxRange | | \ \ | | \ \ v |____\ v
| DirtyRegions mira::maps::mergeRegions | ( | DirtyRegions | regions | ) |
| GridMap<T, Channels> mira::maps::loadGridMapFromImage | ( | const Img<> & | img, |
| float | cellSize, | ||
| const Point2i & | offset, | ||
| T | truncateTo = std::numeric_limits<T>::max() |
||
| ) |
Loads the specified image as grid map.
Additionally, the cell size and offset of the map must be specified.
| GridMap<T, Channels> mira::maps::loadGridMapFromFile | ( | const Path & | filename, |
| float | cellSize, | ||
| const Point2i & | offset, | ||
| T | truncateTo = std::numeric_limits<T>::max() |
||
| ) |
Loads the specified image file as grid map.
Additionally, the cell size and offset of the map must be specified.
| GridMap<T, Channels> mira::maps::loadGridMap | ( | const GridMapInfo & | info, |
| T | truncateTo = std::numeric_limits<T>::max() |
||
| ) |
Loads the image specified by info as map.
| GridMap<T, Channels> mira::maps::loadGridMap | ( | const Path & | descriptionFilename, |
| T | truncateTo = std::numeric_limits<T>::max() |
||
| ) |
Loads the image from the description file (specifying an image file) as map.
The description usually was created by saveGridMapToFile().
| void mira::maps::saveGridMapToFile | ( | Path | filename, |
| const GridMap< T, Channels > & | map, | ||
| bool | fullImagePath = true |
||
| ) |
Saves the specified grid map as image + description xml.
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid mira::maps::loadOccupancyGrid | ( | const OccupancyGridInfo & | info, |
| bool | truncateTo254 = true |
||
| ) |
Loads the grayscale image specified by info as occupancy map.
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid mira::maps::loadOccupancyGridFromFile | ( | const Path & | filename, |
| float | cellSize, | ||
| const Point2i & | offset, | ||
| bool | truncateTo254 = true |
||
| ) |
Loads the specified grayscale image from to as occupancy map.
Additionally, the cell size of the map must be specified.
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid mira::maps::loadOccupancyGridFromImage | ( | const Img<> & | img, |
| float | cellSize, | ||
| const Point2i & | offset, | ||
| bool | truncateTo254 = true |
||
| ) |
Loads the specified grayscale image as occupancy map.
Additionally, the cell size of the map must be specified.
| MIRA_MAPPING_MAPS_EXPORT OccupancyGrid mira::maps::loadOccupancyGridFromGM2File | ( | const Path & | filename | ) |
Loads the specified GM2 map as occupancy map.
| MIRA_MAPPING_MAPS_EXPORT void mira::maps::saveOccupancyGridToFile | ( | Path | filename, |
| const OccupancyGrid & | map, | ||
| bool | fullImagePath = true |
||
| ) |
Saves the specified occupancy map as grayscale image and description xml.
|
inline |
|
inline |
|
inline |
|
inline |
1.8.14