YARP
Yet Another Robot Platform
Pose.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/Pose" msg definition:
12 // # A representation of pose in free space, composed of position and orientation.
13 // Point position
14 // Quaternion orientation
15 // Instances of this class can be read and written with YARP ports,
16 // using a ROS-compatible format.
17 
18 #ifndef YARP_ROSMSG_geometry_msgs_Pose_h
19 #define YARP_ROSMSG_geometry_msgs_Pose_h
20 
21 #include <yarp/os/Wire.h>
22 #include <yarp/os/Type.h>
23 #include <yarp/os/idl/WireTypes.h>
24 #include <string>
25 #include <vector>
28 
29 namespace yarp {
30 namespace rosmsg {
31 namespace geometry_msgs {
32 
34 {
35 public:
38 
39  Pose() :
40  position(),
41  orientation()
42  {
43  }
44 
45  void clear()
46  {
47  // *** position ***
48  position.clear();
49 
50  // *** orientation ***
52  }
53 
54  bool readBare(yarp::os::ConnectionReader& connection) override
55  {
56  // *** position ***
57  if (!position.read(connection)) {
58  return false;
59  }
60 
61  // *** orientation ***
62  if (!orientation.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  // *** position ***
78  if (!position.read(connection)) {
79  return false;
80  }
81 
82  // *** orientation ***
83  if (!orientation.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  // *** position ***
100  if (!position.write(connection)) {
101  return false;
102  }
103 
104  // *** orientation ***
105  if (!orientation.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  // *** position ***
118  if (!position.write(connection)) {
119  return false;
120  }
121 
122  // *** orientation ***
123  if (!orientation.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/Pose";
145 
146  // The checksum for this message, ROS will need this
147  static constexpr const char* typeChecksum = "e45d45a5a1ce597b249e23fb30fc871f";
148 
149  // The source text for this message, ROS will need this
150  static constexpr const char* typeText = "\
151 # A representation of pose in free space, composed of position and orientation. \n\
152 Point position\n\
153 Quaternion orientation\n\
154 \n\
155 ================================================================================\n\
156 MSG: geometry_msgs/Point\n\
157 # This contains the position of a point in free space\n\
158 float64 x\n\
159 float64 y\n\
160 float64 z\n\
161 \n\
162 ================================================================================\n\
163 MSG: geometry_msgs/Quaternion\n\
164 # This represents an orientation in free space in quaternion form.\n\
165 \n\
166 float64 x\n\
167 float64 y\n\
168 float64 z\n\
169 float64 w\n\
170 ";
171 
172  yarp::os::Type getType() const override
173  {
175  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
176  typ.addProperty("message_definition", yarp::os::Value(typeText));
177  return typ;
178  }
179 };
180 
181 } // namespace geometry_msgs
182 } // namespace rosmsg
183 } // namespace yarp
184 
185 #endif // YARP_ROSMSG_geometry_msgs_Pose_h
yarp::rosmsg::geometry_msgs::Pose::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Pose.h:54
WireTypes.h
yarp::rosmsg::geometry_msgs::Pose
Definition: Pose.h:34
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
Quaternion.h
yarp::rosmsg::geometry_msgs::Pose::position
yarp::rosmsg::geometry_msgs::Point position
Definition: Pose.h:36
yarp::rosmsg::geometry_msgs::Pose::typeText
static constexpr const char * typeText
Definition: Pose.h:150
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::rosmsg::geometry_msgs::Point
Definition: Point.h:33
yarp::rosmsg::geometry_msgs::Pose::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Pose.h:97
yarp::rosmsg::geometry_msgs::Pose::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Pose > rosStyle
Definition: Pose.h:140
yarp::rosmsg::geometry_msgs::Pose::clear
void clear()
Definition: Pose.h:45
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
Wire.h
Point.h
geometry_msgs
Definition: Accel.h:22
yarp::rosmsg::geometry_msgs::Quaternion::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Quaternion.h:106
yarp::rosmsg::geometry_msgs::Pose::orientation
yarp::rosmsg::geometry_msgs::Quaternion orientation
Definition: Pose.h:37
yarp::rosmsg::geometry_msgs::Pose::typeChecksum
static constexpr const char * typeChecksum
Definition: Pose.h:147
yarp::rosmsg::geometry_msgs::Quaternion
Definition: Quaternion.h:35
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::Pose::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Pose.h:69
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:40
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::geometry_msgs::Pose::Pose
Pose()
Definition: Pose.h:39
yarp::rosmsg::geometry_msgs::Quaternion::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Quaternion.h:155
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::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::Quaternion::clear
void clear()
Definition: Quaternion.h:50
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::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::geometry_msgs::Point::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Point.h:93
yarp::rosmsg::geometry_msgs::Point::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Point.h:135
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::geometry_msgs::Pose::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose.h:91
yarp::rosmsg::geometry_msgs::Pose::typeName
static constexpr const char * typeName
Definition: Pose.h:144
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::Pose::getType
yarp::os::Type getType() const override
Definition: Pose.h:172
yarp::rosmsg::geometry_msgs::Pose::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose.h:132
yarp::rosmsg::geometry_msgs::Pose::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Pose > bottleStyle
Definition: Pose.h:141
yarp::rosmsg::geometry_msgs::Point::clear
void clear()
Definition: Point.h:46
yarp::os::idl::WireReader::readListHeader
bool readListHeader()
Definition: WireReader.cpp:470
yarp::rosmsg::geometry_msgs::Pose::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Pose.h:112
yarp::os::idl::WirePortable::write
virtual bool write(const yarp::os::idl::WireWriter &writer) const
Definition: WirePortable.cpp:20