hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_visualization_msgs_InteractiveMarker_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_visualization_msgs_InteractiveMarker_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "std_msgs/Header.h"
garyservin 0:9e9b7db60fd5 9 #include "geometry_msgs/Pose.h"
garyservin 0:9e9b7db60fd5 10 #include "visualization_msgs/MenuEntry.h"
garyservin 0:9e9b7db60fd5 11 #include "visualization_msgs/InteractiveMarkerControl.h"
garyservin 0:9e9b7db60fd5 12
garyservin 0:9e9b7db60fd5 13 namespace visualization_msgs
garyservin 0:9e9b7db60fd5 14 {
garyservin 0:9e9b7db60fd5 15
garyservin 0:9e9b7db60fd5 16 class InteractiveMarker : public ros::Msg
garyservin 0:9e9b7db60fd5 17 {
garyservin 0:9e9b7db60fd5 18 public:
garyservin 0:9e9b7db60fd5 19 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 20 _header_type header;
garyservin 0:9e9b7db60fd5 21 typedef geometry_msgs::Pose _pose_type;
garyservin 0:9e9b7db60fd5 22 _pose_type pose;
garyservin 0:9e9b7db60fd5 23 typedef const char* _name_type;
garyservin 0:9e9b7db60fd5 24 _name_type name;
garyservin 0:9e9b7db60fd5 25 typedef const char* _description_type;
garyservin 0:9e9b7db60fd5 26 _description_type description;
garyservin 0:9e9b7db60fd5 27 typedef float _scale_type;
garyservin 0:9e9b7db60fd5 28 _scale_type scale;
garyservin 0:9e9b7db60fd5 29 uint32_t menu_entries_length;
garyservin 0:9e9b7db60fd5 30 typedef visualization_msgs::MenuEntry _menu_entries_type;
garyservin 0:9e9b7db60fd5 31 _menu_entries_type st_menu_entries;
garyservin 0:9e9b7db60fd5 32 _menu_entries_type * menu_entries;
garyservin 0:9e9b7db60fd5 33 uint32_t controls_length;
garyservin 0:9e9b7db60fd5 34 typedef visualization_msgs::InteractiveMarkerControl _controls_type;
garyservin 0:9e9b7db60fd5 35 _controls_type st_controls;
garyservin 0:9e9b7db60fd5 36 _controls_type * controls;
garyservin 0:9e9b7db60fd5 37
garyservin 0:9e9b7db60fd5 38 InteractiveMarker():
garyservin 0:9e9b7db60fd5 39 header(),
garyservin 0:9e9b7db60fd5 40 pose(),
garyservin 0:9e9b7db60fd5 41 name(""),
garyservin 0:9e9b7db60fd5 42 description(""),
garyservin 0:9e9b7db60fd5 43 scale(0),
garyservin 0:9e9b7db60fd5 44 menu_entries_length(0), menu_entries(NULL),
garyservin 0:9e9b7db60fd5 45 controls_length(0), controls(NULL)
garyservin 0:9e9b7db60fd5 46 {
garyservin 0:9e9b7db60fd5 47 }
garyservin 0:9e9b7db60fd5 48
garyservin 0:9e9b7db60fd5 49 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 50 {
garyservin 0:9e9b7db60fd5 51 int offset = 0;
garyservin 0:9e9b7db60fd5 52 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 53 offset += this->pose.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 54 uint32_t length_name = strlen(this->name);
garyservin 0:9e9b7db60fd5 55 varToArr(outbuffer + offset, length_name);
garyservin 0:9e9b7db60fd5 56 offset += 4;
garyservin 0:9e9b7db60fd5 57 memcpy(outbuffer + offset, this->name, length_name);
garyservin 0:9e9b7db60fd5 58 offset += length_name;
garyservin 0:9e9b7db60fd5 59 uint32_t length_description = strlen(this->description);
garyservin 0:9e9b7db60fd5 60 varToArr(outbuffer + offset, length_description);
garyservin 0:9e9b7db60fd5 61 offset += 4;
garyservin 0:9e9b7db60fd5 62 memcpy(outbuffer + offset, this->description, length_description);
garyservin 0:9e9b7db60fd5 63 offset += length_description;
garyservin 0:9e9b7db60fd5 64 union {
garyservin 0:9e9b7db60fd5 65 float real;
garyservin 0:9e9b7db60fd5 66 uint32_t base;
garyservin 0:9e9b7db60fd5 67 } u_scale;
garyservin 0:9e9b7db60fd5 68 u_scale.real = this->scale;
garyservin 0:9e9b7db60fd5 69 *(outbuffer + offset + 0) = (u_scale.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 70 *(outbuffer + offset + 1) = (u_scale.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 71 *(outbuffer + offset + 2) = (u_scale.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 72 *(outbuffer + offset + 3) = (u_scale.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 73 offset += sizeof(this->scale);
garyservin 0:9e9b7db60fd5 74 *(outbuffer + offset + 0) = (this->menu_entries_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 75 *(outbuffer + offset + 1) = (this->menu_entries_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 76 *(outbuffer + offset + 2) = (this->menu_entries_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 77 *(outbuffer + offset + 3) = (this->menu_entries_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 78 offset += sizeof(this->menu_entries_length);
garyservin 0:9e9b7db60fd5 79 for( uint32_t i = 0; i < menu_entries_length; i++){
garyservin 0:9e9b7db60fd5 80 offset += this->menu_entries[i].serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 81 }
garyservin 0:9e9b7db60fd5 82 *(outbuffer + offset + 0) = (this->controls_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 83 *(outbuffer + offset + 1) = (this->controls_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 84 *(outbuffer + offset + 2) = (this->controls_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 85 *(outbuffer + offset + 3) = (this->controls_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 86 offset += sizeof(this->controls_length);
garyservin 0:9e9b7db60fd5 87 for( uint32_t i = 0; i < controls_length; i++){
garyservin 0:9e9b7db60fd5 88 offset += this->controls[i].serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 89 }
garyservin 0:9e9b7db60fd5 90 return offset;
garyservin 0:9e9b7db60fd5 91 }
garyservin 0:9e9b7db60fd5 92
garyservin 0:9e9b7db60fd5 93 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 94 {
garyservin 0:9e9b7db60fd5 95 int offset = 0;
garyservin 0:9e9b7db60fd5 96 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 97 offset += this->pose.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 98 uint32_t length_name;
garyservin 0:9e9b7db60fd5 99 arrToVar(length_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 100 offset += 4;
garyservin 0:9e9b7db60fd5 101 for(unsigned int k= offset; k< offset+length_name; ++k){
garyservin 0:9e9b7db60fd5 102 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 103 }
garyservin 0:9e9b7db60fd5 104 inbuffer[offset+length_name-1]=0;
garyservin 0:9e9b7db60fd5 105 this->name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 106 offset += length_name;
garyservin 0:9e9b7db60fd5 107 uint32_t length_description;
garyservin 0:9e9b7db60fd5 108 arrToVar(length_description, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 109 offset += 4;
garyservin 0:9e9b7db60fd5 110 for(unsigned int k= offset; k< offset+length_description; ++k){
garyservin 0:9e9b7db60fd5 111 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 112 }
garyservin 0:9e9b7db60fd5 113 inbuffer[offset+length_description-1]=0;
garyservin 0:9e9b7db60fd5 114 this->description = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 115 offset += length_description;
garyservin 0:9e9b7db60fd5 116 union {
garyservin 0:9e9b7db60fd5 117 float real;
garyservin 0:9e9b7db60fd5 118 uint32_t base;
garyservin 0:9e9b7db60fd5 119 } u_scale;
garyservin 0:9e9b7db60fd5 120 u_scale.base = 0;
garyservin 0:9e9b7db60fd5 121 u_scale.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 122 u_scale.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 123 u_scale.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 124 u_scale.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 125 this->scale = u_scale.real;
garyservin 0:9e9b7db60fd5 126 offset += sizeof(this->scale);
garyservin 0:9e9b7db60fd5 127 uint32_t menu_entries_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 128 menu_entries_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 129 menu_entries_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 130 menu_entries_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 131 offset += sizeof(this->menu_entries_length);
garyservin 0:9e9b7db60fd5 132 if(menu_entries_lengthT > menu_entries_length)
garyservin 0:9e9b7db60fd5 133 this->menu_entries = (visualization_msgs::MenuEntry*)realloc(this->menu_entries, menu_entries_lengthT * sizeof(visualization_msgs::MenuEntry));
garyservin 0:9e9b7db60fd5 134 menu_entries_length = menu_entries_lengthT;
garyservin 0:9e9b7db60fd5 135 for( uint32_t i = 0; i < menu_entries_length; i++){
garyservin 0:9e9b7db60fd5 136 offset += this->st_menu_entries.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 137 memcpy( &(this->menu_entries[i]), &(this->st_menu_entries), sizeof(visualization_msgs::MenuEntry));
garyservin 0:9e9b7db60fd5 138 }
garyservin 0:9e9b7db60fd5 139 uint32_t controls_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 140 controls_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 141 controls_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 142 controls_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 143 offset += sizeof(this->controls_length);
garyservin 0:9e9b7db60fd5 144 if(controls_lengthT > controls_length)
garyservin 0:9e9b7db60fd5 145 this->controls = (visualization_msgs::InteractiveMarkerControl*)realloc(this->controls, controls_lengthT * sizeof(visualization_msgs::InteractiveMarkerControl));
garyservin 0:9e9b7db60fd5 146 controls_length = controls_lengthT;
garyservin 0:9e9b7db60fd5 147 for( uint32_t i = 0; i < controls_length; i++){
garyservin 0:9e9b7db60fd5 148 offset += this->st_controls.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 149 memcpy( &(this->controls[i]), &(this->st_controls), sizeof(visualization_msgs::InteractiveMarkerControl));
garyservin 0:9e9b7db60fd5 150 }
garyservin 0:9e9b7db60fd5 151 return offset;
garyservin 0:9e9b7db60fd5 152 }
garyservin 0:9e9b7db60fd5 153
garyservin 0:9e9b7db60fd5 154 const char * getType(){ return "visualization_msgs/InteractiveMarker"; };
garyservin 0:9e9b7db60fd5 155 const char * getMD5(){ return "dd86d22909d5a3364b384492e35c10af"; };
garyservin 0:9e9b7db60fd5 156
garyservin 0:9e9b7db60fd5 157 };
garyservin 0:9e9b7db60fd5 158
garyservin 0:9e9b7db60fd5 159 }
garyservin 0:9e9b7db60fd5 160 #endif