kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Marker.h
Go to the documentation of this file.
1 #ifndef _ROS_visualization_msgs_Marker_h
2 #define _ROS_visualization_msgs_Marker_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 #include "std_msgs/Header.h"
9 #include "geometry_msgs/Pose.h"
10 #include "geometry_msgs/Vector3.h"
11 #include "std_msgs/ColorRGBA.h"
12 #include "ros/duration.h"
13 #include "geometry_msgs/Point.h"
14 
15 namespace visualization_msgs
16 {
17 
18  class Marker : public ros::Msg
19  {
20  public:
22  const char* ns;
23  int32_t id;
24  int32_t type;
25  int32_t action;
31  uint8_t points_length;
34  uint8_t colors_length;
37  const char* text;
38  const char* mesh_resource;
40  enum { ARROW = 0 };
41  enum { CUBE = 1 };
42  enum { SPHERE = 2 };
43  enum { CYLINDER = 3 };
44  enum { LINE_STRIP = 4 };
45  enum { LINE_LIST = 5 };
46  enum { CUBE_LIST = 6 };
47  enum { SPHERE_LIST = 7 };
48  enum { POINTS = 8 };
49  enum { TEXT_VIEW_FACING = 9 };
50  enum { MESH_RESOURCE = 10 };
51  enum { TRIANGLE_LIST = 11 };
52  enum { ADD = 0 };
53  enum { MODIFY = 0 };
54  enum { DELETE = 2 };
55 
56  Marker():
57  header(),
58  ns(""),
59  id(0),
60  type(0),
61  action(0),
62  pose(),
63  scale(),
64  color(),
65  lifetime(),
66  frame_locked(0),
67  points_length(0), points(NULL),
68  colors_length(0), colors(NULL),
69  text(""),
70  mesh_resource(""),
72  {
73  }
74 
75  virtual int serialize(unsigned char *outbuffer) const
76  {
77  int offset = 0;
78  offset += this->header.serialize(outbuffer + offset);
79  uint32_t length_ns = strlen(this->ns);
80  memcpy(outbuffer + offset, &length_ns, sizeof(uint32_t));
81  offset += 4;
82  memcpy(outbuffer + offset, this->ns, length_ns);
83  offset += length_ns;
84  union {
85  int32_t real;
86  uint32_t base;
87  } u_id;
88  u_id.real = this->id;
89  *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF;
90  *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF;
91  *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF;
92  *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF;
93  offset += sizeof(this->id);
94  union {
95  int32_t real;
96  uint32_t base;
97  } u_type;
98  u_type.real = this->type;
99  *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF;
100  *(outbuffer + offset + 1) = (u_type.base >> (8 * 1)) & 0xFF;
101  *(outbuffer + offset + 2) = (u_type.base >> (8 * 2)) & 0xFF;
102  *(outbuffer + offset + 3) = (u_type.base >> (8 * 3)) & 0xFF;
103  offset += sizeof(this->type);
104  union {
105  int32_t real;
106  uint32_t base;
107  } u_action;
108  u_action.real = this->action;
109  *(outbuffer + offset + 0) = (u_action.base >> (8 * 0)) & 0xFF;
110  *(outbuffer + offset + 1) = (u_action.base >> (8 * 1)) & 0xFF;
111  *(outbuffer + offset + 2) = (u_action.base >> (8 * 2)) & 0xFF;
112  *(outbuffer + offset + 3) = (u_action.base >> (8 * 3)) & 0xFF;
113  offset += sizeof(this->action);
114  offset += this->pose.serialize(outbuffer + offset);
115  offset += this->scale.serialize(outbuffer + offset);
116  offset += this->color.serialize(outbuffer + offset);
117  *(outbuffer + offset + 0) = (this->lifetime.sec >> (8 * 0)) & 0xFF;
118  *(outbuffer + offset + 1) = (this->lifetime.sec >> (8 * 1)) & 0xFF;
119  *(outbuffer + offset + 2) = (this->lifetime.sec >> (8 * 2)) & 0xFF;
120  *(outbuffer + offset + 3) = (this->lifetime.sec >> (8 * 3)) & 0xFF;
121  offset += sizeof(this->lifetime.sec);
122  *(outbuffer + offset + 0) = (this->lifetime.nsec >> (8 * 0)) & 0xFF;
123  *(outbuffer + offset + 1) = (this->lifetime.nsec >> (8 * 1)) & 0xFF;
124  *(outbuffer + offset + 2) = (this->lifetime.nsec >> (8 * 2)) & 0xFF;
125  *(outbuffer + offset + 3) = (this->lifetime.nsec >> (8 * 3)) & 0xFF;
126  offset += sizeof(this->lifetime.nsec);
127  union {
128  bool real;
129  uint8_t base;
130  } u_frame_locked;
131  u_frame_locked.real = this->frame_locked;
132  *(outbuffer + offset + 0) = (u_frame_locked.base >> (8 * 0)) & 0xFF;
133  offset += sizeof(this->frame_locked);
134  *(outbuffer + offset++) = points_length;
135  *(outbuffer + offset++) = 0;
136  *(outbuffer + offset++) = 0;
137  *(outbuffer + offset++) = 0;
138  for( uint8_t i = 0; i < points_length; i++){
139  offset += this->points[i].serialize(outbuffer + offset);
140  }
141  *(outbuffer + offset++) = colors_length;
142  *(outbuffer + offset++) = 0;
143  *(outbuffer + offset++) = 0;
144  *(outbuffer + offset++) = 0;
145  for( uint8_t i = 0; i < colors_length; i++){
146  offset += this->colors[i].serialize(outbuffer + offset);
147  }
148  uint32_t length_text = strlen(this->text);
149  memcpy(outbuffer + offset, &length_text, sizeof(uint32_t));
150  offset += 4;
151  memcpy(outbuffer + offset, this->text, length_text);
152  offset += length_text;
153  uint32_t length_mesh_resource = strlen(this->mesh_resource);
154  memcpy(outbuffer + offset, &length_mesh_resource, sizeof(uint32_t));
155  offset += 4;
156  memcpy(outbuffer + offset, this->mesh_resource, length_mesh_resource);
157  offset += length_mesh_resource;
158  union {
159  bool real;
160  uint8_t base;
161  } u_mesh_use_embedded_materials;
162  u_mesh_use_embedded_materials.real = this->mesh_use_embedded_materials;
163  *(outbuffer + offset + 0) = (u_mesh_use_embedded_materials.base >> (8 * 0)) & 0xFF;
164  offset += sizeof(this->mesh_use_embedded_materials);
165  return offset;
166  }
167 
168  virtual int deserialize(unsigned char *inbuffer)
169  {
170  int offset = 0;
171  offset += this->header.deserialize(inbuffer + offset);
172  uint32_t length_ns;
173  memcpy(&length_ns, (inbuffer + offset), sizeof(uint32_t));
174  offset += 4;
175  for(unsigned int k= offset; k< offset+length_ns; ++k){
176  inbuffer[k-1]=inbuffer[k];
177  }
178  inbuffer[offset+length_ns-1]=0;
179  this->ns = (char *)(inbuffer + offset-1);
180  offset += length_ns;
181  union {
182  int32_t real;
183  uint32_t base;
184  } u_id;
185  u_id.base = 0;
186  u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
187  u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
188  u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
189  u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
190  this->id = u_id.real;
191  offset += sizeof(this->id);
192  union {
193  int32_t real;
194  uint32_t base;
195  } u_type;
196  u_type.base = 0;
197  u_type.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
198  u_type.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
199  u_type.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
200  u_type.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
201  this->type = u_type.real;
202  offset += sizeof(this->type);
203  union {
204  int32_t real;
205  uint32_t base;
206  } u_action;
207  u_action.base = 0;
208  u_action.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
209  u_action.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
210  u_action.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
211  u_action.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
212  this->action = u_action.real;
213  offset += sizeof(this->action);
214  offset += this->pose.deserialize(inbuffer + offset);
215  offset += this->scale.deserialize(inbuffer + offset);
216  offset += this->color.deserialize(inbuffer + offset);
217  this->lifetime.sec = ((uint32_t) (*(inbuffer + offset)));
218  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
219  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
220  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
221  offset += sizeof(this->lifetime.sec);
222  this->lifetime.nsec = ((uint32_t) (*(inbuffer + offset)));
223  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
224  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
225  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
226  offset += sizeof(this->lifetime.nsec);
227  union {
228  bool real;
229  uint8_t base;
230  } u_frame_locked;
231  u_frame_locked.base = 0;
232  u_frame_locked.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
233  this->frame_locked = u_frame_locked.real;
234  offset += sizeof(this->frame_locked);
235  uint8_t points_lengthT = *(inbuffer + offset++);
236  if(points_lengthT > points_length)
237  this->points = (geometry_msgs::Point*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point));
238  offset += 3;
239  points_length = points_lengthT;
240  for( uint8_t i = 0; i < points_length; i++){
241  offset += this->st_points.deserialize(inbuffer + offset);
242  memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point));
243  }
244  uint8_t colors_lengthT = *(inbuffer + offset++);
245  if(colors_lengthT > colors_length)
246  this->colors = (std_msgs::ColorRGBA*)realloc(this->colors, colors_lengthT * sizeof(std_msgs::ColorRGBA));
247  offset += 3;
248  colors_length = colors_lengthT;
249  for( uint8_t i = 0; i < colors_length; i++){
250  offset += this->st_colors.deserialize(inbuffer + offset);
251  memcpy( &(this->colors[i]), &(this->st_colors), sizeof(std_msgs::ColorRGBA));
252  }
253  uint32_t length_text;
254  memcpy(&length_text, (inbuffer + offset), sizeof(uint32_t));
255  offset += 4;
256  for(unsigned int k= offset; k< offset+length_text; ++k){
257  inbuffer[k-1]=inbuffer[k];
258  }
259  inbuffer[offset+length_text-1]=0;
260  this->text = (char *)(inbuffer + offset-1);
261  offset += length_text;
262  uint32_t length_mesh_resource;
263  memcpy(&length_mesh_resource, (inbuffer + offset), sizeof(uint32_t));
264  offset += 4;
265  for(unsigned int k= offset; k< offset+length_mesh_resource; ++k){
266  inbuffer[k-1]=inbuffer[k];
267  }
268  inbuffer[offset+length_mesh_resource-1]=0;
269  this->mesh_resource = (char *)(inbuffer + offset-1);
270  offset += length_mesh_resource;
271  union {
272  bool real;
273  uint8_t base;
274  } u_mesh_use_embedded_materials;
275  u_mesh_use_embedded_materials.base = 0;
276  u_mesh_use_embedded_materials.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
277  this->mesh_use_embedded_materials = u_mesh_use_embedded_materials.real;
278  offset += sizeof(this->mesh_use_embedded_materials);
279  return offset;
280  }
281 
282  const char * getType(){ return "visualization_msgs/Marker"; };
283  const char * getMD5(){ return "18326976df9d29249efc939e00342cde"; };
284 
285  };
286 
287 }
288 #endif
virtual int deserialize(unsigned char *inbuffer)
Definition: Marker.h:168
virtual int deserialize(unsigned char *inbuffer)
Definition: Header.h:53
Definition: Marker.h:18
std_msgs::ColorRGBA st_colors
Definition: Marker.h:35
Definition: Marker.h:53
Definition: Marker.h:42
const char * mesh_resource
Definition: Marker.h:38
int32_t type
Definition: Marker.h:24
virtual int deserialize(unsigned char *inbuffer)
Definition: Vector3.h:35
int32_t sec
Definition: duration.h:48
ros::Duration lifetime
Definition: Marker.h:29
Definition: Marker.h:48
Definition: Marker.h:40
Definition: Vector3.h:12
const char * getType()
Definition: Marker.h:282
geometry_msgs::Vector3 scale
Definition: Marker.h:27
std_msgs::ColorRGBA * colors
Definition: Marker.h:36
virtual int serialize(unsigned char *outbuffer) const
Definition: Header.h:27
const char * ns
Definition: Marker.h:22
Definition: Marker.h:54
Definition: Point.h:12
virtual int deserialize(unsigned char *inbuffer)
Definition: ColorRGBA.h:74
virtual int serialize(unsigned char *outbuffer) const
Definition: Pose.h:26
virtual int deserialize(unsigned char *inbuffer)
Definition: Pose.h:34
Definition: Marker.h:41
geometry_msgs::Point st_points
Definition: Marker.h:32
geometry_msgs::Point * points
Definition: Marker.h:33
Definition: Header.h:13
bool mesh_use_embedded_materials
Definition: Marker.h:39
Definition: Marker.h:52
const char * text
Definition: Marker.h:37
std_msgs::Header header
Definition: Marker.h:21
virtual int serialize(unsigned char *outbuffer) const
Definition: Marker.h:75
uint8_t colors_length
Definition: Marker.h:34
virtual int serialize(unsigned char *outbuffer) const
Definition: ColorRGBA.h:28
int32_t id
Definition: Marker.h:23
const char * getMD5()
Definition: Marker.h:283
virtual int serialize(unsigned char *outbuffer) const
Definition: Point.h:26
Definition: Pose.h:14
int32_t action
Definition: Marker.h:25
bool frame_locked
Definition: Marker.h:30
Definition: duration.h:45
Marker()
Definition: Marker.h:56
int32_t nsec
Definition: duration.h:48
Definition: ColorRGBA.h:12
std_msgs::ColorRGBA color
Definition: Marker.h:28
geometry_msgs::Pose pose
Definition: Marker.h:26
virtual int deserialize(unsigned char *inbuffer)
Definition: Point.h:35
Definition: msg.h:43
uint8_t points_length
Definition: Marker.h:31
virtual int serialize(unsigned char *outbuffer) const
Definition: Vector3.h:26