YARP
Yet Another Robot Platform
GoalStatus.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 "actionlib_msgs/GoalStatus" msg definition:
9// GoalID goal_id
10// uint8 status
11// uint8 PENDING = 0 # The goal has yet to be processed by the action server
12// uint8 ACTIVE = 1 # The goal is currently being processed by the action server
13// uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing
14// # and has since completed its execution (Terminal State)
15// uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)
16// uint8 ABORTED = 4 # The goal was aborted during execution by the action server due
17// # to some failure (Terminal State)
18// uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,
19// # because the goal was unattainable or invalid (Terminal State)
20// uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing
21// # and has not yet completed execution
22// uint8 RECALLING = 7 # The goal received a cancel request before it started executing,
23// # but the action server has not yet confirmed that the goal is canceled
24// uint8 RECALLED = 8 # The goal received a cancel request before it started executing
25// # and was successfully cancelled (Terminal State)
26// uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be
27// # sent over the wire by an action server
28//
29// #Allow for the user to associate a string with GoalStatus for debugging
30// string text
31//
32// Instances of this class can be read and written with YARP ports,
33// using a ROS-compatible format.
34
35#ifndef YARP_ROSMSG_actionlib_msgs_GoalStatus_h
36#define YARP_ROSMSG_actionlib_msgs_GoalStatus_h
37
38#include <yarp/os/Wire.h>
39#include <yarp/os/Type.h>
41#include <string>
42#include <vector>
44
45namespace yarp {
46namespace rosmsg {
47namespace actionlib_msgs {
48
50{
51public:
53 std::uint8_t status;
54 static const std::uint8_t PENDING = 0;
55 static const std::uint8_t ACTIVE = 1;
56 static const std::uint8_t PREEMPTED = 2;
57 static const std::uint8_t SUCCEEDED = 3;
58 static const std::uint8_t ABORTED = 4;
59 static const std::uint8_t REJECTED = 5;
60 static const std::uint8_t PREEMPTING = 6;
61 static const std::uint8_t RECALLING = 7;
62 static const std::uint8_t RECALLED = 8;
63 static const std::uint8_t LOST = 9;
64 std::string text;
65
66 GoalStatus() :
67 goal_id(),
68 status(0),
69 text("")
70 {
71 }
72
73 void clear()
74 {
75 // *** goal_id ***
76 goal_id.clear();
77
78 // *** status ***
79 status = 0;
80
81 // *** PENDING ***
82
83 // *** ACTIVE ***
84
85 // *** PREEMPTED ***
86
87 // *** SUCCEEDED ***
88
89 // *** ABORTED ***
90
91 // *** REJECTED ***
92
93 // *** PREEMPTING ***
94
95 // *** RECALLING ***
96
97 // *** RECALLED ***
98
99 // *** LOST ***
100
101 // *** text ***
102 text = "";
103 }
104
105 bool readBare(yarp::os::ConnectionReader& connection) override
106 {
107 // *** goal_id ***
108 if (!goal_id.read(connection)) {
109 return false;
110 }
111
112 // *** status ***
113 status = connection.expectInt8();
114
115 // *** text ***
116 int len = connection.expectInt32();
117 text.resize(len);
118 if (!connection.expectBlock((char*)text.c_str(), len)) {
119 return false;
120 }
121
122 return !connection.isError();
123 }
124
125 bool readBottle(yarp::os::ConnectionReader& connection) override
126 {
127 connection.convertTextMode();
128 yarp::os::idl::WireReader reader(connection);
129 if (!reader.readListHeader(13)) {
130 return false;
131 }
132
133 // *** goal_id ***
134 if (!goal_id.read(connection)) {
135 return false;
136 }
137
138 // *** status ***
139 status = reader.expectInt8();
140
141 // *** text ***
142 if (!reader.readString(text)) {
143 return false;
144 }
145
146 return !connection.isError();
147 }
148
150 bool read(yarp::os::ConnectionReader& connection) override
151 {
152 return (connection.isBareMode() ? readBare(connection)
153 : readBottle(connection));
154 }
155
156 bool writeBare(yarp::os::ConnectionWriter& connection) const override
157 {
158 // *** goal_id ***
159 if (!goal_id.write(connection)) {
160 return false;
161 }
162
163 // *** status ***
164 connection.appendInt8(status);
165
166 // *** text ***
167 connection.appendInt32(text.length());
168 connection.appendExternalBlock((char*)text.c_str(), text.length());
169
170 return !connection.isError();
171 }
172
173 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
174 {
175 connection.appendInt32(BOTTLE_TAG_LIST);
176 connection.appendInt32(13);
177
178 // *** goal_id ***
179 if (!goal_id.write(connection)) {
180 return false;
181 }
182
183 // *** status ***
184 connection.appendInt32(BOTTLE_TAG_INT8);
185 connection.appendInt8(status);
186
187 // *** text ***
188 connection.appendInt32(BOTTLE_TAG_STRING);
189 connection.appendInt32(text.length());
190 connection.appendExternalBlock((char*)text.c_str(), text.length());
191
192 connection.convertTextMode();
193 return !connection.isError();
194 }
195
197 bool write(yarp::os::ConnectionWriter& connection) const override
198 {
199 return (connection.isBareMode() ? writeBare(connection)
200 : writeBottle(connection));
201 }
202
203 // This class will serialize ROS style or YARP style depending on protocol.
204 // If you need to force a serialization style, use one of these classes:
207
208 // The name for this message, ROS will need this
209 static constexpr const char* typeName = "actionlib_msgs/GoalStatus";
210
211 // The checksum for this message, ROS will need this
212 static constexpr const char* typeChecksum = "d388f9b87b3c471f784434d671988d4a";
213
214 // The source text for this message, ROS will need this
215 static constexpr const char* typeText = "\
216GoalID goal_id\n\
217uint8 status\n\
218uint8 PENDING = 0 # The goal has yet to be processed by the action server\n\
219uint8 ACTIVE = 1 # The goal is currently being processed by the action server\n\
220uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing\n\
221 # and has since completed its execution (Terminal State)\n\
222uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)\n\
223uint8 ABORTED = 4 # The goal was aborted during execution by the action server due\n\
224 # to some failure (Terminal State)\n\
225uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,\n\
226 # because the goal was unattainable or invalid (Terminal State)\n\
227uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing\n\
228 # and has not yet completed execution\n\
229uint8 RECALLING = 7 # The goal received a cancel request before it started executing,\n\
230 # but the action server has not yet confirmed that the goal is canceled\n\
231uint8 RECALLED = 8 # The goal received a cancel request before it started executing\n\
232 # and was successfully cancelled (Terminal State)\n\
233uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be\n\
234 # sent over the wire by an action server\n\
235\n\
236#Allow for the user to associate a string with GoalStatus for debugging\n\
237string text\n\
238\n\
239\n\
240================================================================================\n\
241MSG: actionlib_msgs/GoalID\n\
242# The stamp should store the time at which this goal was requested.\n\
243# It is used by an action server when it tries to preempt all\n\
244# goals that were requested before a certain time\n\
245time stamp\n\
246\n\
247# The id provides a way to associate feedback and\n\
248# result message with specific goal requests. The id\n\
249# specified must be unique.\n\
250string id\n\
251\n\
252";
253
254 yarp::os::Type getType() const override
255 {
256 yarp::os::Type typ = yarp::os::Type::byName(typeName, typeName);
257 typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
258 typ.addProperty("message_definition", yarp::os::Value(typeText));
259 return typ;
260 }
261};
262
263} // namespace actionlib_msgs
264} // namespace rosmsg
265} // namespace yarp
266
267#endif // YARP_ROSMSG_actionlib_msgs_GoalStatus_h
#define BOTTLE_TAG_INT8
Definition: Bottle.h:19
#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
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
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 appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
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 readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:376
std::int8_t expectInt8()
Definition: WireReader.h:77
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: GoalID.h:96
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: GoalID.h:136
yarp::rosmsg::actionlib_msgs::GoalStatus GoalStatus
Definition: GoalStatus.h:21
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:915
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
The main, catch-all namespace for YARP.
Definition: dirs.h:16