YARP
Yet Another Robot Platform
SetMap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 // This is an automatically generated file.
10 
11 // Generated from the following "nav_msgs/SetMap" msg definition:
12 // # Set a new map together with an initial pose
13 // nav_msgs/OccupancyGrid map
14 // geometry_msgs/PoseWithCovarianceStamped initial_pose
15 // ---
16 // bool success
17 //
18 // Instances of this class can be read and written with YARP ports,
19 // using a ROS-compatible format.
20 
21 #ifndef YARP_ROSMSG_nav_msgs_SetMap_h
22 #define YARP_ROSMSG_nav_msgs_SetMap_h
23 
24 #include <yarp/os/Wire.h>
25 #include <yarp/os/Type.h>
26 #include <yarp/os/idl/WireTypes.h>
27 #include <string>
28 #include <vector>
31 
32 namespace yarp {
33 namespace rosmsg {
34 namespace nav_msgs {
35 
37 {
38 public:
41 
42  SetMap() :
43  map(),
44  initial_pose()
45  {
46  }
47 
48  void clear()
49  {
50  // *** map ***
51  map.clear();
52 
53  // *** initial_pose ***
55  }
56 
57  bool readBare(yarp::os::ConnectionReader& connection) override
58  {
59  // *** map ***
60  if (!map.read(connection)) {
61  return false;
62  }
63 
64  // *** initial_pose ***
65  if (!initial_pose.read(connection)) {
66  return false;
67  }
68 
69  return !connection.isError();
70  }
71 
72  bool readBottle(yarp::os::ConnectionReader& connection) override
73  {
74  connection.convertTextMode();
75  yarp::os::idl::WireReader reader(connection);
76  if (!reader.readListHeader(2)) {
77  return false;
78  }
79 
80  // *** map ***
81  if (!map.read(connection)) {
82  return false;
83  }
84 
85  // *** initial_pose ***
86  if (!initial_pose.read(connection)) {
87  return false;
88  }
89 
90  return !connection.isError();
91  }
92 
94  bool read(yarp::os::ConnectionReader& connection) override
95  {
96  return (connection.isBareMode() ? readBare(connection)
97  : readBottle(connection));
98  }
99 
100  bool writeBare(yarp::os::ConnectionWriter& connection) const override
101  {
102  // *** map ***
103  if (!map.write(connection)) {
104  return false;
105  }
106 
107  // *** initial_pose ***
108  if (!initial_pose.write(connection)) {
109  return false;
110  }
111 
112  return !connection.isError();
113  }
114 
115  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
116  {
117  connection.appendInt32(BOTTLE_TAG_LIST);
118  connection.appendInt32(2);
119 
120  // *** map ***
121  if (!map.write(connection)) {
122  return false;
123  }
124 
125  // *** initial_pose ***
126  if (!initial_pose.write(connection)) {
127  return false;
128  }
129 
130  connection.convertTextMode();
131  return !connection.isError();
132  }
133 
135  bool write(yarp::os::ConnectionWriter& connection) const override
136  {
137  return (connection.isBareMode() ? writeBare(connection)
138  : writeBottle(connection));
139  }
140 
141  // This class will serialize ROS style or YARP style depending on protocol.
142  // If you need to force a serialization style, use one of these classes:
145 
146  // The name for this message, ROS will need this
147  static constexpr const char* typeName = "nav_msgs/SetMap";
148 
149  // The checksum for this message, ROS will need this
150  static constexpr const char* typeChecksum = "91149a20d7be299b87c340df8cc94fd4";
151 
152  // The source text for this message, ROS will need this
153  static constexpr const char* typeText = "\
154 # Set a new map together with an initial pose\n\
155 nav_msgs/OccupancyGrid map\n\
156 geometry_msgs/PoseWithCovarianceStamped initial_pose\n\
157 ---\n\
158 bool success\n\
159 \n\
160 \n\
161 ================================================================================\n\
162 MSG: nav_msgs/OccupancyGrid\n\
163 # This represents a 2-D grid map, in which each cell represents the probability of\n\
164 # occupancy.\n\
165 \n\
166 Header header \n\
167 \n\
168 #MetaData for the map\n\
169 MapMetaData info\n\
170 \n\
171 # The map data, in row-major order, starting with (0,0). Occupancy\n\
172 # probabilities are in the range [0,100]. Unknown is -1.\n\
173 int8[] data\n\
174 \n\
175 ================================================================================\n\
176 MSG: std_msgs/Header\n\
177 # Standard metadata for higher-level stamped data types.\n\
178 # This is generally used to communicate timestamped data \n\
179 # in a particular coordinate frame.\n\
180 # \n\
181 # sequence ID: consecutively increasing ID \n\
182 uint32 seq\n\
183 #Two-integer timestamp that is expressed as:\n\
184 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
185 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
186 # time-handling sugar is provided by the client library\n\
187 time stamp\n\
188 #Frame this data is associated with\n\
189 # 0: no frame\n\
190 # 1: global frame\n\
191 string frame_id\n\
192 \n\
193 ================================================================================\n\
194 MSG: nav_msgs/MapMetaData\n\
195 # This hold basic information about the characterists of the OccupancyGrid\n\
196 \n\
197 # The time at which the map was loaded\n\
198 time map_load_time\n\
199 # The map resolution [m/cell]\n\
200 float32 resolution\n\
201 # Map width [cells]\n\
202 uint32 width\n\
203 # Map height [cells]\n\
204 uint32 height\n\
205 # The origin of the map [m, m, rad]. This is the real-world pose of the\n\
206 # cell (0,0) in the map.\n\
207 geometry_msgs/Pose origin\n\
208 ================================================================================\n\
209 MSG: geometry_msgs/Pose\n\
210 # A representation of pose in free space, composed of position and orientation. \n\
211 Point position\n\
212 Quaternion orientation\n\
213 \n\
214 ================================================================================\n\
215 MSG: geometry_msgs/Point\n\
216 # This contains the position of a point in free space\n\
217 float64 x\n\
218 float64 y\n\
219 float64 z\n\
220 \n\
221 ================================================================================\n\
222 MSG: geometry_msgs/Quaternion\n\
223 # This represents an orientation in free space in quaternion form.\n\
224 \n\
225 float64 x\n\
226 float64 y\n\
227 float64 z\n\
228 float64 w\n\
229 \n\
230 ================================================================================\n\
231 MSG: geometry_msgs/PoseWithCovarianceStamped\n\
232 # This expresses an estimated pose with a reference coordinate frame and timestamp\n\
233 \n\
234 Header header\n\
235 PoseWithCovariance pose\n\
236 \n\
237 ================================================================================\n\
238 MSG: geometry_msgs/PoseWithCovariance\n\
239 # This represents a pose in free space with uncertainty.\n\
240 \n\
241 Pose pose\n\
242 \n\
243 # Row-major representation of the 6x6 covariance matrix\n\
244 # The orientation parameters use a fixed-axis representation.\n\
245 # In order, the parameters are:\n\
246 # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)\n\
247 float64[36] covariance\n\
248 ";
249 
250  yarp::os::Type getType() const override
251  {
253  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
254  typ.addProperty("message_definition", yarp::os::Value(typeText));
255  return typ;
256  }
257 };
258 
259 } // namespace nav_msgs
260 } // namespace rosmsg
261 } // namespace yarp
262 
263 #endif // YARP_ROSMSG_nav_msgs_SetMap_h
yarp::rosmsg::nav_msgs::OccupancyGrid::clear
void clear()
Definition: OccupancyGrid.h:55
yarp::rosmsg::geometry_msgs::PoseWithCovarianceStamped::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: PoseWithCovarianceStamped.h:92
yarp::rosmsg::nav_msgs::SetMap::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: SetMap.h:115
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:22
yarp::os::Type
Definition: Type.h:24
yarp::os::idl::WirePortable::read
virtual bool read(yarp::os::idl::WireReader &reader)
Definition: WirePortable.cpp:14
yarp::rosmsg::nav_msgs::SetMap::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::nav_msgs::SetMap > rosStyle
Definition: SetMap.h:143
yarp::rosmsg::nav_msgs::SetMap::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::nav_msgs::SetMap > bottleStyle
Definition: SetMap.h:144
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
yarp::rosmsg::nav_msgs::SetMap::getType
yarp::os::Type getType() const override
Definition: SetMap.h:250
yarp::rosmsg::nav_msgs::SetMap::typeText
static constexpr const char * typeText
Definition: SetMap.h:153
yarp::rosmsg::nav_msgs::SetMap::initial_pose
yarp::rosmsg::geometry_msgs::PoseWithCovarianceStamped initial_pose
Definition: SetMap.h:40
yarp::rosmsg::nav_msgs::SetMap::SetMap
SetMap()
Definition: SetMap.h:42
yarp::rosmsg::nav_msgs::OccupancyGrid::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: OccupancyGrid.h:175
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::geometry_msgs::PoseWithCovarianceStamped
Definition: PoseWithCovarianceStamped.h:35
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
OccupancyGrid.h
yarp::rosmsg::nav_msgs::SetMap::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: SetMap.h:94
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
PoseWithCovarianceStamped.h
yarp::os::ConnectionReader::convertTextMode
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
yarp::rosmsg::nav_msgs::SetMap::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: SetMap.h:72
yarp::rosmsg::nav_msgs::SetMap::typeChecksum
static constexpr const char * typeChecksum
Definition: SetMap.h:150
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::PoseWithCovarianceStamped::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: PoseWithCovarianceStamped.h:133
yarp::os::ConnectionWriter::convertTextMode
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
yarp::os::ConnectionWriter::appendInt32
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
nav_msgs
Definition: GetMap.h:22
yarp::os::idl::WireReader
IDL-friendly connection reader.
Definition: WireReader.h:33
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::nav_msgs::SetMap::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: SetMap.h:57
yarp::rosmsg::nav_msgs::SetMap::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: SetMap.h:100
yarp::rosmsg::nav_msgs::OccupancyGrid
Definition: OccupancyGrid.h:42
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::nav_msgs::SetMap::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: SetMap.h:135
yarp::rosmsg::nav_msgs::SetMap::typeName
static constexpr const char * typeName
Definition: SetMap.h:147
yarp::rosmsg::nav_msgs::OccupancyGrid::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: OccupancyGrid.h:121
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::nav_msgs::SetMap::map
yarp::rosmsg::nav_msgs::OccupancyGrid map
Definition: SetMap.h:39
yarp::rosmsg::nav_msgs::SetMap
Definition: SetMap.h:37
yarp::rosmsg::nav_msgs::SetMap::clear
void clear()
Definition: SetMap.h:48
yarp::rosmsg::geometry_msgs::PoseWithCovarianceStamped::clear
void clear()
Definition: PoseWithCovarianceStamped.h:46
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20