YARP
Yet Another Robot Platform
TransformStamped.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/TransformStamped" msg definition:
9 // # This expresses a transform from coordinate frame header.frame_id
10 // # to the coordinate frame child_frame_id
11 // #
12 // # This message is mostly used by the
13 // # <a href="http://wiki.ros.org/tf">tf</a> package.
14 // # See its documentation for more information.
15 //
16 // Header header
17 // string child_frame_id # the frame id of the child frame
18 // Transform transform
19 // Instances of this class can be read and written with YARP ports,
20 // using a ROS-compatible format.
21 
22 #ifndef YARP_ROSMSG_geometry_msgs_TransformStamped_h
23 #define YARP_ROSMSG_geometry_msgs_TransformStamped_h
24 
25 #include <yarp/os/Wire.h>
26 #include <yarp/os/Type.h>
27 #include <yarp/os/idl/WireTypes.h>
28 #include <string>
29 #include <vector>
32 
33 namespace yarp {
34 namespace rosmsg {
35 namespace geometry_msgs {
36 
38 {
39 public:
41  std::string child_frame_id;
43 
45  header(),
46  child_frame_id(""),
47  transform()
48  {
49  }
50 
51  void clear()
52  {
53  // *** header ***
54  header.clear();
55 
56  // *** child_frame_id ***
57  child_frame_id = "";
58 
59  // *** transform ***
60  transform.clear();
61  }
62 
63  bool readBare(yarp::os::ConnectionReader& connection) override
64  {
65  // *** header ***
66  if (!header.read(connection)) {
67  return false;
68  }
69 
70  // *** child_frame_id ***
71  int len = connection.expectInt32();
72  child_frame_id.resize(len);
73  if (!connection.expectBlock((char*)child_frame_id.c_str(), len)) {
74  return false;
75  }
76 
77  // *** transform ***
78  if (!transform.read(connection)) {
79  return false;
80  }
81 
82  return !connection.isError();
83  }
84 
85  bool readBottle(yarp::os::ConnectionReader& connection) override
86  {
87  connection.convertTextMode();
88  yarp::os::idl::WireReader reader(connection);
89  if (!reader.readListHeader(3)) {
90  return false;
91  }
92 
93  // *** header ***
94  if (!header.read(connection)) {
95  return false;
96  }
97 
98  // *** child_frame_id ***
99  if (!reader.readString(child_frame_id)) {
100  return false;
101  }
102 
103  // *** transform ***
104  if (!transform.read(connection)) {
105  return false;
106  }
107 
108  return !connection.isError();
109  }
110 
112  bool read(yarp::os::ConnectionReader& connection) override
113  {
114  return (connection.isBareMode() ? readBare(connection)
115  : readBottle(connection));
116  }
117 
118  bool writeBare(yarp::os::ConnectionWriter& connection) const override
119  {
120  // *** header ***
121  if (!header.write(connection)) {
122  return false;
123  }
124 
125  // *** child_frame_id ***
126  connection.appendInt32(child_frame_id.length());
127  connection.appendExternalBlock((char*)child_frame_id.c_str(), child_frame_id.length());
128 
129  // *** transform ***
130  if (!transform.write(connection)) {
131  return false;
132  }
133 
134  return !connection.isError();
135  }
136 
137  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
138  {
139  connection.appendInt32(BOTTLE_TAG_LIST);
140  connection.appendInt32(3);
141 
142  // *** header ***
143  if (!header.write(connection)) {
144  return false;
145  }
146 
147  // *** child_frame_id ***
148  connection.appendInt32(BOTTLE_TAG_STRING);
149  connection.appendInt32(child_frame_id.length());
150  connection.appendExternalBlock((char*)child_frame_id.c_str(), child_frame_id.length());
151 
152  // *** transform ***
153  if (!transform.write(connection)) {
154  return false;
155  }
156 
157  connection.convertTextMode();
158  return !connection.isError();
159  }
160 
162  bool write(yarp::os::ConnectionWriter& connection) const override
163  {
164  return (connection.isBareMode() ? writeBare(connection)
165  : writeBottle(connection));
166  }
167 
168  // This class will serialize ROS style or YARP style depending on protocol.
169  // If you need to force a serialization style, use one of these classes:
172 
173  // The name for this message, ROS will need this
174  static constexpr const char* typeName = "geometry_msgs/TransformStamped";
175 
176  // The checksum for this message, ROS will need this
177  static constexpr const char* typeChecksum = "b5764a33bfeb3588febc2682852579b0";
178 
179  // The source text for this message, ROS will need this
180  static constexpr const char* typeText = "\
181 # This expresses a transform from coordinate frame header.frame_id\n\
182 # to the coordinate frame child_frame_id\n\
183 #\n\
184 # This message is mostly used by the \n\
185 # <a href=\"http://wiki.ros.org/tf\">tf</a> package. \n\
186 # See its documentation for more information.\n\
187 \n\
188 Header header\n\
189 string child_frame_id # the frame id of the child frame\n\
190 Transform transform\n\
191 \n\
192 ================================================================================\n\
193 MSG: std_msgs/Header\n\
194 # Standard metadata for higher-level stamped data types.\n\
195 # This is generally used to communicate timestamped data \n\
196 # in a particular coordinate frame.\n\
197 # \n\
198 # sequence ID: consecutively increasing ID \n\
199 uint32 seq\n\
200 #Two-integer timestamp that is expressed as:\n\
201 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
202 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
203 # time-handling sugar is provided by the client library\n\
204 time stamp\n\
205 #Frame this data is associated with\n\
206 # 0: no frame\n\
207 # 1: global frame\n\
208 string frame_id\n\
209 \n\
210 ================================================================================\n\
211 MSG: geometry_msgs/Transform\n\
212 # This represents the transform between two coordinate frames in free space.\n\
213 \n\
214 Vector3 translation\n\
215 Quaternion rotation\n\
216 \n\
217 ================================================================================\n\
218 MSG: geometry_msgs/Vector3\n\
219 # This represents a vector in free space. \n\
220 # It is only meant to represent a direction. Therefore, it does not\n\
221 # make sense to apply a translation to it (e.g., when applying a \n\
222 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
223 # rotation). If you want your data to be translatable too, use the\n\
224 # geometry_msgs/Point message instead.\n\
225 \n\
226 float64 x\n\
227 float64 y\n\
228 float64 z\n\
229 ================================================================================\n\
230 MSG: geometry_msgs/Quaternion\n\
231 # This represents an orientation in free space in quaternion form.\n\
232 \n\
233 float64 x\n\
234 float64 y\n\
235 float64 z\n\
236 float64 w\n\
237 ";
238 
239  yarp::os::Type getType() const override
240  {
242  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
243  typ.addProperty("message_definition", yarp::os::Value(typeText));
244  return typ;
245  }
246 };
247 
248 } // namespace geometry_msgs
249 } // namespace rosmsg
250 } // namespace yarp
251 
252 #endif // YARP_ROSMSG_geometry_msgs_TransformStamped_h
#define BOTTLE_TAG_STRING
Definition: Bottle.h:26
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
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 void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
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 readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:382
bool readBare(yarp::os::ConnectionReader &connection) override
bool writeBare(yarp::os::ConnectionWriter &connection) const override
yarp::rosmsg::geometry_msgs::Transform transform
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::TransformStamped > bottleStyle
static constexpr const char * typeChecksum
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::os::Type getType() const override
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::TransformStamped > rosStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Transform.h:89
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Transform.h:130
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