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