YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Twist.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/Twist" msg definition:
9// # This expresses velocity in free space broken into its linear and angular parts.
10// Vector3 linear
11// Vector3 angular
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_Twist_h
16#define YARP_ROSMSG_geometry_msgs_Twist_h
17
18#include <yarp/os/Wire.h>
19#include <yarp/os/Type.h>
21#include <string>
22#include <vector>
24
25namespace yarp {
26namespace rosmsg {
27namespace geometry_msgs {
28
30{
31public:
34
36 linear(),
37 angular()
38 {
39 }
40
41 void clear()
42 {
43 // *** linear ***
44 linear.clear();
45
46 // *** angular ***
47 angular.clear();
48 }
49
50 bool readBare(yarp::os::ConnectionReader& connection) override
51 {
52 // *** linear ***
53 if (!linear.read(connection)) {
54 return false;
55 }
56
57 // *** angular ***
58 if (!angular.read(connection)) {
59 return false;
60 }
61
62 return !connection.isError();
63 }
64
65 bool readBottle(yarp::os::ConnectionReader& connection) override
66 {
67 connection.convertTextMode();
68 yarp::os::idl::WireReader reader(connection);
69 if (!reader.readListHeader(2)) {
70 return false;
71 }
72
73 // *** linear ***
74 if (!linear.read(connection)) {
75 return false;
76 }
77
78 // *** angular ***
79 if (!angular.read(connection)) {
80 return false;
81 }
82
83 return !connection.isError();
84 }
85
87 bool read(yarp::os::ConnectionReader& connection) override
88 {
89 return (connection.isBareMode() ? readBare(connection)
90 : readBottle(connection));
91 }
92
93 bool writeBare(yarp::os::ConnectionWriter& connection) const override
94 {
95 // *** linear ***
96 if (!linear.write(connection)) {
97 return false;
98 }
99
100 // *** angular ***
101 if (!angular.write(connection)) {
102 return false;
103 }
104
105 return !connection.isError();
106 }
107
108 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
109 {
110 connection.appendInt32(BOTTLE_TAG_LIST);
111 connection.appendInt32(2);
112
113 // *** linear ***
114 if (!linear.write(connection)) {
115 return false;
116 }
117
118 // *** angular ***
119 if (!angular.write(connection)) {
120 return false;
121 }
122
123 connection.convertTextMode();
124 return !connection.isError();
125 }
126
128 bool write(yarp::os::ConnectionWriter& connection) const override
129 {
130 return (connection.isBareMode() ? writeBare(connection)
131 : writeBottle(connection));
132 }
133
134 // This class will serialize ROS style or YARP style depending on protocol.
135 // If you need to force a serialization style, use one of these classes:
138
139 // The name for this message, ROS will need this
140 static constexpr const char* typeName = "geometry_msgs/Twist";
141
142 // The checksum for this message, ROS will need this
143 static constexpr const char* typeChecksum = "9f195f881246fdfa2798d1d3eebca84a";
144
145 // The source text for this message, ROS will need this
146 static constexpr const char* typeText = "\
147# This expresses velocity in free space broken into its linear and angular parts.\n\
148Vector3 linear\n\
149Vector3 angular\n\
150\n\
151================================================================================\n\
152MSG: geometry_msgs/Vector3\n\
153# This represents a vector in free space. \n\
154# It is only meant to represent a direction. Therefore, it does not\n\
155# make sense to apply a translation to it (e.g., when applying a \n\
156# generic rigid transformation to a Vector3, tf2 will only apply the\n\
157# rotation). If you want your data to be translatable too, use the\n\
158# geometry_msgs/Point message instead.\n\
159\n\
160float64 x\n\
161float64 y\n\
162float64 z\n\
163";
164
165 yarp::os::Type getType() const override
166 {
169 typ.addProperty("message_definition", yarp::os::Value(typeText));
170 return typ;
171 }
172};
173
174} // namespace geometry_msgs
175} // namespace rosmsg
176} // namespace yarp
177
178#endif // YARP_ROSMSG_geometry_msgs_Twist_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:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
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:27
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition Twist.h:128
static constexpr const char * typeText
Definition Twist.h:146
yarp::os::Type getType() const override
Definition Twist.h:165
static constexpr const char * typeChecksum
Definition Twist.h:143
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition Twist.h:93
yarp::os::idl::BottleStyle< yarp::rosmsg::geometry_msgs::Twist > bottleStyle
Definition Twist.h:137
static constexpr const char * typeName
Definition Twist.h:140
yarp::rosmsg::geometry_msgs::Vector3 angular
Definition Twist.h:33
yarp::rosmsg::geometry_msgs::Vector3 linear
Definition Twist.h:32
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition Twist.h:108
bool readBare(yarp::os::ConnectionReader &connection) override
Definition Twist.h:50
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition Twist.h:87
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition Twist.h:65
yarp::os::idl::BareStyle< yarp::rosmsg::geometry_msgs::Twist > rosStyle
Definition Twist.h:136
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition Vector3.h:95
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition Vector3.h:137
The main, catch-all namespace for YARP.
Definition dirs.h:16