Main MRPT website > C++ reference
MRPT logo
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-2014, 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/slam/COctoMapBase.h>
16 
17 #include <mrpt/maps/link_pragmas.h>
18 
19 namespace mrpt
20 {
21  namespace slam
22  {
23  class CPointsMap;
24  class CObservation2DRangeScan;
25  class CObservation3DRangeScan;
26 
27  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CColouredOctoMap , CMetricMap, MAPS_IMPEXP )
28 
29  /** A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ library.
30  * This version stores both, occupancy information and RGB colour data at each octree node. See the base class mrpt::slam::COctoMapBase.
31  *
32  * \sa CMetricMap, the example in "MRPT/samples/octomap_simple"
33  * \ingroup mrpt_maps_grp
34  */
35  class MAPS_IMPEXP CColouredOctoMap : public COctoMapBase<octomap::ColorOcTree,octomap::ColorOcTreeNode>
36  {
37  // This must be added to any CSerializable derived class:
39 
40  public:
41  CColouredOctoMap(const double resolution=0.10); //!< Default constructor
42  virtual ~CColouredOctoMap(); //!< Destructor
43 
44  /** This allows the user to select the desired method to update voxels colour.
45  SET = Set the colour of the voxel at (x,y,z) directly
46  AVERAGE = Set the colour of the voxel at (x,y,z) as the mean of its previous colour and the new observed one.
47  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)
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,
54  AVERAGE
55  };
56 
57  /** Get the RGB colour of a point
58  * \return false if the point is not mapped, in which case the returned colour is undefined. */
59  bool getPointColour(const float x, const float y, const float z, uint8_t& r, uint8_t& g, uint8_t& b) const;
60 
61  /** Manually update the colour of the voxel at (x,y,z) */
62  void updateVoxelColour(const double x, const double y, const double z, const uint8_t r, const uint8_t g, const uint8_t b);
63 
64  ///Set the method used to update voxels colour
65  void setVoxelColourMethod(TColourUpdate new_method) {m_colour_method = new_method;}
66 
67  ///Get the method used to update voxels colour
68  TColourUpdate getVoxelColourMethod() {return m_colour_method;}
69 
70  virtual void getAsOctoMapVoxels(mrpt::opengl::COctoMapVoxels &gl_obj) const;
71 
72  protected:
73 
74  bool internal_insertObservation(const CObservation *obs,const CPose3D *robotPose);
75 
76  TColourUpdate m_colour_method; //!Method used to updated voxels colour.
77 
78  }; // End of class def.
80 
81  } // End of namespace
82 
83 } // End of namespace
84 
85 #endif
OctoMap: A probabilistic, flexible, and compact 3D mapping library for robotic systems.
TColourUpdate
This allows the user to select the desired method to update voxels colour.
Declares a virtual base class for all metric maps storage classes.
Definition: CMetricMap.h:83
A flexible renderer of voxels, typically from a 3D octo map (see mrpt::slam::COctoMap).
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
TColourUpdate getVoxelColourMethod()
Get the method used to update voxels colour.
Declares a class that represents any robot's observation.
Definition: CObservation.h:52
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...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:69
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
void setVoxelColourMethod(TColourUpdate new_method)
Set the method used to update voxels colour.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
Definition: COctoMapBase.h:46



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014