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



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