YARP
Yet Another Robot Platform
Wrench.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/Wrench" msg definition:
9// # This represents force in free space, separated into
10// # its linear and angular parts.
11// Vector3 force
12// Vector3 torque
13// Instances of this class can be read and written with YARP ports,
14// using a ROS-compatible format.
15
16#ifndef YARP_ROSMSG_geometry_msgs_Wrench_h
17#define YARP_ROSMSG_geometry_msgs_Wrench_h
18
19#include <yarp/os/Wire.h>
20#include <yarp/os/Type.h>
22#include <string>
23#include <vector>
25
26namespace yarp {
27namespace rosmsg {
28namespace geometry_msgs {
29
31{
32public:
35
37 force(),
38 torque()
39 {
40 }
41
42 void clear()
43 {
44 // *** force ***
45 force.clear();
46
47 // *** torque ***
48 torque.clear();
49 }
50
51 bool readBare(yarp::os::ConnectionReader& connection) override
52 {
53 // *** force ***
54 if (!force.read(connection)) {
55 return false;
56 }
57
58 // *** torque ***
59 if (!torque.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 // *** force ***
75 if (!force.read(connection)) {
76 return false;
77 }
78
79 // *** torque ***
80 if (!torque.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 // *** force ***
97 if (!force.write(connection)) {
98 return false;
99 }
100
101 // *** torque ***
102 if (!torque.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 // *** force ***
115 if (!force.write(connection)) {
116 return false;
117 }
118
119 // *** torque ***
120 if (!torque.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/Wrench";
142
143 // The checksum for this message, ROS will need this
144 static constexpr const char* typeChecksum = "4f539cf138b23283b520fd271b567936";
145
146 // The source text for this message, ROS will need this
147 static constexpr const char* typeText = "\
148# This represents force in free space, separated into\n\
149# its linear and angular parts.\n\
150Vector3 force\n\
151Vector3 torque\n\
152\n\
153================================================================================\n\
154MSG: geometry_msgs/Vector3\n\
155# This represents a vector in free space. \n\
156# It is only meant to represent a direction. Therefore, it does not\n\
157# make sense to apply a translation to it (e.g., when applying a \n\
158# generic rigid transformation to a Vector3, tf2 will only apply the\n\
159# rotation). If you want your data to be translatable too, use the\n\
160# geometry_msgs/Point message instead.\n\
161\n\
162float64 x\n\
163float64 y\n\
164float64 z\n\
165";
166
167 yarp::os::Type getType() const override
168 {
171 typ.addProperty("message_definition", yarp::os::Value(typeText));
172 return typ;
173 }
174};
175
176} // namespace geometry_msgs
177} // namespace rosmsg
178} // namespace yarp
179
180#endif // YARP_ROSMSG_geometry_msgs_Wrench_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: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
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
yarp::rosmsg::geometry_msgs::Vector3 torque
Definition: Wrench.h:34
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Wrench > rosStyle
Definition: Wrench.h:137
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Wrench.h:94
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Wrench.h:66
static constexpr const char * typeName
Definition: Wrench.h:141
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Wrench.h:88
yarp::rosmsg::geometry_msgs::Vector3 force
Definition: Wrench.h:33
static constexpr const char * typeChecksum
Definition: Wrench.h:144
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Wrench.h:51
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Wrench.h:109
yarp::os::Type getType() const override
Definition: Wrench.h:167
static constexpr const char * typeText
Definition: Wrench.h:147
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Wrench.h:129
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Wrench > bottleStyle
Definition: Wrench.h:138
The main, catch-all namespace for YARP.
Definition: dirs.h:16