YARP
Yet Another Robot Platform
Pose2D.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/Pose2D" msg definition:
12 // # This expresses a position and orientation on a 2D manifold.
13 //
14 // float64 x
15 // float64 y
16 // float64 theta// 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_Pose2D_h
20 #define YARP_ROSMSG_geometry_msgs_Pose2D_h
21 
22 #include <yarp/os/Wire.h>
23 #include <yarp/os/Type.h>
25 #include <string>
26 #include <vector>
27 
28 namespace yarp {
29 namespace rosmsg {
30 namespace geometry_msgs {
31 
33 {
34 public:
38 
39  Pose2D() :
40  x(0.0),
41  y(0.0),
42  theta(0.0)
43  {
44  }
45 
46  void clear()
47  {
48  // *** x ***
49  x = 0.0;
50 
51  // *** y ***
52  y = 0.0;
53 
54  // *** theta ***
55  theta = 0.0;
56  }
57 
58  bool readBare(yarp::os::ConnectionReader& connection) override
59  {
60  // *** x ***
61  x = connection.expectFloat64();
62 
63  // *** y ***
64  y = connection.expectFloat64();
65 
66  // *** theta ***
67  theta = connection.expectFloat64();
68 
69  return !connection.isError();
70  }
71 
72  bool readBottle(yarp::os::ConnectionReader& connection) override
73  {
74  connection.convertTextMode();
75  yarp::os::idl::WireReader reader(connection);
76  if (!reader.readListHeader(3)) {
77  return false;
78  }
79 
80  // *** x ***
81  x = reader.expectFloat64();
82 
83  // *** y ***
84  y = reader.expectFloat64();
85 
86  // *** theta ***
87  theta = reader.expectFloat64();
88 
89  return !connection.isError();
90  }
91 
93  bool read(yarp::os::ConnectionReader& connection) override
94  {
95  return (connection.isBareMode() ? readBare(connection)
96  : readBottle(connection));
97  }
98 
99  bool writeBare(yarp::os::ConnectionWriter& connection) const override
100  {
101  // *** x ***
102  connection.appendFloat64(x);
103 
104  // *** y ***
105  connection.appendFloat64(y);
106 
107  // *** theta ***
108  connection.appendFloat64(theta);
109 
110  return !connection.isError();
111  }
112 
113  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
114  {
115  connection.appendInt32(BOTTLE_TAG_LIST);
116  connection.appendInt32(3);
117 
118  // *** x ***
119  connection.appendInt32(BOTTLE_TAG_FLOAT64);
120  connection.appendFloat64(x);
121 
122  // *** y ***
123  connection.appendInt32(BOTTLE_TAG_FLOAT64);
124  connection.appendFloat64(y);
125 
126  // *** theta ***
127  connection.appendInt32(BOTTLE_TAG_FLOAT64);
128  connection.appendFloat64(theta);
129 
130  connection.convertTextMode();
131  return !connection.isError();
132  }
133 
135  bool write(yarp::os::ConnectionWriter& connection) const override
136  {
137  return (connection.isBareMode() ? writeBare(connection)
138  : writeBottle(connection));
139  }
140 
141  // This class will serialize ROS style or YARP style depending on protocol.
142  // If you need to force a serialization style, use one of these classes:
145 
146  // The name for this message, ROS will need this
147  static constexpr const char* typeName = "geometry_msgs/Pose2D";
148 
149  // The checksum for this message, ROS will need this
150  static constexpr const char* typeChecksum = "938fa65709584ad8e77d238529be13b8";
151 
152  // The source text for this message, ROS will need this
153  static constexpr const char* typeText = "\
154 # This expresses a position and orientation on a 2D manifold.\n\
155 \n\
156 float64 x\n\
157 float64 y\n\
158 float64 theta\n\
159 ";
160 
161  yarp::os::Type getType() const override
162  {
164  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
165  typ.addProperty("message_definition", yarp::os::Value(typeText));
166  return typ;
167  }
168 };
169 
170 } // namespace geometry_msgs
171 } // namespace rosmsg
172 } // namespace yarp
173 
174 #endif // YARP_ROSMSG_geometry_msgs_Pose2D_h
yarp::rosmsg::geometry_msgs::Pose2D::clear
void clear()
Definition: Pose2D.h:46
yarp::rosmsg::geometry_msgs::Pose2D::y
yarp::conf::float64_t y
Definition: Pose2D.h:36
yarp::os::idl::WireReader::expectFloat64
yarp::conf::float64_t expectFloat64()
Definition: WireReader.h:120
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::rosmsg::geometry_msgs::Pose2D::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Pose2D.h:99
yarp::os::ConnectionWriter::appendFloat64
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
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::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::Pose2D::typeName
static constexpr const char * typeName
Definition: Pose2D.h:147
yarp::rosmsg::geometry_msgs::Pose2D::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Pose2D.h:72
Wire.h
geometry_msgs
Definition: Accel.h:22
yarp::rosmsg::geometry_msgs::Pose2D::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Pose2D.h:93
yarp::os::ConnectionReader::expectFloat64
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
yarp::rosmsg::geometry_msgs::Pose2D::Pose2D
Pose2D()
Definition: Pose2D.h:39
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::rosmsg::geometry_msgs::Pose2D::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Pose2D.h:58
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::geometry_msgs::Pose2D::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Pose2D.h:113
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::Pose2D::theta
yarp::conf::float64_t theta
Definition: Pose2D.h:37
yarp::rosmsg::geometry_msgs::Pose2D::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Pose2D.h:135
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::Pose2D::getType
yarp::os::Type getType() const override
Definition: Pose2D.h:161
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
BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_FLOAT64
Definition: Bottle.h:27
yarp::rosmsg::geometry_msgs::Pose2D::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Pose2D > rosStyle
Definition: Pose2D.h:143
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::geometry_msgs::Pose2D::typeChecksum
static constexpr const char * typeChecksum
Definition: Pose2D.h:150
yarp::conf::float64_t
double float64_t
Definition: numeric.h:51
yarp::rosmsg::geometry_msgs::Pose2D::x
yarp::conf::float64_t x
Definition: Pose2D.h:35
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
yarp::rosmsg::geometry_msgs::Pose2D
Definition: Pose2D.h:33
yarp::rosmsg::geometry_msgs::Pose2D::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Pose2D > bottleStyle
Definition: Pose2D.h:144
yarp::rosmsg::geometry_msgs::Pose2D::typeText
static constexpr const char * typeText
Definition: Pose2D.h:153
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