Main MRPT website > C++ reference for MRPT 1.9.9
TMRSlamNodeAnnotations.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 TMRSLAMNODEANNOTATIONS_H
10 #define TMRSLAMNODEANNOTATIONS_H
11 
13 #include <cstdint>
14 #include <sstream>
15 #include <string>
16 
17 namespace mrpt
18 {
19 namespace graphs
20 {
21 namespace detail
22 {
23 /**\brief Struct to be used as the NODE_ANNOTATIONS template argument in
24  * CNetworkOfPoses class instances for use in multiple-robot SLAM applications
25  *
26  * \ingroup mrpt_graphs_grp
27  */
29 {
31 
34 
37  : parent_t(other)
38  {
39  this->setAnnots(other);
40  }
41 
43  {
44  self_t* annots = new self_t(*this);
45  return annots;
46  }
47  bool setAnnots(const parent_t& other)
48  {
49  parent_t::setAnnots(other);
50 
51  bool res;
52  const self_t* mr_slam_annots = dynamic_cast<const self_t*>(&other);
53  if (mr_slam_annots)
54  {
55  this->agent_ID_str = mr_slam_annots->agent_ID_str;
56  this->nodeID_loc = mr_slam_annots->nodeID_loc;
57  res = true;
58  }
59  else
60  {
61  res = false;
62  }
63 
64  return res;
65  }
66 
67  bool operator==(const TNodeAnnotations& other) const
68  {
69  const TMRSlamNodeAnnotations* mr_slam_annots =
70  dynamic_cast<const TMRSlamNodeAnnotations*>(&other);
71 
72  bool res = false;
73  if (mr_slam_annots)
74  {
75  res =
76  (this->agent_ID_str == mr_slam_annots->agent_ID_str &&
77  this->nodeID_loc == mr_slam_annots->nodeID_loc);
78  }
79 
80  return res;
81  }
82 
84  {
86 
87  std::stringstream ss;
88  ss << "agent_ID_str: " << agent_ID_str << "| "
89  << "nodeID_loc: " << nodeID_loc;
90 
91  s->clear();
92  *s = ss.str();
93  }
94 
95  /**\brief string identifier of the SLAM Agent that initially registered this
96  * node. */
98  /**\brief ID of node in the graph of the SLAM Agent that initially
99  * registered
100  * this node.
101  *
102  * \note Field is handy especially in cases where one SLAM agent
103  * communicates
104  * its local graph to another agent and we still want to keep track of the
105  * node ID in the former's graph.
106  */
108 };
109 } // namespace detail
110 } // namespace graphs
111 } // namespace mrpt
112 #endif /* end of include guard: TMRSLAMNODEANNOTATIONS_H */
s
GLdouble s
Definition: glext.h:3676
mrpt::graphs::detail::TMRSlamNodeAnnotations::getAnnotsAsString
void getAnnotsAsString(std::string *s) const
Definition: TMRSlamNodeAnnotations.h:83
mrpt::graphs::detail::TMRSlamNodeAnnotations::agent_ID_str
std::string agent_ID_str
string identifier of the SLAM Agent that initially registered this node.
Definition: TMRSlamNodeAnnotations.h:97
mrpt::graphs::detail::TMRSlamNodeAnnotations::setAnnots
bool setAnnots(const parent_t &other)
Definition: TMRSlamNodeAnnotations.h:47
mrpt::graphs::detail::TMRSlamNodeAnnotations::nodeID_loc
mrpt::graphs::TNodeID nodeID_loc
ID of node in the graph of the SLAM Agent that initially registered this node.
Definition: TMRSlamNodeAnnotations.h:107
mrpt::graphs::detail::TMRSlamNodeAnnotations::self_t
TMRSlamNodeAnnotations self_t
Definition: TMRSlamNodeAnnotations.h:33
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:17
DECLARE_TTYPENAME_CLASSNAME
#define DECLARE_TTYPENAME_CLASSNAME(_CLASSNAME)
Like DECLARE_CUSTOM_TTYPENAME(), but for use within the class declaration body.
Definition: TTypeName.h:100
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::graphs::detail::TMRSlamNodeAnnotations
Struct to be used as the NODE_ANNOTATIONS template argument in CNetworkOfPoses class instances for us...
Definition: TMRSlamNodeAnnotations.h:28
mrpt::graphs::detail::TNodeAnnotations::setAnnots
bool setAnnots(const self_t &other)
Set the properties of the current TNodeAnnotations object.
Definition: TNodeAnnotations.h:68
mrpt::graphs::detail::TMRSlamNodeAnnotations::TMRSlamNodeAnnotations
TMRSlamNodeAnnotations(const TMRSlamNodeAnnotations &other)
Definition: TMRSlamNodeAnnotations.h:36
res
GLuint res
Definition: glext.h:7268
mrpt::graphs::detail::TMRSlamNodeAnnotations::operator==
bool operator==(const TNodeAnnotations &other) const
Definition: TMRSlamNodeAnnotations.h:67
mrpt::graphs::detail::TMRSlamNodeAnnotations::getCopyOfAnnots
TNodeAnnotations * getCopyOfAnnots() const
Definition: TMRSlamNodeAnnotations.h:42
TNodeAnnotations.h
mrpt::graphs::detail::TNodeAnnotations::getAnnotsAsString
virtual void getAnnotsAsString(std::string *s) const
Definition: TNodeAnnotations.h:41
string
GLsizei const GLchar ** string
Definition: glext.h:4101
INVALID_NODEID
#define INVALID_NODEID
Definition: TNodeID.h:20
mrpt::graphs::detail::TNodeAnnotations
Abstract class from which NodeAnnotations related classes can be implemented.
Definition: TNodeAnnotations.h:31



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