10 #ifndef MRPT_COctoMapBase_H
11 #define MRPT_COctoMapBase_H
16 #include <octomap/octomap.h>
47 template <
class OCTREE,
class OCTREE_NODE>
92 const bool o_has_parent = o.
m_parent.get() !=
nullptr;
141 m_parent->m_octomap.setClampingThresMin(thresProb);
149 m_parent->m_octomap.setClampingThresMax(thresProb);
156 return m_parent->m_octomap.getOccupancyThres();
163 return m_parent->m_octomap.getOccupancyThresLog();
170 return m_parent->m_octomap.getProbHit();
177 return m_parent->m_octomap.getProbHitLog();
183 return m_parent->m_octomap.getProbMiss();
190 return m_parent->m_octomap.getProbMissLog();
198 return m_parent->m_octomap.getClampingThresMin();
206 return m_parent->m_octomap.getClampingThresMinLog();
213 return m_parent->m_octomap.getClampingThresMax();
221 return m_parent->m_octomap.getClampingThresMaxLog();
272 virtual bool isEmpty()
const override;
322 mrpt::make_aligned_shared<mrpt::opengl::COctoMapVoxels>();
324 outObj->insert(gl_obj);
338 octomap::OcTreeKey key;
339 return m_octomap.coordToKeyChecked(octomap::point3d(
x,
y,
z), key);
346 const float x,
const float y,
const float z,
347 double& prob_occupancy)
const;
353 const double x,
const double y,
const double z,
bool occupied)
366 const CPointsMap& ptMap,
const float sensor_x,
const float sensor_y,
367 const float sensor_z);
371 const float end_x,
const float end_y,
const float end_z,
372 const float sensor_x,
const float sensor_y,
const float sensor_z)
375 octomap::point3d(sensor_x, sensor_y, sensor_z),
401 bool ignoreUnknownCells =
false,
double maxRange = -1.0)
const;
468 octomap::point3d& point3d_sensorPt,
469 octomap::Pointcloud& ptr_scan)
const;
Declares a virtual base class for all metric maps storage classes.
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
virtual bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
bool internal_build_PointCloud_for_observation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose, octomap::point3d &point3d_sensorPt, octomap::Pointcloud &ptr_scan) const
Builds the list of 3D points in global coordinates for a generic observation.
unsigned int getTreeDepth() const
virtual void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >,...
OCTREE octree_t
The type of the octree class in the "octomap" library.
virtual double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Internal method called by computeObservationLikelihood()
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),...
virtual void getAsOctoMapVoxels(mrpt::opengl::COctoMapVoxels &gl_obj) const =0
Builds a renderizable representation of the octomap as a mrpt::opengl::COctoMapVoxels object.
OCTREE & getOctomap()
Get a reference to the internal octomap object.
void getMetricMin(double &x, double &y, double &z) const
minimum value of the bounding box of all known space in x, y, z
OCTREE_NODE octree_node_t
The type of nodes in the octree, in the "octomap" library.
double getResolution() const
void getMetricMax(double &x, double &y, double &z) const
maximum value of the bounding box of all known space in x, y, z
COctoMapBase(const double resolution=0.10)
Constructor, defines the resolution of the octomap (length of each voxel side)
size_t getNumLeafNodes() const
Traverses the tree to calculate the total number of leaf nodes.
bool getPointOccupancy(const float x, const float y, const float z, double &prob_occupancy) const
Get the occupancy probability [0,1] of a point.
size_t memoryUsageNode() const
void getMetricSize(double &x, double &y, double &z) const
Size of OcTree (all known space) in meters for x, y and z dimension.
virtual void internal_clear() override
Internal method called by clear()
size_t memoryUsage() const
size_t memoryFullGrid() const
TInsertionOptions insertionOptions
The options used when inserting observations in the map.
void insertPointCloud(const CPointsMap &ptMap, const float sensor_x, const float sensor_y, const float sensor_z)
Update the octomap with a 2D or 3D scan, given directly as a point cloud and the 3D location of the s...
void getMetricMin(double &x, double &y, double &z)
minimum value of the bounding box of all known space in x, y, z
COctoMapBase< OCTREE, OCTREE_NODE > myself_t
The type of this MRPT class.
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.
size_t calcNumNodes() const
Traverses the tree to calculate the total number of nodes.
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,...
void getMetricSize(double &x, double &y, double &z)
Size of OcTree (all known space) in meters for x, y and z dimension.
OCTREE m_octomap
The actual octo-map object.
bool castRay(const mrpt::math::TPoint3D &origin, const mrpt::math::TPoint3D &direction, mrpt::math::TPoint3D &end, bool ignoreUnknownCells=false, double maxRange=-1.0) const
Performs raycasting in 3d, similar to computeRay().
void getMetricMax(double &x, double &y, double &z)
maximum value of the bounding box of all known space in x, y, z
virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
TRenderingOptions renderingOptions
TLikelihoodOptions likelihoodOptions
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
Declares a class that represents any robot's observation.
A flexible renderer of voxels, typically from a 3D octo map (see mrpt::maps::COctoMap).
std::shared_ptr< COctoMapVoxels > Ptr
std::shared_ptr< CSetOfObjects > Ptr
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
This class allows loading and storing values and vectors of different types from a configuration text...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLsizei const GLchar ** string
GLsizei GLsizei GLchar * source
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
With this struct options are provided to the observation insertion process.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
bool pruning
whether the tree is (losslessly) pruned after insertion (default: true)
double getClampingThresMin() const
float getClampingThresMinLog() const
TInsertionOptions()
Especial constructor, not attached to a real COctoMap object: used only in limited situations,...
float getProbHitLog() const
mrpt::utils::ignored_copy_ptr< myself_t > m_parent
void setProbHit(double prob)
(key name in .ini files: "probHit")sets the probablility for a "hit" (will be converted to logodds) -...
void setOccupancyThres(double prob)
(key name in .ini files: "occupancyThres") sets the threshold for occupancy (sensor model) (Default=0...
double maxrange
maximum range for how long individual beams are inserted (default -1: complete beam)
float getOccupancyThresLog() const
double getClampingThresMax() const
float getProbMissLog() const
double getProbHit() const
float getClampingThresMaxLog() const
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...
double getProbMiss() const
TInsertionOptions & operator=(const TInsertionOptions &o)
void setClampingThresMax(double thresProb)
(key name in .ini files: "clampingThresMax")sets the maximum threshold for occupancy clamping (sensor...
double getOccupancyThres() const
void setClampingThresMin(double thresProb)
(key name in .ini files: "clampingThresMin")sets the minimum threshold for occupancy clamping (sensor...
void setProbMiss(double prob)
(key name in .ini files: "probMiss")sets the probablility for a "miss" (will be converted to logodds)...
Options used when evaluating "computeObservationLikelihood".
uint32_t decimation
Speed up the likelihood computation by considering only one out of N rays (default=1)
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
TLikelihoodOptions()
Initilization of default parameters.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...
void writeToStream(mrpt::utils::CStream &out) const
Binary dump to stream.
virtual ~TLikelihoodOptions()
void readFromStream(mrpt::utils::CStream &in)
Binary dump to stream.
Options for the conversion of a mrpt::maps::COctoMap into a mrpt::opengl::COctoMapVoxels.
void writeToStream(mrpt::utils::CStream &out) const
Binary dump to stream.
bool generateFreeVoxels
Generate voxels for the freespace (Default=true)
void readFromStream(mrpt::utils::CStream &in)
Binary dump to stream.
bool generateOccupiedVoxels
Generate voxels for the occupied volumes (Default=true)
bool visibleFreeVoxels
Set free voxels visible (requires generateFreeVoxels=true) (Default=true)
bool visibleOccupiedVoxels
Set occupied voxels visible (requires generateOccupiedVoxels=true) (Default=true)
bool generateGridLines
Generate grid lines for all octree nodes, useful to draw the "structure" of the octree,...
A wrapper class for pointers whose copy operations from other objects of the same type are ignored,...