YARP
Yet Another Robot Platform
TwistStamped.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/TwistStamped" msg definition:
9 // # A twist with reference coordinate frame and timestamp
10 // Header header
11 // Twist twist
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_TwistStamped_h
16 #define YARP_ROSMSG_geometry_msgs_TwistStamped_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  twist()
39  {
40  }
41 
42  void clear()
43  {
44  // *** header ***
45  header.clear();
46 
47  // *** twist ***
48  twist.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  // *** twist ***
59  if (!twist.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  // *** twist ***
80  if (!twist.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  // *** twist ***
102  if (!twist.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  // *** twist ***
120  if (!twist.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/TwistStamped";
142 
143  // The checksum for this message, ROS will need this
144  static constexpr const char* typeChecksum = "98d34b0043a2093cf9d9345ab6eef12e";
145 
146  // The source text for this message, ROS will need this
147  static constexpr const char* typeText = "\
148 # A twist with reference coordinate frame and timestamp\n\
149 Header header\n\
150 Twist twist\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/Twist\n\
172 # This expresses velocity in free space broken into its linear and angular parts.\n\
173 Vector3 linear\n\
174 Vector3 angular\n\
175 \n\
176 ================================================================================\n\
177 MSG: geometry_msgs/Vector3\n\
178 # This represents a vector in free space. \n\
179 # It is only meant to represent a direction. Therefore, it does not\n\
180 # make sense to apply a translation to it (e.g., when applying a \n\
181 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
182 # rotation). If you want your data to be translatable too, use the\n\
183 # geometry_msgs/Point message instead.\n\
184 \n\
185 float64 x\n\
186 float64 y\n\
187 float64 z\n\
188 ";
189 
190  yarp::os::Type getType() const override
191  {
193  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
194  typ.addProperty("message_definition", yarp::os::Value(typeText));
195  return typ;
196  }
197 };
198 
199 } // namespace geometry_msgs
200 } // namespace rosmsg
201 } // namespace yarp
202 
203 #endif // YARP_ROSMSG_geometry_msgs_TwistStamped_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 readBare(yarp::os::ConnectionReader &connection) override
Definition: TwistStamped.h:51
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: TwistStamped.h:109
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: TwistStamped.h:66
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: TwistStamped.h:94
yarp::rosmsg::std_msgs::Header header
Definition: TwistStamped.h:33
yarp::rosmsg::geometry_msgs::Twist twist
Definition: TwistStamped.h:34
static constexpr const char * typeName
Definition: TwistStamped.h:141
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::TwistStamped > bottleStyle
Definition: TwistStamped.h:138
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TwistStamped.h:129
yarp::os::Type getType() const override
Definition: TwistStamped.h:190
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::TwistStamped > rosStyle
Definition: TwistStamped.h:137
static constexpr const char * typeText
Definition: TwistStamped.h:147
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TwistStamped.h:88
static constexpr const char * typeChecksum
Definition: TwistStamped.h:144
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Twist.h:128
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Twist.h:87
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