Main MRPT website > C++ reference for MRPT 1.9.9
CHMHMapNode.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-2018, 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 #ifndef CHMHMapNode_H
10 #define CHMHMapNode_H
11 
13 #include <mrpt/obs/CSensoryFrame.h>
15 
18 #include <mrpt/graphs/TNodeID.h>
19 #include <map>
20 
21 namespace mrpt
22 {
23 namespace hmtslam
24 {
25 class CHierarchicalMHMap;
26 class CHMHMapArc;
27 
28 /** A class for representing a node in a hierarchical, multi-hypothesis map.
29  * The node itself will be considered only if some given hypothesisID matchs
30  * its own ID.
31  * \note Create objects by invoking the class factory "::Create"
32  *
33  * \sa CHierarchicalMHMap,CHMHMapArc
34  * \ingroup mrpt_hmtslam_grp
35  */
37 {
38  friend class CHierarchicalMHMap;
40  friend class CHMHMapArc;
41 
43 
44  public:
45  /** The type of the IDs of nodes.
46  */
48 
49  /** The hypothesis IDs under which this node exists.
50  */
52 
53  protected:
54  /** An unique identifier for the node: it is randomly generated at
55  * construction or read from stream when loaded.
56  */
58 
59  /** The list of all arcs from/to this node:
60  */
62 
63  /** Event handler for arc destruction: It should be only called for arcs
64  * from/to this node, altought other case must be handled without effects.
65  * \note At *addition we use a smart pointer to assure all the implied guys
66  * use the same smrt. pnt., but at destructors the objects don't know
67  * anything but "this", thus the usage of plain pointers.
68  */
69  void onArcDestruction(CHMHMapArc* arc);
70 
71  /** Event handler for arc addition: It should be only called for arcs
72  * from/to this node, although other cases have no effects.
73  */
74  void onArcAddition(const std::shared_ptr<CHMHMapArc>& arc);
75 
76  /** The hierarchical graph in which this object is into.
77  */
79 
80  public:
81  /** Constructor
82  */
84  CHierarchicalMHMap* parent = nullptr,
85  const THypothesisIDSet& hyps = THypothesisIDSet());
86 
87  /** Destructor
88  */
89  virtual ~CHMHMapNode();
90 
91  /** The annotations of the node, see the general description of the class
92  * for possible properties and values.
93  */
95 
96  /** The type of the node, the possibilities are:
97  * - Place
98  * - Area
99  * - TopologicalMap
100  * - Object
101  */
103 
104  /** Reads the ID of the node (read-only property)
105  */
106  TNodeID getID() const;
107 
108  /** The label of the node, only for display it to the user.
109  */
111 
112  /** Returns the level of this node in the hierarchy of arcs
113  * "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.
114  */
115  unsigned int getLevelInTheHierarchy();
116 
117  /** Returns the number of arcs starting from/ending into this node.
118  */
119  unsigned int getRelatedArcsCount();
120 
121  /** Returns a list with the arcs from/to this node.
122  */
123  void getArcs(TArcList& out) const { out = m_arcs; }
124  /** Returns a list with the arcs from/to this node existing in a given
125  * hypothesis ID.
126  */
127  void getArcs(TArcList& out, const THypothesisID& hyp_id) const;
128 
129  /** Returns a list with the arcs from/to this node existing in a given
130  * hypothesis ID and of a given type.
131  */
132  void getArcs(
133  TArcList& out, const char* arcType, const THypothesisID& hyp_id) const;
134 
135  /** Check whether an arc exists towards the given area */
136  bool isNeighbor(
137  const TNodeID& otherArea, const THypothesisID& hyp_id) const;
138 
139 }; // End of class def.
140 
141 /** A map between node IDs and nodes (used in HMT-SLAM).
142  * \sa CHMTSLAM
143  */
144 using TNodeList = std::map<CHMHMapNode::TNodeID, std::shared_ptr<CHMHMapNode>>;
146 using TNodeIDSet = std::set<CHMHMapNode::TNodeID>;
147 using TPairNodeIDs = std::pair<CHMHMapNode::TNodeID, CHMHMapNode::TNodeID>;
148 
149 } // End of namespace
150 } // End of namespace
151 
152 #endif
mrpt::hmtslam::CHMHMapNode::CHierarchicalMHMapPartition
friend class CHierarchicalMHMapPartition
Definition: CHMHMapNode.h:39
mrpt::hmtslam::TNodeIDSet
std::set< CHMHMapNode::TNodeID > TNodeIDSet
Definition: CHMHMapNode.h:146
mrpt::hmtslam::CHMHMapNode::m_ID
TNodeID m_ID
An unique identifier for the node: it is randomly generated at construction or read from stream when ...
Definition: CHMHMapNode.h:57
mrpt::hmtslam::CHMHMapNode::m_hypotheses
THypothesisIDSet m_hypotheses
The hypothesis IDs under which this node exists.
Definition: CHMHMapNode.h:51
mrpt::hmtslam::CHMHMapNode::getID
TNodeID getID() const
Reads the ID of the node (read-only property)
Definition: CHMHMapNode.cpp:133
mrpt::hmtslam::CHMHMapNode::getLevelInTheHierarchy
unsigned int getLevelInTheHierarchy()
Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the groun...
Definition: CHMHMapNode.cpp:137
mrpt::hmtslam::CHMHMapNode
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:36
HMT_SLAM_common.h
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:17
mrpt::hmtslam::CHMHMapNode::onArcAddition
void onArcAddition(const std::shared_ptr< CHMHMapArc > &arc)
Event handler for arc addition: It should be only called for arcs from/to this node,...
Definition: CHMHMapNode.cpp:116
mrpt::hmtslam::CHMHMapNode::getRelatedArcsCount
unsigned int getRelatedArcsCount()
Returns the number of arcs starting from/ending into this node.
Definition: CHMHMapNode.cpp:161
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::hmtslam::CHMHMapNode::~CHMHMapNode
virtual ~CHMHMapNode()
Destructor.
Definition: CHMHMapNode.cpp:55
mrpt::hmtslam::CHMHMapNode::m_parent
mrpt::safe_ptr< CHierarchicalMHMap > m_parent
The hierarchical graph in which this object is into.
Definition: CHMHMapNode.h:78
CMHPropertiesValuesList.h
mrpt::hmtslam::CHMHMapNode::m_nodeType
std::string m_nodeType
The type of the node, the possibilities are:
Definition: CHMHMapNode.h:102
mrpt::hmtslam::CHMHMapNode::TNodeID
mrpt::graphs::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:47
mrpt::hmtslam::TNodeList
std::map< CHMHMapNode::TNodeID, std::shared_ptr< CHMHMapNode > > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:144
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
mrpt::hmtslam::CMHPropertiesValuesList
An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable ...
Definition: CMHPropertiesValuesList.h:38
mrpt::hmtslam::CHMHMapNode::onArcDestruction
void onArcDestruction(CHMHMapArc *arc)
Event handler for arc destruction: It should be only called for arcs from/to this node,...
Definition: CHMHMapNode.cpp:95
mrpt::hmtslam::THypothesisIDSet
A set of hypothesis IDs, used for arcs and nodes in multi-hypothesis hybrid maps.
Definition: HMT_SLAM_common.h:78
CSensoryFrame.h
mrpt::hmtslam::TPairNodeIDs
std::pair< CHMHMapNode::TNodeID, CHMHMapNode::TNodeID > TPairNodeIDs
Definition: CHMHMapNode.h:147
mrpt::hmtslam::CHMHMapNode::CHMHMapNode
CHMHMapNode(CHierarchicalMHMap *parent=nullptr, const THypothesisIDSet &hyps=THypothesisIDSet())
Constructor.
Definition: CHMHMapNode.cpp:23
mrpt::hmtslam::TArcList
A class for storing a sequence of arcs (a path).
Definition: HMT_SLAM_common.h:106
mrpt::hmtslam::CHMHMapNode::m_arcs
TArcList m_arcs
The list of all arcs from/to this node:
Definition: CHMHMapNode.h:61
safe_pointers.h
mrpt::hmtslam::CHMHMapArc
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map.
Definition: CHMHMapArc.h:31
mrpt::hmtslam::THypothesisID
int64_t THypothesisID
An integer number uniquely identifying each of the concurrent hypotheses for the robot topological pa...
Definition: HMT_SLAM_common.h:61
mrpt::hmtslam::CHMHMapNode::m_annotations
CMHPropertiesValuesList m_annotations
The annotations of the node, see the general description of the class for possible properties and val...
Definition: CHMHMapNode.h:94
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
TNodeID.h
mrpt::containers::list_searchable< CHMHMapNode::TNodeID >
mrpt::hmtslam::CHMHMapNode::m_label
std::string m_label
The label of the node, only for display it to the user.
Definition: CHMHMapNode.h:110
string
GLsizei const GLchar ** string
Definition: glext.h:4101
CSerializable.h
mrpt::hmtslam::CHierarchicalMHMap
The most high level class for storing hybrid, multi-hypothesis maps in a graph-based model.
Definition: CHierarchicalMHMap.h:29
mrpt::hmtslam::CHMHMapNode::isNeighbor
bool isNeighbor(const TNodeID &otherArea, const THypothesisID &hyp_id) const
Check whether an arc exists towards the given area.
Definition: CHMHMapNode.cpp:191
mrpt::safe_ptr
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:71
mrpt::hmtslam::CHMHMapNode::getArcs
void getArcs(TArcList &out) const
Returns a list with the arcs from/to this node.
Definition: CHMHMapNode.h:123



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST