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