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