kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
ImageMarker.h
Go to the documentation of this file.
1 #ifndef _ROS_visualization_msgs_ImageMarker_h
2 #define _ROS_visualization_msgs_ImageMarker_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/Point.h"
10 #include "std_msgs/ColorRGBA.h"
11 #include "ros/duration.h"
12 
13 namespace visualization_msgs
14 {
15 
16  class ImageMarker : public ros::Msg
17  {
18  public:
20  const char* ns;
21  int32_t id;
22  int32_t type;
23  int32_t action;
25  float scale;
27  uint8_t filled;
30  uint8_t points_length;
36  enum { CIRCLE = 0 };
37  enum { LINE_STRIP = 1 };
38  enum { LINE_LIST = 2 };
39  enum { POLYGON = 3 };
40  enum { POINTS = 4 };
41  enum { ADD = 0 };
42  enum { REMOVE = 1 };
43 
45  header(),
46  ns(""),
47  id(0),
48  type(0),
49  action(0),
50  position(),
51  scale(0),
52  outline_color(),
53  filled(0),
54  fill_color(),
55  lifetime(),
56  points_length(0), points(NULL),
58  {
59  }
60 
61  virtual int serialize(unsigned char *outbuffer) const
62  {
63  int offset = 0;
64  offset += this->header.serialize(outbuffer + offset);
65  uint32_t length_ns = strlen(this->ns);
66  memcpy(outbuffer + offset, &length_ns, sizeof(uint32_t));
67  offset += 4;
68  memcpy(outbuffer + offset, this->ns, length_ns);
69  offset += length_ns;
70  union {
71  int32_t real;
72  uint32_t base;
73  } u_id;
74  u_id.real = this->id;
75  *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF;
76  *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF;
77  *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF;
78  *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF;
79  offset += sizeof(this->id);
80  union {
81  int32_t real;
82  uint32_t base;
83  } u_type;
84  u_type.real = this->type;
85  *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF;
86  *(outbuffer + offset + 1) = (u_type.base >> (8 * 1)) & 0xFF;
87  *(outbuffer + offset + 2) = (u_type.base >> (8 * 2)) & 0xFF;
88  *(outbuffer + offset + 3) = (u_type.base >> (8 * 3)) & 0xFF;
89  offset += sizeof(this->type);
90  union {
91  int32_t real;
92  uint32_t base;
93  } u_action;
94  u_action.real = this->action;
95  *(outbuffer + offset + 0) = (u_action.base >> (8 * 0)) & 0xFF;
96  *(outbuffer + offset + 1) = (u_action.base >> (8 * 1)) & 0xFF;
97  *(outbuffer + offset + 2) = (u_action.base >> (8 * 2)) & 0xFF;
98  *(outbuffer + offset + 3) = (u_action.base >> (8 * 3)) & 0xFF;
99  offset += sizeof(this->action);
100  offset += this->position.serialize(outbuffer + offset);
101  union {
102  float real;
103  uint32_t base;
104  } u_scale;
105  u_scale.real = this->scale;
106  *(outbuffer + offset + 0) = (u_scale.base >> (8 * 0)) & 0xFF;
107  *(outbuffer + offset + 1) = (u_scale.base >> (8 * 1)) & 0xFF;
108  *(outbuffer + offset + 2) = (u_scale.base >> (8 * 2)) & 0xFF;
109  *(outbuffer + offset + 3) = (u_scale.base >> (8 * 3)) & 0xFF;
110  offset += sizeof(this->scale);
111  offset += this->outline_color.serialize(outbuffer + offset);
112  *(outbuffer + offset + 0) = (this->filled >> (8 * 0)) & 0xFF;
113  offset += sizeof(this->filled);
114  offset += this->fill_color.serialize(outbuffer + offset);
115  *(outbuffer + offset + 0) = (this->lifetime.sec >> (8 * 0)) & 0xFF;
116  *(outbuffer + offset + 1) = (this->lifetime.sec >> (8 * 1)) & 0xFF;
117  *(outbuffer + offset + 2) = (this->lifetime.sec >> (8 * 2)) & 0xFF;
118  *(outbuffer + offset + 3) = (this->lifetime.sec >> (8 * 3)) & 0xFF;
119  offset += sizeof(this->lifetime.sec);
120  *(outbuffer + offset + 0) = (this->lifetime.nsec >> (8 * 0)) & 0xFF;
121  *(outbuffer + offset + 1) = (this->lifetime.nsec >> (8 * 1)) & 0xFF;
122  *(outbuffer + offset + 2) = (this->lifetime.nsec >> (8 * 2)) & 0xFF;
123  *(outbuffer + offset + 3) = (this->lifetime.nsec >> (8 * 3)) & 0xFF;
124  offset += sizeof(this->lifetime.nsec);
125  *(outbuffer + offset++) = points_length;
126  *(outbuffer + offset++) = 0;
127  *(outbuffer + offset++) = 0;
128  *(outbuffer + offset++) = 0;
129  for( uint8_t i = 0; i < points_length; i++){
130  offset += this->points[i].serialize(outbuffer + offset);
131  }
132  *(outbuffer + offset++) = outline_colors_length;
133  *(outbuffer + offset++) = 0;
134  *(outbuffer + offset++) = 0;
135  *(outbuffer + offset++) = 0;
136  for( uint8_t i = 0; i < outline_colors_length; i++){
137  offset += this->outline_colors[i].serialize(outbuffer + offset);
138  }
139  return offset;
140  }
141 
142  virtual int deserialize(unsigned char *inbuffer)
143  {
144  int offset = 0;
145  offset += this->header.deserialize(inbuffer + offset);
146  uint32_t length_ns;
147  memcpy(&length_ns, (inbuffer + offset), sizeof(uint32_t));
148  offset += 4;
149  for(unsigned int k= offset; k< offset+length_ns; ++k){
150  inbuffer[k-1]=inbuffer[k];
151  }
152  inbuffer[offset+length_ns-1]=0;
153  this->ns = (char *)(inbuffer + offset-1);
154  offset += length_ns;
155  union {
156  int32_t real;
157  uint32_t base;
158  } u_id;
159  u_id.base = 0;
160  u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
161  u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
162  u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
163  u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
164  this->id = u_id.real;
165  offset += sizeof(this->id);
166  union {
167  int32_t real;
168  uint32_t base;
169  } u_type;
170  u_type.base = 0;
171  u_type.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
172  u_type.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
173  u_type.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
174  u_type.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
175  this->type = u_type.real;
176  offset += sizeof(this->type);
177  union {
178  int32_t real;
179  uint32_t base;
180  } u_action;
181  u_action.base = 0;
182  u_action.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
183  u_action.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
184  u_action.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
185  u_action.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
186  this->action = u_action.real;
187  offset += sizeof(this->action);
188  offset += this->position.deserialize(inbuffer + offset);
189  union {
190  float real;
191  uint32_t base;
192  } u_scale;
193  u_scale.base = 0;
194  u_scale.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
195  u_scale.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
196  u_scale.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
197  u_scale.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
198  this->scale = u_scale.real;
199  offset += sizeof(this->scale);
200  offset += this->outline_color.deserialize(inbuffer + offset);
201  this->filled = ((uint8_t) (*(inbuffer + offset)));
202  offset += sizeof(this->filled);
203  offset += this->fill_color.deserialize(inbuffer + offset);
204  this->lifetime.sec = ((uint32_t) (*(inbuffer + offset)));
205  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
206  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
207  this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
208  offset += sizeof(this->lifetime.sec);
209  this->lifetime.nsec = ((uint32_t) (*(inbuffer + offset)));
210  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
211  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
212  this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
213  offset += sizeof(this->lifetime.nsec);
214  uint8_t points_lengthT = *(inbuffer + offset++);
215  if(points_lengthT > points_length)
216  this->points = (geometry_msgs::Point*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point));
217  offset += 3;
218  points_length = points_lengthT;
219  for( uint8_t i = 0; i < points_length; i++){
220  offset += this->st_points.deserialize(inbuffer + offset);
221  memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point));
222  }
223  uint8_t outline_colors_lengthT = *(inbuffer + offset++);
224  if(outline_colors_lengthT > outline_colors_length)
225  this->outline_colors = (std_msgs::ColorRGBA*)realloc(this->outline_colors, outline_colors_lengthT * sizeof(std_msgs::ColorRGBA));
226  offset += 3;
227  outline_colors_length = outline_colors_lengthT;
228  for( uint8_t i = 0; i < outline_colors_length; i++){
229  offset += this->st_outline_colors.deserialize(inbuffer + offset);
230  memcpy( &(this->outline_colors[i]), &(this->st_outline_colors), sizeof(std_msgs::ColorRGBA));
231  }
232  return offset;
233  }
234 
235  const char * getType(){ return "visualization_msgs/ImageMarker"; };
236  const char * getMD5(){ return "1de93c67ec8858b831025a08fbf1b35c"; };
237 
238  };
239 
240 }
241 #endif
virtual int deserialize(unsigned char *inbuffer)
Definition: Header.h:53
virtual int deserialize(unsigned char *inbuffer)
Definition: ImageMarker.h:142
uint8_t filled
Definition: ImageMarker.h:27
std_msgs::ColorRGBA st_outline_colors
Definition: ImageMarker.h:34
ImageMarker()
Definition: ImageMarker.h:44
geometry_msgs::Point st_points
Definition: ImageMarker.h:31
int32_t sec
Definition: duration.h:48
Definition: ImageMarker.h:39
uint8_t outline_colors_length
Definition: ImageMarker.h:33
float scale
Definition: ImageMarker.h:25
virtual int serialize(unsigned char *outbuffer) const
Definition: Header.h:27
Definition: ImageMarker.h:42
Definition: Point.h:12
int32_t type
Definition: ImageMarker.h:22
Definition: ImageMarker.h:40
Definition: ImageMarker.h:38
std_msgs::Header header
Definition: ImageMarker.h:19
virtual int deserialize(unsigned char *inbuffer)
Definition: ColorRGBA.h:74
int32_t action
Definition: ImageMarker.h:23
std_msgs::ColorRGBA outline_color
Definition: ImageMarker.h:26
uint8_t points_length
Definition: ImageMarker.h:30
Definition: Header.h:13
Definition: ImageMarker.h:41
geometry_msgs::Point * points
Definition: ImageMarker.h:32
std_msgs::ColorRGBA * outline_colors
Definition: ImageMarker.h:35
int32_t id
Definition: ImageMarker.h:21
virtual int serialize(unsigned char *outbuffer) const
Definition: ColorRGBA.h:28
virtual int serialize(unsigned char *outbuffer) const
Definition: Point.h:26
geometry_msgs::Point position
Definition: ImageMarker.h:24
Definition: ImageMarker.h:36
Definition: duration.h:45
const char * getType()
Definition: ImageMarker.h:235
const char * getMD5()
Definition: ImageMarker.h:236
int32_t nsec
Definition: duration.h:48
Definition: ColorRGBA.h:12
virtual int serialize(unsigned char *outbuffer) const
Definition: ImageMarker.h:61
Definition: ImageMarker.h:16
const char * ns
Definition: ImageMarker.h:20
virtual int deserialize(unsigned char *inbuffer)
Definition: Point.h:35
std_msgs::ColorRGBA fill_color
Definition: ImageMarker.h:28
Definition: msg.h:43
ros::Duration lifetime
Definition: ImageMarker.h:29