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