Main MRPT website > C++ reference for MRPT 1.9.9
CColouredOctoMap.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef MRPT_CColouredOctoMap_H
11 #define MRPT_CColouredOctoMap_H
12 
13 #include <mrpt/maps/COctoMapBase.h>
14 #include <octomap/octomap.h>
15 #include <octomap/ColorOcTree.h>
16 #include <mrpt/obs/obs_frwds.h>
17 
18 namespace mrpt
19 {
20 namespace maps
21 {
22 /** A three-dimensional probabilistic occupancy grid, implemented as an
23  * octo-tree with the "octomap" C++ library.
24  * This version stores both, occupancy information and RGB colour data at each
25  * octree node. See the base class mrpt::maps::COctoMapBase.
26  *
27  * \sa CMetricMap, the example in "MRPT/samples/octomap_simple"
28  * \ingroup mrpt_maps_grp
29  */
31  : public COctoMapBase<octomap::ColorOcTree, octomap::ColorOcTreeNode>
32 {
34 
35  public:
36  /** Default constructor */
37  CColouredOctoMap(const double resolution = 0.10);
38  /** Destructor */
39  virtual ~CColouredOctoMap();
40 
41  /** This allows the user to select the desired method to update voxels
42  colour.
43  SET = Set the colour of the voxel at (x,y,z) directly
44  AVERAGE = Set the colour of the voxel at (x,y,z) as the mean of its
45  previous colour and the new observed one.
46  INTEGRATE = Calculate the new colour of the voxel at (x,y,z) using this
47  formula: prev_color*node_prob + new_color*(0.99-node_prob)
48  If there isn't any previous color, any method is equivalent to SET.
49  INTEGRATE is the default option*/
51  {
52  INTEGRATE = 0,
53  SET,
55  };
56 
57  /** Get the RGB colour of a point
58  * \return false if the point is not mapped, in which case the returned
59  * colour is undefined. */
60  bool getPointColour(
61  const float x, const float y, const float z, uint8_t& r, uint8_t& g,
62  uint8_t& b) const;
63 
64  /** Manually update the colour of the voxel at (x,y,z) */
65  void updateVoxelColour(
66  const double x, const double y, const double z, const uint8_t r,
67  const uint8_t g, const uint8_t b);
68 
69  /// Set the method used to update voxels colour
71  {
72  m_colour_method = new_method;
73  }
74 
75  /// Get the method used to update voxels colour
77  virtual void getAsOctoMapVoxels(
78  mrpt::opengl::COctoMapVoxels& gl_obj) const override;
79 
81  /** The finest resolution of the octomap (default: 0.10 meters) */
82  double resolution;
83  /** Observations insertion options */
84  mrpt::maps::CColouredOctoMap::TInsertionOptions insertionOpts;
85  /** Probabilistic observation likelihood options */
86  mrpt::maps::CColouredOctoMap::TLikelihoodOptions likelihoodOpts;
88 
89  protected:
91  const mrpt::obs::CObservation* obs,
92  const mrpt::poses::CPose3D* robotPose) override;
93 
94  TColourUpdate m_colour_method; //! Method used to updated voxels colour.
95 
96 }; // End of class def.
97 
98 } // End of namespace
99 
100 } // End of namespace
101 
102 #endif
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
GLdouble GLdouble z
Definition: glext.h:3872
virtual ~CColouredOctoMap()
Destructor.
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
unsigned char uint8_t
Definition: rptypes.h:41
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
Definition: COctoMapBase.h:48
A flexible renderer of voxels, typically from a 3D octo map (see mrpt::maps::COctoMap).
void setVoxelColourMethod(TColourUpdate new_method)
Set the method used to update voxels colour.
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)
GLubyte g
Definition: glext.h:6279
GLubyte GLubyte b
Definition: glext.h:6279
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.
TColourUpdate
This allows the user to select the desired method to update voxels colour.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
TColourUpdate getVoxelColourMethod()
Get the method used to update voxels colour.
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose) override
Internal method called by insertObservation()
GLenum GLint GLint y
Definition: glext.h:3538
GLenum GLint x
Definition: glext.h:3538
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
virtual void getAsOctoMapVoxels(mrpt::opengl::COctoMapVoxels &gl_obj) const override
Builds a renderizable representation of the octomap as a mrpt::opengl::COctoMapVoxels object...
CColouredOctoMap(const double resolution=0.10)
Default constructor.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019