YARP
Yet Another Robot Platform
Wrench.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/Wrench" msg definition:
12 // # This represents force in free space, separated into
13 // # its linear and angular parts.
14 // Vector3 force
15 // Vector3 torque
16 // Instances of this class can be read and written with YARP ports,
17 // using a ROS-compatible format.
18 
19 #ifndef YARP_ROSMSG_geometry_msgs_Wrench_h
20 #define YARP_ROSMSG_geometry_msgs_Wrench_h
21 
22 #include <yarp/os/Wire.h>
23 #include <yarp/os/Type.h>
25 #include <string>
26 #include <vector>
28 
29 namespace yarp {
30 namespace rosmsg {
31 namespace geometry_msgs {
32 
34 {
35 public:
38 
39  Wrench() :
40  force(),
41  torque()
42  {
43  }
44 
45  void clear()
46  {
47  // *** force ***
48  force.clear();
49 
50  // *** torque ***
51  torque.clear();
52  }
53 
54  bool readBare(yarp::os::ConnectionReader& connection) override
55  {
56  // *** force ***
57  if (!force.read(connection)) {
58  return false;
59  }
60 
61  // *** torque ***
62  if (!torque.read(connection)) {
63  return false;
64  }
65 
66  return !connection.isError();
67  }
68 
69  bool readBottle(yarp::os::ConnectionReader& connection) override
70  {
71  connection.convertTextMode();
72  yarp::os::idl::WireReader reader(connection);
73  if (!reader.readListHeader(2)) {
74  return false;
75  }
76 
77  // *** force ***
78  if (!force.read(connection)) {
79  return false;
80  }
81 
82  // *** torque ***
83  if (!torque.read(connection)) {
84  return false;
85  }
86 
87  return !connection.isError();
88  }
89 
91  bool read(yarp::os::ConnectionReader& connection) override
92  {
93  return (connection.isBareMode() ? readBare(connection)
94  : readBottle(connection));
95  }
96 
97  bool writeBare(yarp::os::ConnectionWriter& connection) const override
98  {
99  // *** force ***
100  if (!force.write(connection)) {
101  return false;
102  }
103 
104  // *** torque ***
105  if (!torque.write(connection)) {
106  return false;
107  }
108 
109  return !connection.isError();
110  }
111 
112  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
113  {
114  connection.appendInt32(BOTTLE_TAG_LIST);
115  connection.appendInt32(2);
116 
117  // *** force ***
118  if (!force.write(connection)) {
119  return false;
120  }
121 
122  // *** torque ***
123  if (!torque.write(connection)) {
124  return false;
125  }
126 
127  connection.convertTextMode();
128  return !connection.isError();
129  }
130 
132  bool write(yarp::os::ConnectionWriter& connection) const override
133  {
134  return (connection.isBareMode() ? writeBare(connection)
135  : writeBottle(connection));
136  }
137 
138  // This class will serialize ROS style or YARP style depending on protocol.
139  // If you need to force a serialization style, use one of these classes:
142 
143  // The name for this message, ROS will need this
144  static constexpr const char* typeName = "geometry_msgs/Wrench";
145 
146  // The checksum for this message, ROS will need this
147  static constexpr const char* typeChecksum = "4f539cf138b23283b520fd271b567936";
148 
149  // The source text for this message, ROS will need this
150  static constexpr const char* typeText = "\
151 # This represents force in free space, separated into\n\
152 # its linear and angular parts.\n\
153 Vector3 force\n\
154 Vector3 torque\n\
155 \n\
156 ================================================================================\n\
157 MSG: geometry_msgs/Vector3\n\
158 # This represents a vector in free space. \n\
159 # It is only meant to represent a direction. Therefore, it does not\n\
160 # make sense to apply a translation to it (e.g., when applying a \n\
161 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
162 # rotation). If you want your data to be translatable too, use the\n\
163 # geometry_msgs/Point message instead.\n\
164 \n\
165 float64 x\n\
166 float64 y\n\
167 float64 z\n\
168 ";
169 
170  yarp::os::Type getType() const override
171  {
173  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
174  typ.addProperty("message_definition", yarp::os::Value(typeText));
175  return typ;
176  }
177 };
178 
179 } // namespace geometry_msgs
180 } // namespace rosmsg
181 } // namespace yarp
182 
183 #endif // YARP_ROSMSG_geometry_msgs_Wrench_h
yarp::rosmsg::geometry_msgs::Wrench::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Wrench.h:54
yarp::rosmsg::geometry_msgs::Wrench::force
yarp::rosmsg::geometry_msgs::Vector3 force
Definition: Wrench.h:36
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::geometry_msgs::Vector3
Definition: Vector3.h:37
yarp::rosmsg::geometry_msgs::Vector3::clear
void clear()
Definition: Vector3.h:51
yarp::os::idl::BottleStyle
Definition: BottleStyle.h:21
yarp::rosmsg::geometry_msgs::Wrench::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Wrench.h:97
yarp::os::Type
Definition: Type.h:23
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::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::Wrench::Wrench
Wrench()
Definition: Wrench.h:39
yarp::rosmsg::geometry_msgs::Wrench::torque
yarp::rosmsg::geometry_msgs::Vector3 torque
Definition: Wrench.h:37
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::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:39
yarp::rosmsg::geometry_msgs::Wrench::typeText
static constexpr const char * typeText
Definition: Wrench.h:150
yarp::rosmsg::geometry_msgs::Wrench::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Wrench.h:91
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::Wrench::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Wrench.h:69
yarp::rosmsg::geometry_msgs::Wrench::clear
void clear()
Definition: Wrench.h:45
yarp::rosmsg::geometry_msgs::Wrench
Definition: Wrench.h:33
Vector3.h
yarp::rosmsg::geometry_msgs::Wrench::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Wrench.h:112
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:25
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::Wrench::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Wrench > rosStyle
Definition: Wrench.h:140
yarp::rosmsg::geometry_msgs::Wrench::getType
yarp::os::Type getType() const override
Definition: Wrench.h:170
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:32
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:39
yarp::os::idl::BareStyle
Definition: BareStyle.h:21
yarp::rosmsg::geometry_msgs::Wrench::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Wrench.h:132
yarp::rosmsg::geometry_msgs::Wrench::typeName
static constexpr const char * typeName
Definition: Wrench.h:144
yarp
Definition: environment.h:18
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:46
yarp::rosmsg::geometry_msgs::Wrench::typeChecksum
static constexpr const char * typeChecksum
Definition: Wrench.h:147
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::rosmsg::geometry_msgs::Wrench::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Wrench > bottleStyle
Definition: Wrench.h:141
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