YARP
Yet Another Robot Platform
InteractiveMarkerInit.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 "visualization_msgs/InteractiveMarkerInit" msg definition:
9 // # Identifying string. Must be unique in the topic namespace
10 // # that this server works on.
11 // string server_id
12 //
13 // # Sequence number.
14 // # The client will use this to detect if it has missed a subsequent
15 // # update. Every update message will have the same sequence number as
16 // # an init message. Clients will likely want to unsubscribe from the
17 // # init topic after a successful initialization to avoid receiving
18 // # duplicate data.
19 // uint64 seq_num
20 //
21 // # All markers.
22 // InteractiveMarker[] markers
23 // Instances of this class can be read and written with YARP ports,
24 // using a ROS-compatible format.
25 
26 #ifndef YARP_ROSMSG_visualization_msgs_InteractiveMarkerInit_h
27 #define YARP_ROSMSG_visualization_msgs_InteractiveMarkerInit_h
28 
29 #include <yarp/os/Wire.h>
30 #include <yarp/os/Type.h>
31 #include <yarp/os/idl/WireTypes.h>
32 #include <string>
33 #include <vector>
35 
36 namespace yarp {
37 namespace rosmsg {
38 namespace visualization_msgs {
39 
41 {
42 public:
43  std::string server_id;
44  std::uint64_t seq_num;
45  std::vector<yarp::rosmsg::visualization_msgs::InteractiveMarker> markers;
46 
48  server_id(""),
49  seq_num(0),
50  markers()
51  {
52  }
53 
54  void clear()
55  {
56  // *** server_id ***
57  server_id = "";
58 
59  // *** seq_num ***
60  seq_num = 0;
61 
62  // *** markers ***
63  markers.clear();
64  }
65 
66  bool readBare(yarp::os::ConnectionReader& connection) override
67  {
68  // *** server_id ***
69  int len = connection.expectInt32();
70  server_id.resize(len);
71  if (!connection.expectBlock((char*)server_id.c_str(), len)) {
72  return false;
73  }
74 
75  // *** seq_num ***
76  seq_num = connection.expectInt64();
77 
78  // *** markers ***
79  len = connection.expectInt32();
80  markers.resize(len);
81  for (int i=0; i<len; i++) {
82  if (!markers[i].read(connection)) {
83  return false;
84  }
85  }
86 
87  return !connection.isError();
88  }
89 
90  bool readBottle(yarp::os::ConnectionReader& connection) override
91  {
92  connection.convertTextMode();
93  yarp::os::idl::WireReader reader(connection);
94  if (!reader.readListHeader(3)) {
95  return false;
96  }
97 
98  // *** server_id ***
99  if (!reader.readString(server_id)) {
100  return false;
101  }
102 
103  // *** seq_num ***
104  seq_num = reader.expectInt64();
105 
106  // *** markers ***
107  if (connection.expectInt32() != BOTTLE_TAG_LIST) {
108  return false;
109  }
110  int len = connection.expectInt32();
111  markers.resize(len);
112  for (int i=0; i<len; i++) {
113  if (!markers[i].read(connection)) {
114  return false;
115  }
116  }
117 
118  return !connection.isError();
119  }
120 
122  bool read(yarp::os::ConnectionReader& connection) override
123  {
124  return (connection.isBareMode() ? readBare(connection)
125  : readBottle(connection));
126  }
127 
128  bool writeBare(yarp::os::ConnectionWriter& connection) const override
129  {
130  // *** server_id ***
131  connection.appendInt32(server_id.length());
132  connection.appendExternalBlock((char*)server_id.c_str(), server_id.length());
133 
134  // *** seq_num ***
135  connection.appendInt64(seq_num);
136 
137  // *** markers ***
138  connection.appendInt32(markers.size());
139  for (size_t i=0; i<markers.size(); i++) {
140  if (!markers[i].write(connection)) {
141  return false;
142  }
143  }
144 
145  return !connection.isError();
146  }
147 
148  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
149  {
150  connection.appendInt32(BOTTLE_TAG_LIST);
151  connection.appendInt32(3);
152 
153  // *** server_id ***
154  connection.appendInt32(BOTTLE_TAG_STRING);
155  connection.appendInt32(server_id.length());
156  connection.appendExternalBlock((char*)server_id.c_str(), server_id.length());
157 
158  // *** seq_num ***
159  connection.appendInt32(BOTTLE_TAG_INT64);
160  connection.appendInt64(seq_num);
161 
162  // *** markers ***
163  connection.appendInt32(BOTTLE_TAG_LIST);
164  connection.appendInt32(markers.size());
165  for (size_t i=0; i<markers.size(); i++) {
166  if (!markers[i].write(connection)) {
167  return false;
168  }
169  }
170 
171  connection.convertTextMode();
172  return !connection.isError();
173  }
174 
176  bool write(yarp::os::ConnectionWriter& connection) const override
177  {
178  return (connection.isBareMode() ? writeBare(connection)
179  : writeBottle(connection));
180  }
181 
182  // This class will serialize ROS style or YARP style depending on protocol.
183  // If you need to force a serialization style, use one of these classes:
186 
187  // The name for this message, ROS will need this
188  static constexpr const char* typeName = "visualization_msgs/InteractiveMarkerInit";
189 
190  // The checksum for this message, ROS will need this
191  static constexpr const char* typeChecksum = "d5f2c5045a72456d228676ab91048734";
192 
193  // The source text for this message, ROS will need this
194  static constexpr const char* typeText = "\
195 # Identifying string. Must be unique in the topic namespace\n\
196 # that this server works on.\n\
197 string server_id\n\
198 \n\
199 # Sequence number.\n\
200 # The client will use this to detect if it has missed a subsequent\n\
201 # update. Every update message will have the same sequence number as\n\
202 # an init message. Clients will likely want to unsubscribe from the\n\
203 # init topic after a successful initialization to avoid receiving\n\
204 # duplicate data.\n\
205 uint64 seq_num\n\
206 \n\
207 # All markers.\n\
208 InteractiveMarker[] markers\n\
209 \n\
210 ================================================================================\n\
211 MSG: visualization_msgs/InteractiveMarker\n\
212 # Time/frame info.\n\
213 # If header.time is set to 0, the marker will be retransformed into\n\
214 # its frame on each timestep. You will receive the pose feedback\n\
215 # in the same frame.\n\
216 # Otherwise, you might receive feedback in a different frame.\n\
217 # For rviz, this will be the current 'fixed frame' set by the user.\n\
218 Header header\n\
219 \n\
220 # Initial pose. Also, defines the pivot point for rotations.\n\
221 geometry_msgs/Pose pose\n\
222 \n\
223 # Identifying string. Must be globally unique in\n\
224 # the topic that this message is sent through.\n\
225 string name\n\
226 \n\
227 # Short description (< 40 characters).\n\
228 string description\n\
229 \n\
230 # Scale to be used for default controls (default=1).\n\
231 float32 scale\n\
232 \n\
233 # All menu and submenu entries associated with this marker.\n\
234 MenuEntry[] menu_entries\n\
235 \n\
236 # List of controls displayed for this marker.\n\
237 InteractiveMarkerControl[] controls\n\
238 \n\
239 ================================================================================\n\
240 MSG: std_msgs/Header\n\
241 # Standard metadata for higher-level stamped data types.\n\
242 # This is generally used to communicate timestamped data \n\
243 # in a particular coordinate frame.\n\
244 # \n\
245 # sequence ID: consecutively increasing ID \n\
246 uint32 seq\n\
247 #Two-integer timestamp that is expressed as:\n\
248 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
249 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
250 # time-handling sugar is provided by the client library\n\
251 time stamp\n\
252 #Frame this data is associated with\n\
253 # 0: no frame\n\
254 # 1: global frame\n\
255 string frame_id\n\
256 \n\
257 ================================================================================\n\
258 MSG: geometry_msgs/Pose\n\
259 # A representation of pose in free space, composed of position and orientation. \n\
260 Point position\n\
261 Quaternion orientation\n\
262 \n\
263 ================================================================================\n\
264 MSG: geometry_msgs/Point\n\
265 # This contains the position of a point in free space\n\
266 float64 x\n\
267 float64 y\n\
268 float64 z\n\
269 \n\
270 ================================================================================\n\
271 MSG: geometry_msgs/Quaternion\n\
272 # This represents an orientation in free space in quaternion form.\n\
273 \n\
274 float64 x\n\
275 float64 y\n\
276 float64 z\n\
277 float64 w\n\
278 \n\
279 ================================================================================\n\
280 MSG: visualization_msgs/MenuEntry\n\
281 # MenuEntry message.\n\
282 \n\
283 # Each InteractiveMarker message has an array of MenuEntry messages.\n\
284 # A collection of MenuEntries together describe a\n\
285 # menu/submenu/subsubmenu/etc tree, though they are stored in a flat\n\
286 # array. The tree structure is represented by giving each menu entry\n\
287 # an ID number and a \"parent_id\" field. Top-level entries are the\n\
288 # ones with parent_id = 0. Menu entries are ordered within their\n\
289 # level the same way they are ordered in the containing array. Parent\n\
290 # entries must appear before their children.\n\
291 \n\
292 # Example:\n\
293 # - id = 3\n\
294 # parent_id = 0\n\
295 # title = \"fun\"\n\
296 # - id = 2\n\
297 # parent_id = 0\n\
298 # title = \"robot\"\n\
299 # - id = 4\n\
300 # parent_id = 2\n\
301 # title = \"pr2\"\n\
302 # - id = 5\n\
303 # parent_id = 2\n\
304 # title = \"turtle\"\n\
305 #\n\
306 # Gives a menu tree like this:\n\
307 # - fun\n\
308 # - robot\n\
309 # - pr2\n\
310 # - turtle\n\
311 \n\
312 # ID is a number for each menu entry. Must be unique within the\n\
313 # control, and should never be 0.\n\
314 uint32 id\n\
315 \n\
316 # ID of the parent of this menu entry, if it is a submenu. If this\n\
317 # menu entry is a top-level entry, set parent_id to 0.\n\
318 uint32 parent_id\n\
319 \n\
320 # menu / entry title\n\
321 string title\n\
322 \n\
323 # Arguments to command indicated by command_type (below)\n\
324 string command\n\
325 \n\
326 # Command_type stores the type of response desired when this menu\n\
327 # entry is clicked.\n\
328 # FEEDBACK: send an InteractiveMarkerFeedback message with menu_entry_id set to this entry's id.\n\
329 # ROSRUN: execute \"rosrun\" with arguments given in the command field (above).\n\
330 # ROSLAUNCH: execute \"roslaunch\" with arguments given in the command field (above).\n\
331 uint8 FEEDBACK=0\n\
332 uint8 ROSRUN=1\n\
333 uint8 ROSLAUNCH=2\n\
334 uint8 command_type\n\
335 \n\
336 ================================================================================\n\
337 MSG: visualization_msgs/InteractiveMarkerControl\n\
338 # Represents a control that is to be displayed together with an interactive marker\n\
339 \n\
340 # Identifying string for this control.\n\
341 # You need to assign a unique value to this to receive feedback from the GUI\n\
342 # on what actions the user performs on this control (e.g. a button click).\n\
343 string name\n\
344 \n\
345 \n\
346 # Defines the local coordinate frame (relative to the pose of the parent\n\
347 # interactive marker) in which is being rotated and translated.\n\
348 # Default: Identity\n\
349 geometry_msgs/Quaternion orientation\n\
350 \n\
351 \n\
352 # Orientation mode: controls how orientation changes.\n\
353 # INHERIT: Follow orientation of interactive marker\n\
354 # FIXED: Keep orientation fixed at initial state\n\
355 # VIEW_FACING: Align y-z plane with screen (x: forward, y:left, z:up).\n\
356 uint8 INHERIT = 0 \n\
357 uint8 FIXED = 1\n\
358 uint8 VIEW_FACING = 2\n\
359 \n\
360 uint8 orientation_mode\n\
361 \n\
362 # Interaction mode for this control\n\
363 # \n\
364 # NONE: This control is only meant for visualization; no context menu.\n\
365 # MENU: Like NONE, but right-click menu is active.\n\
366 # BUTTON: Element can be left-clicked.\n\
367 # MOVE_AXIS: Translate along local x-axis.\n\
368 # MOVE_PLANE: Translate in local y-z plane.\n\
369 # ROTATE_AXIS: Rotate around local x-axis.\n\
370 # MOVE_ROTATE: Combines MOVE_PLANE and ROTATE_AXIS.\n\
371 uint8 NONE = 0 \n\
372 uint8 MENU = 1\n\
373 uint8 BUTTON = 2\n\
374 uint8 MOVE_AXIS = 3 \n\
375 uint8 MOVE_PLANE = 4\n\
376 uint8 ROTATE_AXIS = 5\n\
377 uint8 MOVE_ROTATE = 6\n\
378 # \"3D\" interaction modes work with the mouse+SHIFT+CTRL or with 3D cursors.\n\
379 # MOVE_3D: Translate freely in 3D space.\n\
380 # ROTATE_3D: Rotate freely in 3D space about the origin of parent frame.\n\
381 # MOVE_ROTATE_3D: Full 6-DOF freedom of translation and rotation about the cursor origin.\n\
382 uint8 MOVE_3D = 7\n\
383 uint8 ROTATE_3D = 8\n\
384 uint8 MOVE_ROTATE_3D = 9\n\
385 \n\
386 uint8 interaction_mode\n\
387 \n\
388 \n\
389 # If true, the contained markers will also be visible\n\
390 # when the gui is not in interactive mode.\n\
391 bool always_visible\n\
392 \n\
393 \n\
394 # Markers to be displayed as custom visual representation.\n\
395 # Leave this empty to use the default control handles.\n\
396 #\n\
397 # Note: \n\
398 # - The markers can be defined in an arbitrary coordinate frame,\n\
399 # but will be transformed into the local frame of the interactive marker.\n\
400 # - If the header of a marker is empty, its pose will be interpreted as \n\
401 # relative to the pose of the parent interactive marker.\n\
402 Marker[] markers\n\
403 \n\
404 \n\
405 # In VIEW_FACING mode, set this to true if you don't want the markers\n\
406 # to be aligned with the camera view point. The markers will show up\n\
407 # as in INHERIT mode.\n\
408 bool independent_marker_orientation\n\
409 \n\
410 \n\
411 # Short description (< 40 characters) of what this control does,\n\
412 # e.g. \"Move the robot\". \n\
413 # Default: A generic description based on the interaction mode\n\
414 string description\n\
415 \n\
416 ================================================================================\n\
417 MSG: visualization_msgs/Marker\n\
418 # See http://www.ros.org/wiki/rviz/DisplayTypes/Marker and http://www.ros.org/wiki/rviz/Tutorials/Markers%3A%20Basic%20Shapes for more information on using this message with rviz\n\
419 \n\
420 uint8 ARROW=0\n\
421 uint8 CUBE=1\n\
422 uint8 SPHERE=2\n\
423 uint8 CYLINDER=3\n\
424 uint8 LINE_STRIP=4\n\
425 uint8 LINE_LIST=5\n\
426 uint8 CUBE_LIST=6\n\
427 uint8 SPHERE_LIST=7\n\
428 uint8 POINTS=8\n\
429 uint8 TEXT_VIEW_FACING=9\n\
430 uint8 MESH_RESOURCE=10\n\
431 uint8 TRIANGLE_LIST=11\n\
432 \n\
433 uint8 ADD=0\n\
434 uint8 MODIFY=0\n\
435 uint8 DELETE=2\n\
436 uint8 DELETEALL=3\n\
437 \n\
438 Header header # header for time/frame information\n\
439 string ns # Namespace to place this object in... used in conjunction with id to create a unique name for the object\n\
440 int32 id # object ID useful in conjunction with the namespace for manipulating and deleting the object later\n\
441 int32 type # Type of object\n\
442 int32 action # 0 add/modify an object, 1 (deprecated), 2 deletes an object, 3 deletes all objects\n\
443 geometry_msgs/Pose pose # Pose of the object\n\
444 geometry_msgs/Vector3 scale # Scale of the object 1,1,1 means default (usually 1 meter square)\n\
445 std_msgs/ColorRGBA color # Color [0.0-1.0]\n\
446 duration lifetime # How long the object should last before being automatically deleted. 0 means forever\n\
447 bool frame_locked # If this marker should be frame-locked, i.e. retransformed into its frame every timestep\n\
448 \n\
449 #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
450 geometry_msgs/Point[] points\n\
451 #Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
452 #number of colors must either be 0 or equal to the number of points\n\
453 #NOTE: alpha is not yet used\n\
454 std_msgs/ColorRGBA[] colors\n\
455 \n\
456 # NOTE: only used for text markers\n\
457 string text\n\
458 \n\
459 # NOTE: only used for MESH_RESOURCE markers\n\
460 string mesh_resource\n\
461 bool mesh_use_embedded_materials\n\
462 \n\
463 ================================================================================\n\
464 MSG: geometry_msgs/Vector3\n\
465 # This represents a vector in free space. \n\
466 # It is only meant to represent a direction. Therefore, it does not\n\
467 # make sense to apply a translation to it (e.g., when applying a \n\
468 # generic rigid transformation to a Vector3, tf2 will only apply the\n\
469 # rotation). If you want your data to be translatable too, use the\n\
470 # geometry_msgs/Point message instead.\n\
471 \n\
472 float64 x\n\
473 float64 y\n\
474 float64 z\n\
475 ================================================================================\n\
476 MSG: std_msgs/ColorRGBA\n\
477 float32 r\n\
478 float32 g\n\
479 float32 b\n\
480 float32 a\n\
481 ";
482 
483  yarp::os::Type getType() const override
484  {
486  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
487  typ.addProperty("message_definition", yarp::os::Value(typeText));
488  return typ;
489  }
490 };
491 
492 } // namespace visualization_msgs
493 } // namespace rosmsg
494 } // namespace yarp
495 
496 #endif // YARP_ROSMSG_visualization_msgs_InteractiveMarkerInit_h
#define BOTTLE_TAG_INT64
Definition: Bottle.h:22
#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 std::int64_t expectInt64()=0
Read a 64-bit integer from the network connection.
virtual bool isError() const =0
An interface for writing to a network connection.
virtual bool isError() const =0
virtual void appendInt64(std::int64_t data)=0
Send a representation of a 64-bit integer to the network connection.
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:45
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:23
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:30
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:382
std::int64_t expectInt64()
Definition: WireReader.h:99
bool writeBare(yarp::os::ConnectionWriter &connection) const override
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readBare(yarp::os::ConnectionReader &connection) override
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::os::idl::BareStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerInit > rosStyle
bool readBottle(yarp::os::ConnectionReader &connection) override
yarp::os::idl::BottleStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerInit > bottleStyle
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
std::vector< yarp::rosmsg::visualization_msgs::InteractiveMarker > markers
The main, catch-all namespace for YARP.
Definition: dirs.h:16