YARP
Yet Another Robot Platform
InteractiveMarkerControl.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/InteractiveMarkerControl" msg definition:
9// # Represents a control that is to be displayed together with an interactive marker
10//
11// # Identifying string for this control.
12// # You need to assign a unique value to this to receive feedback from the GUI
13// # on what actions the user performs on this control (e.g. a button click).
14// string name
15//
16//
17// # Defines the local coordinate frame (relative to the pose of the parent
18// # interactive marker) in which is being rotated and translated.
19// # Default: Identity
20// geometry_msgs/Quaternion orientation
21//
22//
23// # Orientation mode: controls how orientation changes.
24// # INHERIT: Follow orientation of interactive marker
25// # FIXED: Keep orientation fixed at initial state
26// # VIEW_FACING: Align y-z plane with screen (x: forward, y:left, z:up).
27// uint8 INHERIT = 0
28// uint8 FIXED = 1
29// uint8 VIEW_FACING = 2
30//
31// uint8 orientation_mode
32//
33// # Interaction mode for this control
34// #
35// # NONE: This control is only meant for visualization; no context menu.
36// # MENU: Like NONE, but right-click menu is active.
37// # BUTTON: Element can be left-clicked.
38// # MOVE_AXIS: Translate along local x-axis.
39// # MOVE_PLANE: Translate in local y-z plane.
40// # ROTATE_AXIS: Rotate around local x-axis.
41// # MOVE_ROTATE: Combines MOVE_PLANE and ROTATE_AXIS.
42// uint8 NONE = 0
43// uint8 MENU = 1
44// uint8 BUTTON = 2
45// uint8 MOVE_AXIS = 3
46// uint8 MOVE_PLANE = 4
47// uint8 ROTATE_AXIS = 5
48// uint8 MOVE_ROTATE = 6
49// # "3D" interaction modes work with the mouse+SHIFT+CTRL or with 3D cursors.
50// # MOVE_3D: Translate freely in 3D space.
51// # ROTATE_3D: Rotate freely in 3D space about the origin of parent frame.
52// # MOVE_ROTATE_3D: Full 6-DOF freedom of translation and rotation about the cursor origin.
53// uint8 MOVE_3D = 7
54// uint8 ROTATE_3D = 8
55// uint8 MOVE_ROTATE_3D = 9
56//
57// uint8 interaction_mode
58//
59//
60// # If true, the contained markers will also be visible
61// # when the gui is not in interactive mode.
62// bool always_visible
63//
64//
65// # Markers to be displayed as custom visual representation.
66// # Leave this empty to use the default control handles.
67// #
68// # Note:
69// # - The markers can be defined in an arbitrary coordinate frame,
70// # but will be transformed into the local frame of the interactive marker.
71// # - If the header of a marker is empty, its pose will be interpreted as
72// # relative to the pose of the parent interactive marker.
73// Marker[] markers
74//
75//
76// # In VIEW_FACING mode, set this to true if you don't want the markers
77// # to be aligned with the camera view point. The markers will show up
78// # as in INHERIT mode.
79// bool independent_marker_orientation
80//
81//
82// # Short description (< 40 characters) of what this control does,
83// # e.g. "Move the robot".
84// # Default: A generic description based on the interaction mode
85// string description
86// Instances of this class can be read and written with YARP ports,
87// using a ROS-compatible format.
88
89#ifndef YARP_ROSMSG_visualization_msgs_InteractiveMarkerControl_h
90#define YARP_ROSMSG_visualization_msgs_InteractiveMarkerControl_h
91
92#include <yarp/os/Wire.h>
93#include <yarp/os/Type.h>
95#include <string>
96#include <vector>
99
100namespace yarp {
101namespace rosmsg {
102namespace visualization_msgs {
103
105{
106public:
107 std::string name;
109 static const std::uint8_t INHERIT = 0;
110 static const std::uint8_t FIXED = 1;
111 static const std::uint8_t VIEW_FACING = 2;
112 std::uint8_t orientation_mode;
113 static const std::uint8_t NONE = 0;
114 static const std::uint8_t MENU = 1;
115 static const std::uint8_t BUTTON = 2;
116 static const std::uint8_t MOVE_AXIS = 3;
117 static const std::uint8_t MOVE_PLANE = 4;
118 static const std::uint8_t ROTATE_AXIS = 5;
119 static const std::uint8_t MOVE_ROTATE = 6;
120 static const std::uint8_t MOVE_3D = 7;
121 static const std::uint8_t ROTATE_3D = 8;
122 static const std::uint8_t MOVE_ROTATE_3D = 9;
123 std::uint8_t interaction_mode;
125 std::vector<yarp::rosmsg::visualization_msgs::Marker> markers;
127 std::string description;
128
130 name(""),
131 orientation(),
134 always_visible(false),
135 markers(),
137 description("")
138 {
139 }
140
141 void clear()
142 {
143 // *** name ***
144 name = "";
145
146 // *** orientation ***
148
149 // *** INHERIT ***
150
151 // *** FIXED ***
152
153 // *** VIEW_FACING ***
154
155 // *** orientation_mode ***
157
158 // *** NONE ***
159
160 // *** MENU ***
161
162 // *** BUTTON ***
163
164 // *** MOVE_AXIS ***
165
166 // *** MOVE_PLANE ***
167
168 // *** ROTATE_AXIS ***
169
170 // *** MOVE_ROTATE ***
171
172 // *** MOVE_3D ***
173
174 // *** ROTATE_3D ***
175
176 // *** MOVE_ROTATE_3D ***
177
178 // *** interaction_mode ***
180
181 // *** always_visible ***
182 always_visible = false;
183
184 // *** markers ***
185 markers.clear();
186
187 // *** independent_marker_orientation ***
189
190 // *** description ***
191 description = "";
192 }
193
194 bool readBare(yarp::os::ConnectionReader& connection) override
195 {
196 // *** name ***
197 int len = connection.expectInt32();
198 name.resize(len);
199 if (!connection.expectBlock((char*)name.c_str(), len)) {
200 return false;
201 }
202
203 // *** orientation ***
204 if (!orientation.read(connection)) {
205 return false;
206 }
207
208 // *** orientation_mode ***
209 orientation_mode = connection.expectInt8();
210
211 // *** interaction_mode ***
212 interaction_mode = connection.expectInt8();
213
214 // *** always_visible ***
215 if (!connection.expectBlock((char*)&always_visible, 1)) {
216 return false;
217 }
218
219 // *** markers ***
220 len = connection.expectInt32();
221 markers.resize(len);
222 for (int i=0; i<len; i++) {
223 if (!markers[i].read(connection)) {
224 return false;
225 }
226 }
227
228 // *** independent_marker_orientation ***
229 if (!connection.expectBlock((char*)&independent_marker_orientation, 1)) {
230 return false;
231 }
232
233 // *** description ***
234 len = connection.expectInt32();
235 description.resize(len);
236 if (!connection.expectBlock((char*)description.c_str(), len)) {
237 return false;
238 }
239
240 return !connection.isError();
241 }
242
243 bool readBottle(yarp::os::ConnectionReader& connection) override
244 {
245 connection.convertTextMode();
246 yarp::os::idl::WireReader reader(connection);
247 if (!reader.readListHeader(21)) {
248 return false;
249 }
250
251 // *** name ***
252 if (!reader.readString(name)) {
253 return false;
254 }
255
256 // *** orientation ***
257 if (!orientation.read(connection)) {
258 return false;
259 }
260
261 // *** orientation_mode ***
262 orientation_mode = reader.expectInt8();
263
264 // *** interaction_mode ***
265 interaction_mode = reader.expectInt8();
266
267 // *** always_visible ***
268 always_visible = reader.expectInt8();
269
270 // *** markers ***
271 if (connection.expectInt32() != BOTTLE_TAG_LIST) {
272 return false;
273 }
274 int len = connection.expectInt32();
275 markers.resize(len);
276 for (int i=0; i<len; i++) {
277 if (!markers[i].read(connection)) {
278 return false;
279 }
280 }
281
282 // *** independent_marker_orientation ***
284
285 // *** description ***
286 if (!reader.readString(description)) {
287 return false;
288 }
289
290 return !connection.isError();
291 }
292
294 bool read(yarp::os::ConnectionReader& connection) override
295 {
296 return (connection.isBareMode() ? readBare(connection)
297 : readBottle(connection));
298 }
299
300 bool writeBare(yarp::os::ConnectionWriter& connection) const override
301 {
302 // *** name ***
303 connection.appendInt32(name.length());
304 connection.appendExternalBlock((char*)name.c_str(), name.length());
305
306 // *** orientation ***
307 if (!orientation.write(connection)) {
308 return false;
309 }
310
311 // *** orientation_mode ***
312 connection.appendInt8(orientation_mode);
313
314 // *** interaction_mode ***
315 connection.appendInt8(interaction_mode);
316
317 // *** always_visible ***
318 connection.appendBlock((char*)&always_visible, 1);
319
320 // *** markers ***
321 connection.appendInt32(markers.size());
322 for (size_t i=0; i<markers.size(); i++) {
323 if (!markers[i].write(connection)) {
324 return false;
325 }
326 }
327
328 // *** independent_marker_orientation ***
329 connection.appendBlock((char*)&independent_marker_orientation, 1);
330
331 // *** description ***
332 connection.appendInt32(description.length());
333 connection.appendExternalBlock((char*)description.c_str(), description.length());
334
335 return !connection.isError();
336 }
337
338 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
339 {
340 connection.appendInt32(BOTTLE_TAG_LIST);
341 connection.appendInt32(21);
342
343 // *** name ***
344 connection.appendInt32(BOTTLE_TAG_STRING);
345 connection.appendInt32(name.length());
346 connection.appendExternalBlock((char*)name.c_str(), name.length());
347
348 // *** orientation ***
349 if (!orientation.write(connection)) {
350 return false;
351 }
352
353 // *** orientation_mode ***
354 connection.appendInt32(BOTTLE_TAG_INT8);
355 connection.appendInt8(orientation_mode);
356
357 // *** interaction_mode ***
358 connection.appendInt32(BOTTLE_TAG_INT8);
359 connection.appendInt8(interaction_mode);
360
361 // *** always_visible ***
362 connection.appendInt32(BOTTLE_TAG_INT8);
363 connection.appendInt8(always_visible);
364
365 // *** markers ***
366 connection.appendInt32(BOTTLE_TAG_LIST);
367 connection.appendInt32(markers.size());
368 for (size_t i=0; i<markers.size(); i++) {
369 if (!markers[i].write(connection)) {
370 return false;
371 }
372 }
373
374 // *** independent_marker_orientation ***
375 connection.appendInt32(BOTTLE_TAG_INT8);
377
378 // *** description ***
379 connection.appendInt32(BOTTLE_TAG_STRING);
380 connection.appendInt32(description.length());
381 connection.appendExternalBlock((char*)description.c_str(), description.length());
382
383 connection.convertTextMode();
384 return !connection.isError();
385 }
386
388 bool write(yarp::os::ConnectionWriter& connection) const override
389 {
390 return (connection.isBareMode() ? writeBare(connection)
391 : writeBottle(connection));
392 }
393
394 // This class will serialize ROS style or YARP style depending on protocol.
395 // If you need to force a serialization style, use one of these classes:
398
399 // The name for this message, ROS will need this
400 static constexpr const char* typeName = "visualization_msgs/InteractiveMarkerControl";
401
402 // The checksum for this message, ROS will need this
403 static constexpr const char* typeChecksum = "b3c81e785788195d1840b86c28da1aac";
404
405 // The source text for this message, ROS will need this
406 static constexpr const char* typeText = "\
407# Represents a control that is to be displayed together with an interactive marker\n\
408\n\
409# Identifying string for this control.\n\
410# You need to assign a unique value to this to receive feedback from the GUI\n\
411# on what actions the user performs on this control (e.g. a button click).\n\
412string name\n\
413\n\
414\n\
415# Defines the local coordinate frame (relative to the pose of the parent\n\
416# interactive marker) in which is being rotated and translated.\n\
417# Default: Identity\n\
418geometry_msgs/Quaternion orientation\n\
419\n\
420\n\
421# Orientation mode: controls how orientation changes.\n\
422# INHERIT: Follow orientation of interactive marker\n\
423# FIXED: Keep orientation fixed at initial state\n\
424# VIEW_FACING: Align y-z plane with screen (x: forward, y:left, z:up).\n\
425uint8 INHERIT = 0 \n\
426uint8 FIXED = 1\n\
427uint8 VIEW_FACING = 2\n\
428\n\
429uint8 orientation_mode\n\
430\n\
431# Interaction mode for this control\n\
432# \n\
433# NONE: This control is only meant for visualization; no context menu.\n\
434# MENU: Like NONE, but right-click menu is active.\n\
435# BUTTON: Element can be left-clicked.\n\
436# MOVE_AXIS: Translate along local x-axis.\n\
437# MOVE_PLANE: Translate in local y-z plane.\n\
438# ROTATE_AXIS: Rotate around local x-axis.\n\
439# MOVE_ROTATE: Combines MOVE_PLANE and ROTATE_AXIS.\n\
440uint8 NONE = 0 \n\
441uint8 MENU = 1\n\
442uint8 BUTTON = 2\n\
443uint8 MOVE_AXIS = 3 \n\
444uint8 MOVE_PLANE = 4\n\
445uint8 ROTATE_AXIS = 5\n\
446uint8 MOVE_ROTATE = 6\n\
447# \"3D\" interaction modes work with the mouse+SHIFT+CTRL or with 3D cursors.\n\
448# MOVE_3D: Translate freely in 3D space.\n\
449# ROTATE_3D: Rotate freely in 3D space about the origin of parent frame.\n\
450# MOVE_ROTATE_3D: Full 6-DOF freedom of translation and rotation about the cursor origin.\n\
451uint8 MOVE_3D = 7\n\
452uint8 ROTATE_3D = 8\n\
453uint8 MOVE_ROTATE_3D = 9\n\
454\n\
455uint8 interaction_mode\n\
456\n\
457\n\
458# If true, the contained markers will also be visible\n\
459# when the gui is not in interactive mode.\n\
460bool always_visible\n\
461\n\
462\n\
463# Markers to be displayed as custom visual representation.\n\
464# Leave this empty to use the default control handles.\n\
465#\n\
466# Note: \n\
467# - The markers can be defined in an arbitrary coordinate frame,\n\
468# but will be transformed into the local frame of the interactive marker.\n\
469# - If the header of a marker is empty, its pose will be interpreted as \n\
470# relative to the pose of the parent interactive marker.\n\
471Marker[] markers\n\
472\n\
473\n\
474# In VIEW_FACING mode, set this to true if you don't want the markers\n\
475# to be aligned with the camera view point. The markers will show up\n\
476# as in INHERIT mode.\n\
477bool independent_marker_orientation\n\
478\n\
479\n\
480# Short description (< 40 characters) of what this control does,\n\
481# e.g. \"Move the robot\". \n\
482# Default: A generic description based on the interaction mode\n\
483string description\n\
484\n\
485================================================================================\n\
486MSG: geometry_msgs/Quaternion\n\
487# This represents an orientation in free space in quaternion form.\n\
488\n\
489float64 x\n\
490float64 y\n\
491float64 z\n\
492float64 w\n\
493\n\
494================================================================================\n\
495MSG: visualization_msgs/Marker\n\
496# 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\
497\n\
498uint8 ARROW=0\n\
499uint8 CUBE=1\n\
500uint8 SPHERE=2\n\
501uint8 CYLINDER=3\n\
502uint8 LINE_STRIP=4\n\
503uint8 LINE_LIST=5\n\
504uint8 CUBE_LIST=6\n\
505uint8 SPHERE_LIST=7\n\
506uint8 POINTS=8\n\
507uint8 TEXT_VIEW_FACING=9\n\
508uint8 MESH_RESOURCE=10\n\
509uint8 TRIANGLE_LIST=11\n\
510\n\
511uint8 ADD=0\n\
512uint8 MODIFY=0\n\
513uint8 DELETE=2\n\
514uint8 DELETEALL=3\n\
515\n\
516Header header # header for time/frame information\n\
517string ns # Namespace to place this object in... used in conjunction with id to create a unique name for the object\n\
518int32 id # object ID useful in conjunction with the namespace for manipulating and deleting the object later\n\
519int32 type # Type of object\n\
520int32 action # 0 add/modify an object, 1 (deprecated), 2 deletes an object, 3 deletes all objects\n\
521geometry_msgs/Pose pose # Pose of the object\n\
522geometry_msgs/Vector3 scale # Scale of the object 1,1,1 means default (usually 1 meter square)\n\
523std_msgs/ColorRGBA color # Color [0.0-1.0]\n\
524duration lifetime # How long the object should last before being automatically deleted. 0 means forever\n\
525bool frame_locked # If this marker should be frame-locked, i.e. retransformed into its frame every timestep\n\
526\n\
527#Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
528geometry_msgs/Point[] points\n\
529#Only used if the type specified has some use for them (eg. POINTS, LINE_STRIP, ...)\n\
530#number of colors must either be 0 or equal to the number of points\n\
531#NOTE: alpha is not yet used\n\
532std_msgs/ColorRGBA[] colors\n\
533\n\
534# NOTE: only used for text markers\n\
535string text\n\
536\n\
537# NOTE: only used for MESH_RESOURCE markers\n\
538string mesh_resource\n\
539bool mesh_use_embedded_materials\n\
540\n\
541================================================================================\n\
542MSG: std_msgs/Header\n\
543# Standard metadata for higher-level stamped data types.\n\
544# This is generally used to communicate timestamped data \n\
545# in a particular coordinate frame.\n\
546# \n\
547# sequence ID: consecutively increasing ID \n\
548uint32 seq\n\
549#Two-integer timestamp that is expressed as:\n\
550# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
551# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
552# time-handling sugar is provided by the client library\n\
553time stamp\n\
554#Frame this data is associated with\n\
555# 0: no frame\n\
556# 1: global frame\n\
557string frame_id\n\
558\n\
559================================================================================\n\
560MSG: geometry_msgs/Pose\n\
561# A representation of pose in free space, composed of position and orientation. \n\
562Point position\n\
563Quaternion orientation\n\
564\n\
565================================================================================\n\
566MSG: geometry_msgs/Point\n\
567# This contains the position of a point in free space\n\
568float64 x\n\
569float64 y\n\
570float64 z\n\
571\n\
572================================================================================\n\
573MSG: geometry_msgs/Vector3\n\
574# This represents a vector in free space. \n\
575# It is only meant to represent a direction. Therefore, it does not\n\
576# make sense to apply a translation to it (e.g., when applying a \n\
577# generic rigid transformation to a Vector3, tf2 will only apply the\n\
578# rotation). If you want your data to be translatable too, use the\n\
579# geometry_msgs/Point message instead.\n\
580\n\
581float64 x\n\
582float64 y\n\
583float64 z\n\
584================================================================================\n\
585MSG: std_msgs/ColorRGBA\n\
586float32 r\n\
587float32 g\n\
588float32 b\n\
589float32 a\n\
590";
591
592 yarp::os::Type getType() const override
593 {
596 typ.addProperty("message_definition", yarp::os::Value(typeText));
597 return typ;
598 }
599};
600
601} // namespace visualization_msgs
602} // namespace rosmsg
603} // namespace yarp
604
605#endif // YARP_ROSMSG_visualization_msgs_InteractiveMarkerControl_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.
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data 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 write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Quaternion.h:152
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Quaternion.h:103
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
yarp::os::idl::BottleStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerControl > bottleStyle
yarp::os::idl::BareStyle< yarp::rosmsg::visualization_msgs::InteractiveMarkerControl > rosStyle
bool readBottle(yarp::os::ConnectionReader &connection) override
bool readBare(yarp::os::ConnectionReader &connection) override
std::vector< yarp::rosmsg::visualization_msgs::Marker > markers
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeBare(yarp::os::ConnectionWriter &connection) const override
The main, catch-all namespace for YARP.
Definition: dirs.h:16