YARP
Yet Another Robot Platform
Inertia.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/Inertia" msg definition:
9// # Mass [kg]
10// float64 m
11//
12// # Center of mass [m]
13// geometry_msgs/Vector3 com
14//
15// # Inertia Tensor [kg-m^2]
16// # | ixx ixy ixz |
17// # I = | ixy iyy iyz |
18// # | ixz iyz izz |
19// float64 ixx
20// float64 ixy
21// float64 ixz
22// float64 iyy
23// float64 iyz
24// float64 izz
25// Instances of this class can be read and written with YARP ports,
26// using a ROS-compatible format.
27
28#ifndef YARP_ROSMSG_geometry_msgs_Inertia_h
29#define YARP_ROSMSG_geometry_msgs_Inertia_h
30
31#include <yarp/os/Wire.h>
32#include <yarp/os/Type.h>
34#include <string>
35#include <vector>
37
38namespace yarp {
39namespace rosmsg {
40namespace geometry_msgs {
41
43{
44public:
53
55 m(0.0),
56 com(),
57 ixx(0.0),
58 ixy(0.0),
59 ixz(0.0),
60 iyy(0.0),
61 iyz(0.0),
62 izz(0.0)
63 {
64 }
65
66 void clear()
67 {
68 // *** m ***
69 m = 0.0;
70
71 // *** com ***
72 com.clear();
73
74 // *** ixx ***
75 ixx = 0.0;
76
77 // *** ixy ***
78 ixy = 0.0;
79
80 // *** ixz ***
81 ixz = 0.0;
82
83 // *** iyy ***
84 iyy = 0.0;
85
86 // *** iyz ***
87 iyz = 0.0;
88
89 // *** izz ***
90 izz = 0.0;
91 }
92
93 bool readBare(yarp::os::ConnectionReader& connection) override
94 {
95 // *** m ***
96 m = connection.expectFloat64();
97
98 // *** com ***
99 if (!com.read(connection)) {
100 return false;
101 }
102
103 // *** ixx ***
104 ixx = connection.expectFloat64();
105
106 // *** ixy ***
107 ixy = connection.expectFloat64();
108
109 // *** ixz ***
110 ixz = connection.expectFloat64();
111
112 // *** iyy ***
113 iyy = connection.expectFloat64();
114
115 // *** iyz ***
116 iyz = connection.expectFloat64();
117
118 // *** izz ***
119 izz = connection.expectFloat64();
120
121 return !connection.isError();
122 }
123
124 bool readBottle(yarp::os::ConnectionReader& connection) override
125 {
126 connection.convertTextMode();
127 yarp::os::idl::WireReader reader(connection);
128 if (!reader.readListHeader(8)) {
129 return false;
130 }
131
132 // *** m ***
133 m = reader.expectFloat64();
134
135 // *** com ***
136 if (!com.read(connection)) {
137 return false;
138 }
139
140 // *** ixx ***
141 ixx = reader.expectFloat64();
142
143 // *** ixy ***
144 ixy = reader.expectFloat64();
145
146 // *** ixz ***
147 ixz = reader.expectFloat64();
148
149 // *** iyy ***
150 iyy = reader.expectFloat64();
151
152 // *** iyz ***
153 iyz = reader.expectFloat64();
154
155 // *** izz ***
156 izz = reader.expectFloat64();
157
158 return !connection.isError();
159 }
160
162 bool read(yarp::os::ConnectionReader& connection) override
163 {
164 return (connection.isBareMode() ? readBare(connection)
165 : readBottle(connection));
166 }
167
168 bool writeBare(yarp::os::ConnectionWriter& connection) const override
169 {
170 // *** m ***
171 connection.appendFloat64(m);
172
173 // *** com ***
174 if (!com.write(connection)) {
175 return false;
176 }
177
178 // *** ixx ***
179 connection.appendFloat64(ixx);
180
181 // *** ixy ***
182 connection.appendFloat64(ixy);
183
184 // *** ixz ***
185 connection.appendFloat64(ixz);
186
187 // *** iyy ***
188 connection.appendFloat64(iyy);
189
190 // *** iyz ***
191 connection.appendFloat64(iyz);
192
193 // *** izz ***
194 connection.appendFloat64(izz);
195
196 return !connection.isError();
197 }
198
199 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
200 {
201 connection.appendInt32(BOTTLE_TAG_LIST);
202 connection.appendInt32(8);
203
204 // *** m ***
206 connection.appendFloat64(m);
207
208 // *** com ***
209 if (!com.write(connection)) {
210 return false;
211 }
212
213 // *** ixx ***
215 connection.appendFloat64(ixx);
216
217 // *** ixy ***
219 connection.appendFloat64(ixy);
220
221 // *** ixz ***
223 connection.appendFloat64(ixz);
224
225 // *** iyy ***
227 connection.appendFloat64(iyy);
228
229 // *** iyz ***
231 connection.appendFloat64(iyz);
232
233 // *** izz ***
235 connection.appendFloat64(izz);
236
237 connection.convertTextMode();
238 return !connection.isError();
239 }
240
242 bool write(yarp::os::ConnectionWriter& connection) const override
243 {
244 return (connection.isBareMode() ? writeBare(connection)
245 : writeBottle(connection));
246 }
247
248 // This class will serialize ROS style or YARP style depending on protocol.
249 // If you need to force a serialization style, use one of these classes:
252
253 // The name for this message, ROS will need this
254 static constexpr const char* typeName = "geometry_msgs/Inertia";
255
256 // The checksum for this message, ROS will need this
257 static constexpr const char* typeChecksum = "1d26e4bb6c83ff141c5cf0d883c2b0fe";
258
259 // The source text for this message, ROS will need this
260 static constexpr const char* typeText = "\
261# Mass [kg]\n\
262float64 m\n\
263\n\
264# Center of mass [m]\n\
265geometry_msgs/Vector3 com\n\
266\n\
267# Inertia Tensor [kg-m^2]\n\
268# | ixx ixy ixz |\n\
269# I = | ixy iyy iyz |\n\
270# | ixz iyz izz |\n\
271float64 ixx\n\
272float64 ixy\n\
273float64 ixz\n\
274float64 iyy\n\
275float64 iyz\n\
276float64 izz\n\
277\n\
278================================================================================\n\
279MSG: geometry_msgs/Vector3\n\
280# This represents a vector in free space. \n\
281# It is only meant to represent a direction. Therefore, it does not\n\
282# make sense to apply a translation to it (e.g., when applying a \n\
283# generic rigid transformation to a Vector3, tf2 will only apply the\n\
284# rotation). If you want your data to be translatable too, use the\n\
285# geometry_msgs/Point message instead.\n\
286\n\
287float64 x\n\
288float64 y\n\
289float64 z\n\
290";
291
292 yarp::os::Type getType() const override
293 {
296 typ.addProperty("message_definition", yarp::os::Value(typeText));
297 return typ;
298 }
299};
300
301} // namespace geometry_msgs
302} // namespace rosmsg
303} // namespace yarp
304
305#endif // YARP_ROSMSG_geometry_msgs_Inertia_h
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:25
#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
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
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.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number 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
yarp::conf::float64_t expectFloat64()
Definition: WireReader.h:110
yarp::conf::float64_t ixz
Definition: Inertia.h:49
static constexpr const char * typeText
Definition: Inertia.h:260
yarp::conf::float64_t izz
Definition: Inertia.h:52
yarp::conf::float64_t ixy
Definition: Inertia.h:48
yarp::conf::float64_t ixx
Definition: Inertia.h:47
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Inertia.h:242
yarp::rosmsg::geometry_msgs::Vector3 com
Definition: Inertia.h:46
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Inertia > bottleStyle
Definition: Inertia.h:251
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Inertia.h:168
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Inertia > rosStyle
Definition: Inertia.h:250
yarp::os::Type getType() const override
Definition: Inertia.h:292
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Inertia.h:199
static constexpr const char * typeChecksum
Definition: Inertia.h:257
yarp::conf::float64_t iyy
Definition: Inertia.h:50
static constexpr const char * typeName
Definition: Inertia.h:254
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Inertia.h:93
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Inertia.h:162
yarp::conf::float64_t iyz
Definition: Inertia.h:51
yarp::conf::float64_t m
Definition: Inertia.h:45
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Inertia.h:124
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Vector3.h:95
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Vector3.h:137
double float64_t
Definition: numeric.h:77
The main, catch-all namespace for YARP.
Definition: dirs.h:16