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