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