MRPT  1.9.9
CHMHMapNode.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
13 #include <mrpt/obs/CSensoryFrame.h>
14 
15 #include <mrpt/graphs/TNodeID.h>
18 #include <map>
19 
20 namespace mrpt::hmtslam
21 {
22 class CHierarchicalMHMap;
23 class CHMHMapArc;
24 
25 /** A class for representing a node in a hierarchical, multi-hypothesis map.
26  * The node itself will be considered only if some given hypothesisID matchs
27  * its own ID.
28  * \note Create objects by invoking the class factory "::Create"
29  *
30  * \sa CHierarchicalMHMap,CHMHMapArc
31  * \ingroup mrpt_hmtslam_grp
32  */
34 {
35  friend class CHierarchicalMHMap;
37  friend class CHMHMapArc;
38 
40 
41  public:
42  /** The type of the IDs of nodes.
43  */
45 
46  /** The hypothesis IDs under which this node exists.
47  */
49 
50  protected:
51  /** An unique identifier for the node: it is randomly generated at
52  * construction or read from stream when loaded.
53  */
55 
56  /** The list of all arcs from/to this node:
57  */
59 
60  /** Event handler for arc destruction: It should be only called for arcs
61  * from/to this node, altought other case must be handled without effects.
62  * \note At *addition we use a smart pointer to assure all the implied guys
63  * use the same smrt. pnt., but at destructors the objects don't know
64  * anything but "this", thus the usage of plain pointers.
65  */
66  void onArcDestruction(CHMHMapArc* arc);
67 
68  /** Event handler for arc addition: It should be only called for arcs
69  * from/to this node, although other cases have no effects.
70  */
72 
73  /** The hierarchical graph in which this object is into.
74  */
76 
77  public:
78  /** Constructor
79  */
81  CHierarchicalMHMap* parent = nullptr,
82  const THypothesisIDSet& hyps = THypothesisIDSet());
83 
84  /** Destructor
85  */
86  ~CHMHMapNode() override;
87 
88  /** The annotations of the node, see the general description of the class
89  * for possible properties and values.
90  */
92 
93  /** The type of the node, the possibilities are:
94  * - Place
95  * - Area
96  * - TopologicalMap
97  * - Object
98  */
100 
101  /** Reads the ID of the node (read-only property)
102  */
103  TNodeID getID() const;
104 
105  /** The label of the node, only for display it to the user.
106  */
108 
109  /** Returns the level of this node in the hierarchy of arcs
110  * "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.
111  */
112  unsigned int getLevelInTheHierarchy();
113 
114  /** Returns the number of arcs starting from/ending into this node.
115  */
116  unsigned int getRelatedArcsCount();
117 
118  /** Returns a list with the arcs from/to this node.
119  */
120  void getArcs(TArcList& out) const { out = m_arcs; }
121  /** Returns a list with the arcs from/to this node existing in a given
122  * hypothesis ID.
123  */
124  void getArcs(TArcList& out, const THypothesisID& hyp_id) const;
125 
126  /** Returns a list with the arcs from/to this node existing in a given
127  * hypothesis ID and of a given type.
128  */
129  void getArcs(
130  TArcList& out, const char* arcType, const THypothesisID& hyp_id) const;
131 
132  /** Check whether an arc exists towards the given area */
133  bool isNeighbor(
134  const TNodeID& otherArea, const THypothesisID& hyp_id) const;
135 
136 }; // End of class def.
137 
138 /** A map between node IDs and nodes (used in HMT-SLAM).
139  * \sa CHMTSLAM
140  */
141 using TNodeList = std::map<CHMHMapNode::TNodeID, std::shared_ptr<CHMHMapNode>>;
143 using TNodeIDSet = std::set<CHMHMapNode::TNodeID>;
144 using TPairNodeIDs = std::pair<CHMHMapNode::TNodeID, CHMHMapNode::TNodeID>;
145 
146 } // namespace mrpt::hmtslam
void getArcs(TArcList &out) const
Returns a list with the arcs from/to this node.
Definition: CHMHMapNode.h:120
std::map< CHMHMapNode::TNodeID, std::shared_ptr< CHMHMapNode > > TNodeList
A map between node IDs and nodes (used in HMT-SLAM).
Definition: CHMHMapNode.h:141
mrpt::safe_ptr< CHierarchicalMHMap > m_parent
The hierarchical graph in which this object is into.
Definition: CHMHMapNode.h:75
mrpt::graphs::TNodeID TNodeID
The type of the IDs of nodes.
Definition: CHMHMapNode.h:44
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:99
~CHMHMapNode() override
Destructor.
Definition: CHMHMapNode.cpp:54
std::set< CHMHMapNode::TNodeID > TNodeIDSet
Definition: CHMHMapNode.h:143
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:58
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:91
std::pair< CHMHMapNode::TNodeID, CHMHMapNode::TNodeID > TPairNodeIDs
Definition: CHMHMapNode.h:144
GLsizei const GLchar ** string
Definition: glext.h:4116
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...
mrpt::vision::TStereoCalibResults out
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)
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map...
Definition: CHMHMapArc.h:28
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:36
THypothesisIDSet m_hypotheses
The hypothesis IDs under which this node exists.
Definition: CHMHMapNode.h:48
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:54
A class for representing a node in a hierarchical, multi-hypothesis map.
Definition: CHMHMapNode.h:33
std::string m_label
The label of the node, only for display it to the user.
Definition: CHMHMapNode.h:107
void onArcDestruction(CHMHMapArc *arc)
Event handler for arc destruction: It should be only called for arcs from/to this node...
Definition: CHMHMapNode.cpp:93



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 9b18308f3 Mon Nov 18 23:39:25 2019 +0100 at lun nov 18 23:45:12 CET 2019