YARP
Yet Another Robot Platform
AccelWithCovariance.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/AccelWithCovariance" msg definition:
12 // # This expresses acceleration in free space with uncertainty.
13 //
14 // Accel accel
15 //
16 // # Row-major representation of the 6x6 covariance matrix
17 // # The orientation parameters use a fixed-axis representation.
18 // # In order, the parameters are:
19 // # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
20 // float64[36] covariance
21 // Instances of this class can be read and written with YARP ports,
22 // using a ROS-compatible format.
23 
24 #ifndef YARP_ROSMSG_geometry_msgs_AccelWithCovariance_h
25 #define YARP_ROSMSG_geometry_msgs_AccelWithCovariance_h
26 
27 #include <yarp/os/Wire.h>
28 #include <yarp/os/Type.h>
29 #include <yarp/os/idl/WireTypes.h>
30 #include <string>
31 #include <vector>
33 
34 namespace yarp {
35 namespace rosmsg {
36 namespace geometry_msgs {
37 
39 {
40 public:
42  std::vector<yarp::conf::float64_t> covariance;
43 
45  accel(),
46  covariance()
47  {
48  covariance.resize(36, 0.0);
49  }
50 
51  void clear()
52  {
53  // *** accel ***
54  accel.clear();
55 
56  // *** covariance ***
57  covariance.clear();
58  covariance.resize(36, 0.0);
59  }
60 
61  bool readBare(yarp::os::ConnectionReader& connection) override
62  {
63  // *** accel ***
64  if (!accel.read(connection)) {
65  return false;
66  }
67 
68  // *** covariance ***
69  int len = 36;
70  covariance.resize(len);
71  if (len > 0 && !connection.expectBlock((char*)&covariance[0], sizeof(yarp::conf::float64_t)*len)) {
72  return false;
73  }
74 
75  return !connection.isError();
76  }
77 
78  bool readBottle(yarp::os::ConnectionReader& connection) override
79  {
80  connection.convertTextMode();
81  yarp::os::idl::WireReader reader(connection);
82  if (!reader.readListHeader(2)) {
83  return false;
84  }
85 
86  // *** accel ***
87  if (!accel.read(connection)) {
88  return false;
89  }
90 
91  // *** covariance ***
92  if (connection.expectInt32() != (BOTTLE_TAG_LIST|BOTTLE_TAG_FLOAT64)) {
93  return false;
94  }
95  int len = connection.expectInt32();
96  covariance.resize(len);
97  for (int i=0; i<len; i++) {
99  }
100 
101  return !connection.isError();
102  }
103 
105  bool read(yarp::os::ConnectionReader& connection) override
106  {
107  return (connection.isBareMode() ? readBare(connection)
108  : readBottle(connection));
109  }
110 
111  bool writeBare(yarp::os::ConnectionWriter& connection) const override
112  {
113  // *** accel ***
114  if (!accel.write(connection)) {
115  return false;
116  }
117 
118  // *** covariance ***
119  if (covariance.size()>0) {
120  connection.appendExternalBlock((char*)&covariance[0], sizeof(yarp::conf::float64_t)*covariance.size());
121  }
122 
123  return !connection.isError();
124  }
125 
126  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
127  {
128  connection.appendInt32(BOTTLE_TAG_LIST);
129  connection.appendInt32(2);
130 
131  // *** accel ***
132  if (!accel.write(connection)) {
133  return false;
134  }
135 
136  // *** covariance ***
138  connection.appendInt32(covariance.size());
139  for (size_t i=0; i<covariance.size(); i++) {
140  connection.appendFloat64(covariance[i]);
141  }
142 
143  connection.convertTextMode();
144  return !connection.isError();
145  }
146 
148  bool write(yarp::os::ConnectionWriter& connection) const override
149  {
150  return (connection.isBareMode() ? writeBare(connection)
151  : writeBottle(connection));
152  }
153 
154  // This class will serialize ROS style or YARP style depending on protocol.
155  // If you need to force a serialization style, use one of these classes:
158 
159  // The name for this message, ROS will need this
160  static constexpr const char* typeName = "geometry_msgs/AccelWithCovariance";
161 
162  // The checksum for this message, ROS will need this
163  static constexpr const char* typeChecksum = "ad5a718d699c6be72a02b8d6a139f334";
164 
165  // The source text for this message, ROS will need this
166  static constexpr const char* typeText = "\
167 # This expresses acceleration in free space with uncertainty.\n\
168 \n\
169 Accel accel\n\
170 \n\
171 # Row-major representation of the 6x6 covariance matrix\n\
172 # The orientation parameters use a fixed-axis representation.\n\
173 # In order, the parameters are:\n\
174 # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)\n\
175 float64[36] covariance\n\
176 \n\
177 ================================================================================\n\
178 MSG: geometry_msgs/Accel\n\
179 # This expresses acceleration in free space broken into its linear and angular parts.\n\
180 Vector3 linear\n\
181 Vector3 angular\n\
182 \n\
183 ================================================================================\n\
184 MSG: geometry_msgs/Vector3\n\
185 # This represents a vector in free space. \n\
186 # It is only meant to represent a direction. Therefore, it does not\n\
187 # make sense to apply a translation to it (e.g., when applying a \n\
188 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
189 # rotation). If you want your data to be translatable too, use the\n\
190 # geometry_msgs/Point message instead.\n\
191 \n\
192 float64 x\n\
193 float64 y\n\
194 float64 z\n\
195 ";
196 
197  yarp::os::Type getType() const override
198  {
200  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
201  typ.addProperty("message_definition", yarp::os::Value(typeText));
202  return typ;
203  }
204 };
205 
206 } // namespace geometry_msgs
207 } // namespace rosmsg
208 } // namespace yarp
209 
210 #endif // YARP_ROSMSG_geometry_msgs_AccelWithCovariance_h
yarp::rosmsg::geometry_msgs::AccelWithCovariance::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: AccelWithCovariance.h:61
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
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::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
yarp::rosmsg::geometry_msgs::AccelWithCovariance::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::AccelWithCovariance > bottleStyle
Definition: AccelWithCovariance.h:157
geometry_msgs
Definition: Accel.h:22
yarp::rosmsg::geometry_msgs::Accel::clear
void clear()
Definition: Accel.h:44
yarp::rosmsg::geometry_msgs::AccelWithCovariance::typeName
static constexpr const char * typeName
Definition: AccelWithCovariance.h:160
yarp::rosmsg::geometry_msgs::AccelWithCovariance::accel
yarp::rosmsg::geometry_msgs::Accel accel
Definition: AccelWithCovariance.h:41
yarp::rosmsg::geometry_msgs::Accel::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Accel.h:90
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::rosmsg::geometry_msgs::AccelWithCovariance::clear
void clear()
Definition: AccelWithCovariance.h:51
yarp::rosmsg::geometry_msgs::AccelWithCovariance::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::AccelWithCovariance > rosStyle
Definition: AccelWithCovariance.h:156
yarp::rosmsg::geometry_msgs::AccelWithCovariance::typeText
static constexpr const char * typeText
Definition: AccelWithCovariance.h:166
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::rosmsg::geometry_msgs::AccelWithCovariance::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: AccelWithCovariance.h:105
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
Accel.h
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::Accel
Definition: Accel.h:33
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::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::rosmsg::geometry_msgs::AccelWithCovariance::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: AccelWithCovariance.h:148
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::AccelWithCovariance::covariance
std::vector< yarp::conf::float64_t > covariance
Definition: AccelWithCovariance.h:42
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::rosmsg::geometry_msgs::Accel::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Accel.h:131
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::geometry_msgs::AccelWithCovariance
Definition: AccelWithCovariance.h:39
yarp::rosmsg::geometry_msgs::AccelWithCovariance::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: AccelWithCovariance.h:126
BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:27
yarp::rosmsg::geometry_msgs::AccelWithCovariance::getType
yarp::os::Type getType() const override
Definition: AccelWithCovariance.h:197
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::float64_t
double float64_t
Definition: numeric.h:51
yarp::rosmsg::geometry_msgs::AccelWithCovariance::AccelWithCovariance
AccelWithCovariance()
Definition: AccelWithCovariance.h:44
yarp::os::ConnectionWriter::appendExternalBlock
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
yarp::os::ConnectionReader::expectBlock
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::AccelWithCovariance::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: AccelWithCovariance.h:111
yarp::rosmsg::geometry_msgs::AccelWithCovariance::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: AccelWithCovariance.h:78
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::geometry_msgs::AccelWithCovariance::typeChecksum
static constexpr const char * typeChecksum
Definition: AccelWithCovariance.h:163
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20