YARP
Yet Another Robot Platform
Pose.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/Pose" msg definition:
9 // # A representation of pose in free space, composed of position and orientation.
10 // Point position
11 // Quaternion orientation
12 // Instances of this class can be read and written with YARP ports,
13 // using a ROS-compatible format.
14 
15 #ifndef YARP_ROSMSG_geometry_msgs_Pose_h
16 #define YARP_ROSMSG_geometry_msgs_Pose_h
17 
18 #include <yarp/os/Wire.h>
19 #include <yarp/os/Type.h>
20 #include <yarp/os/idl/WireTypes.h>
21 #include <string>
22 #include <vector>
25 
26 namespace yarp {
27 namespace rosmsg {
28 namespace geometry_msgs {
29 
31 {
32 public:
35 
36  Pose() :
37  position(),
38  orientation()
39  {
40  }
41 
42  void clear()
43  {
44  // *** position ***
45  position.clear();
46 
47  // *** orientation ***
49  }
50 
51  bool readBare(yarp::os::ConnectionReader& connection) override
52  {
53  // *** position ***
54  if (!position.read(connection)) {
55  return false;
56  }
57 
58  // *** orientation ***
59  if (!orientation.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  // *** position ***
75  if (!position.read(connection)) {
76  return false;
77  }
78 
79  // *** orientation ***
80  if (!orientation.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  // *** position ***
97  if (!position.write(connection)) {
98  return false;
99  }
100 
101  // *** orientation ***
102  if (!orientation.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  // *** position ***
115  if (!position.write(connection)) {
116  return false;
117  }
118 
119  // *** orientation ***
120  if (!orientation.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/Pose";
142 
143  // The checksum for this message, ROS will need this
144  static constexpr const char* typeChecksum = "e45d45a5a1ce597b249e23fb30fc871f";
145 
146  // The source text for this message, ROS will need this
147  static constexpr const char* typeText = "\
148 # A representation of pose in free space, composed of position and orientation. \n\
149 Point position\n\
150 Quaternion orientation\n\
151 \n\
152 ================================================================================\n\
153 MSG: geometry_msgs/Point\n\
154 # This contains the position of a point in free space\n\
155 float64 x\n\
156 float64 y\n\
157 float64 z\n\
158 \n\
159 ================================================================================\n\
160 MSG: geometry_msgs/Quaternion\n\
161 # This represents an orientation in free space in quaternion form.\n\
162 \n\
163 float64 x\n\
164 float64 y\n\
165 float64 z\n\
166 float64 w\n\
167 ";
168 
169  yarp::os::Type getType() const override
170  {
172  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
173  typ.addProperty("message_definition", yarp::os::Value(typeText));
174  return typ;
175  }
176 };
177 
178 } // namespace geometry_msgs
179 } // namespace rosmsg
180 } // namespace yarp
181 
182 #endif // YARP_ROSMSG_geometry_msgs_Pose_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:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
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:30
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Point.h:132
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Point.h:90
yarp::os::Type getType() const override
Definition: Pose.h:169
static constexpr const char * typeName
Definition: Pose.h:141
static constexpr const char * typeChecksum
Definition: Pose.h:144
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Pose.h:51
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Pose.h:94
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose.h:129
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Pose > bottleStyle
Definition: Pose.h:138
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Pose.h:109
static constexpr const char * typeText
Definition: Pose.h:147
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose.h:88
yarp::rosmsg::geometry_msgs::Point position
Definition: Pose.h:33
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Pose > rosStyle
Definition: Pose.h:137
yarp::rosmsg::geometry_msgs::Quaternion orientation
Definition: Pose.h:34
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Pose.h:66
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Quaternion.h:152
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Quaternion.h:103
The main, catch-all namespace for YARP.
Definition: dirs.h:16