YARP
Yet Another Robot Platform
Path.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/Path" msg definition:
12 // #An array of poses that represents a Path for a robot to follow
13 // Header header
14 // geometry_msgs/PoseStamped[] poses
15 // Instances of this class can be read and written with YARP ports,
16 // using a ROS-compatible format.
17 
18 #ifndef YARP_ROSMSG_nav_msgs_Path_h
19 #define YARP_ROSMSG_nav_msgs_Path_h
20 
21 #include <yarp/os/Wire.h>
22 #include <yarp/os/Type.h>
23 #include <yarp/os/idl/WireTypes.h>
24 #include <string>
25 #include <vector>
28 
29 namespace yarp {
30 namespace rosmsg {
31 namespace nav_msgs {
32 
34 {
35 public:
37  std::vector<yarp::rosmsg::geometry_msgs::PoseStamped> poses;
38 
39  Path() :
40  header(),
41  poses()
42  {
43  }
44 
45  void clear()
46  {
47  // *** header ***
48  header.clear();
49 
50  // *** poses ***
51  poses.clear();
52  }
53 
54  bool readBare(yarp::os::ConnectionReader& connection) override
55  {
56  // *** header ***
57  if (!header.read(connection)) {
58  return false;
59  }
60 
61  // *** poses ***
62  int len = connection.expectInt32();
63  poses.resize(len);
64  for (int i=0; i<len; i++) {
65  if (!poses[i].read(connection)) {
66  return false;
67  }
68  }
69 
70  return !connection.isError();
71  }
72 
73  bool readBottle(yarp::os::ConnectionReader& connection) override
74  {
75  connection.convertTextMode();
76  yarp::os::idl::WireReader reader(connection);
77  if (!reader.readListHeader(2)) {
78  return false;
79  }
80 
81  // *** header ***
82  if (!header.read(connection)) {
83  return false;
84  }
85 
86  // *** poses ***
87  if (connection.expectInt32() != BOTTLE_TAG_LIST) {
88  return false;
89  }
90  int len = connection.expectInt32();
91  poses.resize(len);
92  for (int i=0; i<len; i++) {
93  if (!poses[i].read(connection)) {
94  return false;
95  }
96  }
97 
98  return !connection.isError();
99  }
100 
102  bool read(yarp::os::ConnectionReader& connection) override
103  {
104  return (connection.isBareMode() ? readBare(connection)
105  : readBottle(connection));
106  }
107 
108  bool writeBare(yarp::os::ConnectionWriter& connection) const override
109  {
110  // *** header ***
111  if (!header.write(connection)) {
112  return false;
113  }
114 
115  // *** poses ***
116  connection.appendInt32(poses.size());
117  for (size_t i=0; i<poses.size(); i++) {
118  if (!poses[i].write(connection)) {
119  return false;
120  }
121  }
122 
123  return !connection.isError();
124  }
125 
126  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
127  {
128  connection.appendInt32(BOTTLE_TAG_LIST);
129  connection.appendInt32(2);
130 
131  // *** header ***
132  if (!header.write(connection)) {
133  return false;
134  }
135 
136  // *** poses ***
137  connection.appendInt32(BOTTLE_TAG_LIST);
138  connection.appendInt32(poses.size());
139  for (size_t i=0; i<poses.size(); i++) {
140  if (!poses[i].write(connection)) {
141  return false;
142  }
143  }
144 
145  connection.convertTextMode();
146  return !connection.isError();
147  }
148 
150  bool write(yarp::os::ConnectionWriter& connection) const override
151  {
152  return (connection.isBareMode() ? writeBare(connection)
153  : writeBottle(connection));
154  }
155 
156  // This class will serialize ROS style or YARP style depending on protocol.
157  // If you need to force a serialization style, use one of these classes:
160 
161  // The name for this message, ROS will need this
162  static constexpr const char* typeName = "nav_msgs/Path";
163 
164  // The checksum for this message, ROS will need this
165  static constexpr const char* typeChecksum = "6227e2b7e9cce15051f669a5e197bbf7";
166 
167  // The source text for this message, ROS will need this
168  static constexpr const char* typeText = "\
169 #An array of poses that represents a Path for a robot to follow\n\
170 Header header\n\
171 geometry_msgs/PoseStamped[] poses\n\
172 \n\
173 ================================================================================\n\
174 MSG: std_msgs/Header\n\
175 # Standard metadata for higher-level stamped data types.\n\
176 # This is generally used to communicate timestamped data \n\
177 # in a particular coordinate frame.\n\
178 # \n\
179 # sequence ID: consecutively increasing ID \n\
180 uint32 seq\n\
181 #Two-integer timestamp that is expressed as:\n\
182 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
183 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
184 # time-handling sugar is provided by the client library\n\
185 time stamp\n\
186 #Frame this data is associated with\n\
187 # 0: no frame\n\
188 # 1: global frame\n\
189 string frame_id\n\
190 \n\
191 ================================================================================\n\
192 MSG: geometry_msgs/PoseStamped\n\
193 # A Pose with reference coordinate frame and timestamp\n\
194 Header header\n\
195 Pose pose\n\
196 \n\
197 ================================================================================\n\
198 MSG: geometry_msgs/Pose\n\
199 # A representation of pose in free space, composed of position and orientation. \n\
200 Point position\n\
201 Quaternion orientation\n\
202 \n\
203 ================================================================================\n\
204 MSG: geometry_msgs/Point\n\
205 # This contains the position of a point in free space\n\
206 float64 x\n\
207 float64 y\n\
208 float64 z\n\
209 \n\
210 ================================================================================\n\
211 MSG: geometry_msgs/Quaternion\n\
212 # This represents an orientation in free space in quaternion form.\n\
213 \n\
214 float64 x\n\
215 float64 y\n\
216 float64 z\n\
217 float64 w\n\
218 ";
219 
220  yarp::os::Type getType() const override
221  {
223  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
224  typ.addProperty("message_definition", yarp::os::Value(typeText));
225  return typ;
226  }
227 };
228 
229 } // namespace nav_msgs
230 } // namespace rosmsg
231 } // namespace yarp
232 
233 #endif // YARP_ROSMSG_nav_msgs_Path_h
yarp::rosmsg::nav_msgs::Path::typeChecksum
static constexpr const char * typeChecksum
Definition: Path.h:165
yarp::rosmsg::std_msgs::Header::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:115
yarp::rosmsg::nav_msgs::Path::getType
yarp::os::Type getType() const override
Definition: Path.h:220
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::nav_msgs::Path
Definition: Path.h:34
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:22
yarp::os::Type
Definition: Type.h:24
yarp::rosmsg::nav_msgs::Path::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Path.h:102
yarp::os::idl::WirePortable::read
virtual bool read(yarp::os::idl::WireReader &reader)
Definition: WirePortable.cpp:14
Header.h
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::std_msgs::Header::clear
void clear()
Definition: Header.h:58
Wire.h
yarp::rosmsg::nav_msgs::Path::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Path.h:126
yarp::rosmsg::nav_msgs::Path::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Path.h:108
yarp::rosmsg::nav_msgs::Path::typeText
static constexpr const char * typeText
Definition: Path.h:168
yarp::rosmsg::nav_msgs::Path::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::nav_msgs::Path > bottleStyle
Definition: Path.h:159
yarp::rosmsg::nav_msgs::Path::typeName
static constexpr const char * typeName
Definition: Path.h:162
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::ConnectionReader::expectInt32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
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
yarp::rosmsg::nav_msgs::Path::clear
void clear()
Definition: Path.h:45
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
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::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::nav_msgs::Path::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Path.h:73
yarp::rosmsg::std_msgs::Header::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:162
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::rosmsg::nav_msgs::Path::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Path.h:54
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::Path::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Path.h:150
yarp::rosmsg::nav_msgs::Path::poses
std::vector< yarp::rosmsg::geometry_msgs::PoseStamped > poses
Definition: Path.h:37
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::nav_msgs::Path::header
yarp::rosmsg::std_msgs::Header header
Definition: Path.h:36
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::nav_msgs::Path::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::nav_msgs::Path > rosStyle
Definition: Path.h:158
yarp::rosmsg::std_msgs::Header
Definition: Header.h:45
PoseStamped.h
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::nav_msgs::Path::Path
Path()
Definition: Path.h:39
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20