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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020