Class CColouredOctoMap

Inheritance Relationships

Base Type

Class Documentation

class CColouredOctoMap : public mrpt::maps::COctoMapBase<octomap::ColorOcTree, octomap::ColorOcTreeNode>

A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the “octomap” C++ library. This version stores both, occupancy information and RGB colour data at each octree node. See the base class mrpt::maps::COctoMapBase.

The octomap library was presented in wurm2010octomap

See also

CMetricMap, the example in “MRPT/mrpt_examples_cpp/octomap_simple”

Direct access to octomap library methods

void insertRay(const float end_x, const float end_y, const float end_z, const float sensor_x, const float sensor_y, const float sensor_z)

Just like insertPointCloud but with a single ray.

void updateVoxel(const double x, const double y, const double z, bool occupied)

Manually updates the occupancy of the voxel at (x,y,z) as being occupied (true) or free (false), using the log-odds parameters in insertionOptions

bool isPointWithinOctoMap(const float x, const float y, const float z) const

Check whether the given point lies within the volume covered by the octomap (that is, whether it is “mapped”)

double getResolution() const
unsigned int getTreeDepth() const
size_t size() const
Returns:

The number of nodes in the tree

size_t memoryUsage() const
Returns:

Memory usage of the complete octree in bytes (may vary between architectures)

size_t memoryUsageNode() const
Returns:

Memory usage of the a single octree node

size_t memoryFullGrid() const
Returns:

Memory usage of a full grid of the same size as the OcTree in bytes (for comparison)

double volume()
void getMetricSize(double &x, double &y, double &z)

Size of OcTree (all known space) in meters for x, y and z dimension.

void getMetricSize(double &x, double &y, double &z) const

Size of OcTree (all known space) in meters for x, y and z dimension.

void getMetricMin(double &x, double &y, double &z)

minimum value of the bounding box of all known space in x, y, z

void getMetricMin(double &x, double &y, double &z) const

minimum value of the bounding box of all known space in x, y, z

void getMetricMax(double &x, double &y, double &z)

maximum value of the bounding box of all known space in x, y, z

void getMetricMax(double &x, double &y, double &z) const

maximum value of the bounding box of all known space in x, y, z

size_t calcNumNodes() const

Traverses the tree to calculate the total number of nodes.

size_t getNumLeafNodes() const

Traverses the tree to calculate the total number of leaf nodes.

virtual void setOccupancyThres(double prob) override
virtual void setProbHit(double prob) override
virtual void setProbMiss(double prob) override
virtual void setClampingThresMin(double thresProb) override
virtual void setClampingThresMax(double thresProb) override
virtual double getOccupancyThres() const override
virtual float getOccupancyThresLog() const override
virtual double getProbHit() const override
virtual float getProbHitLog() const override
virtual double getProbMiss() const override
virtual float getProbMissLog() const override
virtual double getClampingThresMin() const override
virtual float getClampingThresMinLog() const override
virtual double getClampingThresMax() const override
virtual float getClampingThresMaxLog() const override

Public Types

enum TColourUpdate

This allows the user to select the desired method to update voxels colour. SET = Set the colour of the voxel at (x,y,z) directly AVERAGE = Set the colour of the voxel at (x,y,z) as the mean of its previous colour and the new observed one. INTEGRATE = Calculate the new colour of the voxel at (x,y,z) using this formula: prev_color*node_prob + new_color*(0.99-node_prob) If there isn’t any previous color, any method is equivalent to SET. INTEGRATE is the default option

Values:

enumerator INTEGRATE
enumerator SET
enumerator AVERAGE

Public Functions

CColouredOctoMap(const double resolution = 0.10)

Default constructor.

~CColouredOctoMap() override

Destructor.

bool getPointColour(const float x, const float y, const float z, uint8_t &r, uint8_t &g, uint8_t &b) const

Get the RGB colour of a point

Returns:

false if the point is not mapped, in which case the returned colour is undefined.

void updateVoxelColour(const double x, const double y, const double z, const uint8_t r, const uint8_t g, const uint8_t b)

Manually update the colour of the voxel at (x,y,z)

inline void setVoxelColourMethod(TColourUpdate new_method)

Set the method used to update voxels colour.

inline TColourUpdate getVoxelColourMethod()

Get the method used to update voxels colour.

virtual void getAsOctoMapVoxels(mrpt::viz::COctoMapVoxels &gl_obj) const override

Builds a renderizable representation of the octomap as a mrpt::viz::COctoMapVoxels object.

See also

renderingOptions

inline bool isEmpty() const override

Returns true if the map is empty/no observation has been inserted

Public Members

double resolution = {0.10}

The finest resolution of the octomap (default: 0.10

mrpt::maps::CColouredOctoMap::TInsertionOptions insertionOpts

meters)

Observations insertion options

mrpt::maps::CColouredOctoMap::TLikelihoodOptions likelihoodOpts

Probabilistic observation likelihood options.

Protected Functions

void internal_clear() override
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const std::optional<const mrpt::poses::CPose3D> &robotPose) override

Protected Attributes

TColourUpdate m_colour_method = {INTEGRATE}