YARP
Yet Another Robot Platform
PoseStamped.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 // This is an automatically generated file.
7 
8 // Generated from the following "geometry_msgs/PoseStamped" msg definition:
9 // # A Pose with reference coordinate frame and timestamp
10 // Header header
11 // Pose pose
12 // Instances of this class can be read and written with YARP ports,
13 // using a ROS-compatible format.
14 
15 #ifndef YARP_ROSMSG_geometry_msgs_PoseStamped_h
16 #define YARP_ROSMSG_geometry_msgs_PoseStamped_h
17 
18 #include <yarp/os/Wire.h>
19 #include <yarp/os/Type.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <string>
22 #include <vector>
25 
26 namespace yarp {
27 namespace rosmsg {
28 namespace geometry_msgs {
29 
31 {
32 public:
35 
37  header(),
38  pose()
39  {
40  }
41 
42  void clear()
43  {
44  // *** header ***
45  header.clear();
46 
47  // *** pose ***
48  pose.clear();
49  }
50 
51  bool readBare(yarp::os::ConnectionReader& connection) override
52  {
53  // *** header ***
54  if (!header.read(connection)) {
55  return false;
56  }
57 
58  // *** pose ***
59  if (!pose.read(connection)) {
60  return false;
61  }
62 
63  return !connection.isError();
64  }
65 
66  bool readBottle(yarp::os::ConnectionReader& connection) override
67  {
68  connection.convertTextMode();
69  yarp::os::idl::WireReader reader(connection);
70  if (!reader.readListHeader(2)) {
71  return false;
72  }
73 
74  // *** header ***
75  if (!header.read(connection)) {
76  return false;
77  }
78 
79  // *** pose ***
80  if (!pose.read(connection)) {
81  return false;
82  }
83 
84  return !connection.isError();
85  }
86 
88  bool read(yarp::os::ConnectionReader& connection) override
89  {
90  return (connection.isBareMode() ? readBare(connection)
91  : readBottle(connection));
92  }
93 
94  bool writeBare(yarp::os::ConnectionWriter& connection) const override
95  {
96  // *** header ***
97  if (!header.write(connection)) {
98  return false;
99  }
100 
101  // *** pose ***
102  if (!pose.write(connection)) {
103  return false;
104  }
105 
106  return !connection.isError();
107  }
108 
109  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
110  {
111  connection.appendInt32(BOTTLE_TAG_LIST);
112  connection.appendInt32(2);
113 
114  // *** header ***
115  if (!header.write(connection)) {
116  return false;
117  }
118 
119  // *** pose ***
120  if (!pose.write(connection)) {
121  return false;
122  }
123 
124  connection.convertTextMode();
125  return !connection.isError();
126  }
127 
129  bool write(yarp::os::ConnectionWriter& connection) const override
130  {
131  return (connection.isBareMode() ? writeBare(connection)
132  : writeBottle(connection));
133  }
134 
135  // This class will serialize ROS style or YARP style depending on protocol.
136  // If you need to force a serialization style, use one of these classes:
139 
140  // The name for this message, ROS will need this
141  static constexpr const char* typeName = "geometry_msgs/PoseStamped";
142 
143  // The checksum for this message, ROS will need this
144  static constexpr const char* typeChecksum = "d3812c3cbc69362b77dc0b19b345f8f5";
145 
146  // The source text for this message, ROS will need this
147  static constexpr const char* typeText = "\
148 # A Pose with reference coordinate frame and timestamp\n\
149 Header header\n\
150 Pose pose\n\
151 \n\
152 ================================================================================\n\
153 MSG: std_msgs/Header\n\
154 # Standard metadata for higher-level stamped data types.\n\
155 # This is generally used to communicate timestamped data \n\
156 # in a particular coordinate frame.\n\
157 # \n\
158 # sequence ID: consecutively increasing ID \n\
159 uint32 seq\n\
160 #Two-integer timestamp that is expressed as:\n\
161 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
162 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
163 # time-handling sugar is provided by the client library\n\
164 time stamp\n\
165 #Frame this data is associated with\n\
166 # 0: no frame\n\
167 # 1: global frame\n\
168 string frame_id\n\
169 \n\
170 ================================================================================\n\
171 MSG: geometry_msgs/Pose\n\
172 # A representation of pose in free space, composed of position and orientation. \n\
173 Point position\n\
174 Quaternion orientation\n\
175 \n\
176 ================================================================================\n\
177 MSG: geometry_msgs/Point\n\
178 # This contains the position of a point in free space\n\
179 float64 x\n\
180 float64 y\n\
181 float64 z\n\
182 \n\
183 ================================================================================\n\
184 MSG: geometry_msgs/Quaternion\n\
185 # This represents an orientation in free space in quaternion form.\n\
186 \n\
187 float64 x\n\
188 float64 y\n\
189 float64 z\n\
190 float64 w\n\
191 ";
192 
193  yarp::os::Type getType() const override
194  {
196  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
197  typ.addProperty("message_definition", yarp::os::Value(typeText));
198  return typ;
199  }
200 };
201 
202 } // namespace geometry_msgs
203 } // namespace rosmsg
204 } // namespace yarp
205 
206 #endif // YARP_ROSMSG_geometry_msgs_PoseStamped_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:30
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: PoseStamped.h:109
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: PoseStamped.h:129
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: PoseStamped.h:66
static constexpr const char * typeText
Definition: PoseStamped.h:147
static constexpr const char * typeName
Definition: PoseStamped.h:141
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: PoseStamped.h:51
yarp::rosmsg::geometry_msgs::Pose pose
Definition: PoseStamped.h:34
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::PoseStamped > rosStyle
Definition: PoseStamped.h:137
yarp::rosmsg::std_msgs::Header header
Definition: PoseStamped.h:33
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: PoseStamped.h:94
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: PoseStamped.h:88
yarp::os::Type getType() const override
Definition: PoseStamped.h:193
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::PoseStamped > bottleStyle
Definition: PoseStamped.h:138
static constexpr const char * typeChecksum
Definition: PoseStamped.h:144
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose.h:129
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose.h:88
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:159
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:112
The main, catch-all namespace for YARP.
Definition: dirs.h:16