YARP
Yet Another Robot Platform
Odometry.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 "nav_msgs/Odometry" msg definition:
12 // # This represents an estimate of a position and velocity in free space.
13 // # The pose in this message should be specified in the coordinate frame given by header.frame_id.
14 // # The twist in this message should be specified in the coordinate frame given by the child_frame_id
15 // Header header
16 // string child_frame_id
17 // geometry_msgs/PoseWithCovariance pose
18 // geometry_msgs/TwistWithCovariance twist
19 // Instances of this class can be read and written with YARP ports,
20 // using a ROS-compatible format.
21 
22 #ifndef YARP_ROSMSG_nav_msgs_Odometry_h
23 #define YARP_ROSMSG_nav_msgs_Odometry_h
24 
25 #include <yarp/os/Wire.h>
26 #include <yarp/os/Type.h>
27 #include <yarp/os/idl/WireTypes.h>
28 #include <string>
29 #include <vector>
33 
34 namespace yarp {
35 namespace rosmsg {
36 namespace nav_msgs {
37 
39 {
40 public:
42  std::string child_frame_id;
45 
47  header(),
48  child_frame_id(""),
49  pose(),
50  twist()
51  {
52  }
53 
54  void clear()
55  {
56  // *** header ***
57  header.clear();
58 
59  // *** child_frame_id ***
60  child_frame_id = "";
61 
62  // *** pose ***
63  pose.clear();
64 
65  // *** twist ***
66  twist.clear();
67  }
68 
69  bool readBare(yarp::os::ConnectionReader& connection) override
70  {
71  // *** header ***
72  if (!header.read(connection)) {
73  return false;
74  }
75 
76  // *** child_frame_id ***
77  int len = connection.expectInt32();
78  child_frame_id.resize(len);
79  if (!connection.expectBlock((char*)child_frame_id.c_str(), len)) {
80  return false;
81  }
82 
83  // *** pose ***
84  if (!pose.read(connection)) {
85  return false;
86  }
87 
88  // *** twist ***
89  if (!twist.read(connection)) {
90  return false;
91  }
92 
93  return !connection.isError();
94  }
95 
96  bool readBottle(yarp::os::ConnectionReader& connection) override
97  {
98  connection.convertTextMode();
99  yarp::os::idl::WireReader reader(connection);
100  if (!reader.readListHeader(4)) {
101  return false;
102  }
103 
104  // *** header ***
105  if (!header.read(connection)) {
106  return false;
107  }
108 
109  // *** child_frame_id ***
110  if (!reader.readString(child_frame_id)) {
111  return false;
112  }
113 
114  // *** pose ***
115  if (!pose.read(connection)) {
116  return false;
117  }
118 
119  // *** twist ***
120  if (!twist.read(connection)) {
121  return false;
122  }
123 
124  return !connection.isError();
125  }
126 
128  bool read(yarp::os::ConnectionReader& connection) override
129  {
130  return (connection.isBareMode() ? readBare(connection)
131  : readBottle(connection));
132  }
133 
134  bool writeBare(yarp::os::ConnectionWriter& connection) const override
135  {
136  // *** header ***
137  if (!header.write(connection)) {
138  return false;
139  }
140 
141  // *** child_frame_id ***
142  connection.appendInt32(child_frame_id.length());
143  connection.appendExternalBlock((char*)child_frame_id.c_str(), child_frame_id.length());
144 
145  // *** pose ***
146  if (!pose.write(connection)) {
147  return false;
148  }
149 
150  // *** twist ***
151  if (!twist.write(connection)) {
152  return false;
153  }
154 
155  return !connection.isError();
156  }
157 
158  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
159  {
160  connection.appendInt32(BOTTLE_TAG_LIST);
161  connection.appendInt32(4);
162 
163  // *** header ***
164  if (!header.write(connection)) {
165  return false;
166  }
167 
168  // *** child_frame_id ***
169  connection.appendInt32(BOTTLE_TAG_STRING);
170  connection.appendInt32(child_frame_id.length());
171  connection.appendExternalBlock((char*)child_frame_id.c_str(), child_frame_id.length());
172 
173  // *** pose ***
174  if (!pose.write(connection)) {
175  return false;
176  }
177 
178  // *** twist ***
179  if (!twist.write(connection)) {
180  return false;
181  }
182 
183  connection.convertTextMode();
184  return !connection.isError();
185  }
186 
188  bool write(yarp::os::ConnectionWriter& connection) const override
189  {
190  return (connection.isBareMode() ? writeBare(connection)
191  : writeBottle(connection));
192  }
193 
194  // This class will serialize ROS style or YARP style depending on protocol.
195  // If you need to force a serialization style, use one of these classes:
198 
199  // The name for this message, ROS will need this
200  static constexpr const char* typeName = "nav_msgs/Odometry";
201 
202  // The checksum for this message, ROS will need this
203  static constexpr const char* typeChecksum = "cd5e73d190d741a2f92e81eda573aca7";
204 
205  // The source text for this message, ROS will need this
206  static constexpr const char* typeText = "\
207 # This represents an estimate of a position and velocity in free space. \n\
208 # The pose in this message should be specified in the coordinate frame given by header.frame_id.\n\
209 # The twist in this message should be specified in the coordinate frame given by the child_frame_id\n\
210 Header header\n\
211 string child_frame_id\n\
212 geometry_msgs/PoseWithCovariance pose\n\
213 geometry_msgs/TwistWithCovariance twist\n\
214 \n\
215 ================================================================================\n\
216 MSG: std_msgs/Header\n\
217 # Standard metadata for higher-level stamped data types.\n\
218 # This is generally used to communicate timestamped data \n\
219 # in a particular coordinate frame.\n\
220 # \n\
221 # sequence ID: consecutively increasing ID \n\
222 uint32 seq\n\
223 #Two-integer timestamp that is expressed as:\n\
224 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
225 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
226 # time-handling sugar is provided by the client library\n\
227 time stamp\n\
228 #Frame this data is associated with\n\
229 # 0: no frame\n\
230 # 1: global frame\n\
231 string frame_id\n\
232 \n\
233 ================================================================================\n\
234 MSG: geometry_msgs/PoseWithCovariance\n\
235 # This represents a pose in free space with uncertainty.\n\
236 \n\
237 Pose pose\n\
238 \n\
239 # Row-major representation of the 6x6 covariance matrix\n\
240 # The orientation parameters use a fixed-axis representation.\n\
241 # In order, the parameters are:\n\
242 # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)\n\
243 float64[36] covariance\n\
244 \n\
245 ================================================================================\n\
246 MSG: geometry_msgs/Pose\n\
247 # A representation of pose in free space, composed of position and orientation. \n\
248 Point position\n\
249 Quaternion orientation\n\
250 \n\
251 ================================================================================\n\
252 MSG: geometry_msgs/Point\n\
253 # This contains the position of a point in free space\n\
254 float64 x\n\
255 float64 y\n\
256 float64 z\n\
257 \n\
258 ================================================================================\n\
259 MSG: geometry_msgs/Quaternion\n\
260 # This represents an orientation in free space in quaternion form.\n\
261 \n\
262 float64 x\n\
263 float64 y\n\
264 float64 z\n\
265 float64 w\n\
266 \n\
267 ================================================================================\n\
268 MSG: geometry_msgs/TwistWithCovariance\n\
269 # This expresses velocity in free space with uncertainty.\n\
270 \n\
271 Twist twist\n\
272 \n\
273 # Row-major representation of the 6x6 covariance matrix\n\
274 # The orientation parameters use a fixed-axis representation.\n\
275 # In order, the parameters are:\n\
276 # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)\n\
277 float64[36] covariance\n\
278 \n\
279 ================================================================================\n\
280 MSG: geometry_msgs/Twist\n\
281 # This expresses velocity in free space broken into its linear and angular parts.\n\
282 Vector3 linear\n\
283 Vector3 angular\n\
284 \n\
285 ================================================================================\n\
286 MSG: geometry_msgs/Vector3\n\
287 # This represents a vector in free space. \n\
288 # It is only meant to represent a direction. Therefore, it does not\n\
289 # make sense to apply a translation to it (e.g., when applying a \n\
290 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
291 # rotation). If you want your data to be translatable too, use the\n\
292 # geometry_msgs/Point message instead.\n\
293 \n\
294 float64 x\n\
295 float64 y\n\
296 float64 z\n\
297 ";
298 
299  yarp::os::Type getType() const override
300  {
302  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
303  typ.addProperty("message_definition", yarp::os::Value(typeText));
304  return typ;
305  }
306 };
307 
308 } // namespace nav_msgs
309 } // namespace rosmsg
310 } // namespace yarp
311 
312 #endif // YARP_ROSMSG_nav_msgs_Odometry_h
yarp::rosmsg::std_msgs::Header::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:115
yarp::os::idl::WireReader::readString
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:339
yarp::rosmsg::nav_msgs::Odometry::rosStyle
yarp::os::idl::BareStyle< yarp::rosmsg::nav_msgs::Odometry > rosStyle
Definition: Odometry.h:196
yarp::rosmsg::nav_msgs::Odometry::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Odometry.h:188
WireTypes.h
BOTTLE_TAG_LIST
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
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
Header.h
yarp::rosmsg::geometry_msgs::TwistWithCovariance
Definition: TwistWithCovariance.h:39
yarp::os::ConnectionReader::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::std_msgs::Header::clear
void clear()
Definition: Header.h:58
BOTTLE_TAG_STRING
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
Wire.h
yarp::rosmsg::nav_msgs::Odometry::getType
yarp::os::Type getType() const override
Definition: Odometry.h:299
yarp::rosmsg::geometry_msgs::PoseWithCovariance::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: PoseWithCovariance.h:148
yarp::os::ConnectionWriter::isError
virtual bool isError() const =0
yarp::rosmsg::nav_msgs::Odometry::typeText
static constexpr const char * typeText
Definition: Odometry.h:206
yarp::os::Type::byName
static Type byName(const char *name)
Definition: Type.cpp:174
yarp::os::ConnectionReader::expectInt32
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
yarp::rosmsg::nav_msgs::Odometry
Definition: Odometry.h:39
yarp::os::Type::addProperty
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:137
Type.h
yarp::rosmsg::geometry_msgs::PoseWithCovariance::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: PoseWithCovariance.h:105
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::rosmsg::nav_msgs::Odometry::bottleStyle
yarp::os::idl::BottleStyle< yarp::rosmsg::nav_msgs::Odometry > bottleStyle
Definition: Odometry.h:197
yarp::rosmsg::nav_msgs::Odometry::Odometry
Odometry()
Definition: Odometry.h:46
yarp::os::ConnectionReader::isError
virtual bool isError() const =0
yarp::rosmsg::nav_msgs::Odometry::typeName
static constexpr const char * typeName
Definition: Odometry.h:200
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::rosmsg::nav_msgs::Odometry::pose
yarp::rosmsg::geometry_msgs::PoseWithCovariance pose
Definition: Odometry.h:43
TwistWithCovariance.h
yarp::os::idl::WirePortable
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:26
yarp::rosmsg::nav_msgs::Odometry::child_frame_id
std::string child_frame_id
Definition: Odometry.h:42
yarp::os::ConnectionWriter::isBareMode
virtual bool isBareMode() const =0
Check if the connection is bare mode.
yarp::rosmsg::geometry_msgs::TwistWithCovariance::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: TwistWithCovariance.h:105
yarp::rosmsg::nav_msgs::Odometry::twist
yarp::rosmsg::geometry_msgs::TwistWithCovariance twist
Definition: Odometry.h:44
yarp::rosmsg::nav_msgs::Odometry::readBottle
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: Odometry.h:96
yarp::rosmsg::std_msgs::Header::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:162
yarp::rosmsg::nav_msgs::Odometry::writeBare
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: Odometry.h:134
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.
nav_msgs
Definition: GetMap.h:22
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::rosmsg::nav_msgs::Odometry::typeChecksum
static constexpr const char * typeChecksum
Definition: Odometry.h:203
yarp::os::idl::BareStyle
Definition: BareStyle.h:22
yarp::rosmsg::geometry_msgs::TwistWithCovariance::write
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: TwistWithCovariance.h:148
yarp::rosmsg::nav_msgs::Odometry::clear
void clear()
Definition: Odometry.h:54
yarp::rosmsg::nav_msgs::Odometry::writeBottle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: Odometry.h:158
yarp::rosmsg::geometry_msgs::TwistWithCovariance::clear
void clear()
Definition: TwistWithCovariance.h:51
yarp::rosmsg::geometry_msgs::PoseWithCovariance
Definition: PoseWithCovariance.h:39
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::rosmsg::nav_msgs::Odometry::header
yarp::rosmsg::std_msgs::Header header
Definition: Odometry.h:41
yarp::rosmsg::nav_msgs::Odometry::readBare
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: Odometry.h:69
yarp::os::ConnectionWriter::appendExternalBlock
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
yarp::rosmsg::geometry_msgs::PoseWithCovariance::clear
void clear()
Definition: PoseWithCovariance.h:51
yarp::rosmsg::nav_msgs::Odometry::read
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Odometry.h:128
yarp::os::ConnectionReader::expectBlock
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
PoseWithCovariance.h
yarp::rosmsg::std_msgs::Header
Definition: Header.h:45
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