Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Octomap.h
00001 #ifndef _ROS_octomap_msgs_Octomap_h 00002 #define _ROS_octomap_msgs_Octomap_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "std_msgs/Header.h" 00009 00010 namespace octomap_msgs 00011 { 00012 00013 class Octomap : public ros::Msg 00014 { 00015 public: 00016 typedef std_msgs::Header _header_type; 00017 _header_type header; 00018 typedef bool _binary_type; 00019 _binary_type binary; 00020 typedef const char* _id_type; 00021 _id_type id; 00022 typedef double _resolution_type; 00023 _resolution_type resolution; 00024 uint32_t data_length; 00025 typedef int8_t _data_type; 00026 _data_type st_data; 00027 _data_type * data; 00028 00029 Octomap(): 00030 header(), 00031 binary(0), 00032 id(""), 00033 resolution(0), 00034 data_length(0), data(NULL) 00035 { 00036 } 00037 00038 virtual int serialize(unsigned char *outbuffer) const 00039 { 00040 int offset = 0; 00041 offset += this->header.serialize(outbuffer + offset); 00042 union { 00043 bool real; 00044 uint8_t base; 00045 } u_binary; 00046 u_binary.real = this->binary; 00047 *(outbuffer + offset + 0) = (u_binary.base >> (8 * 0)) & 0xFF; 00048 offset += sizeof(this->binary); 00049 uint32_t length_id = strlen(this->id); 00050 varToArr(outbuffer + offset, length_id); 00051 offset += 4; 00052 memcpy(outbuffer + offset, this->id, length_id); 00053 offset += length_id; 00054 union { 00055 double real; 00056 uint64_t base; 00057 } u_resolution; 00058 u_resolution.real = this->resolution; 00059 *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; 00060 *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; 00061 *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; 00062 *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; 00063 *(outbuffer + offset + 4) = (u_resolution.base >> (8 * 4)) & 0xFF; 00064 *(outbuffer + offset + 5) = (u_resolution.base >> (8 * 5)) & 0xFF; 00065 *(outbuffer + offset + 6) = (u_resolution.base >> (8 * 6)) & 0xFF; 00066 *(outbuffer + offset + 7) = (u_resolution.base >> (8 * 7)) & 0xFF; 00067 offset += sizeof(this->resolution); 00068 *(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF; 00069 *(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF; 00070 *(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF; 00071 *(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF; 00072 offset += sizeof(this->data_length); 00073 for( uint32_t i = 0; i < data_length; i++){ 00074 union { 00075 int8_t real; 00076 uint8_t base; 00077 } u_datai; 00078 u_datai.real = this->data[i]; 00079 *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF; 00080 offset += sizeof(this->data[i]); 00081 } 00082 return offset; 00083 } 00084 00085 virtual int deserialize(unsigned char *inbuffer) 00086 { 00087 int offset = 0; 00088 offset += this->header.deserialize(inbuffer + offset); 00089 union { 00090 bool real; 00091 uint8_t base; 00092 } u_binary; 00093 u_binary.base = 0; 00094 u_binary.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00095 this->binary = u_binary.real; 00096 offset += sizeof(this->binary); 00097 uint32_t length_id; 00098 arrToVar(length_id, (inbuffer + offset)); 00099 offset += 4; 00100 for(unsigned int k= offset; k< offset+length_id; ++k){ 00101 inbuffer[k-1]=inbuffer[k]; 00102 } 00103 inbuffer[offset+length_id-1]=0; 00104 this->id = (char *)(inbuffer + offset-1); 00105 offset += length_id; 00106 union { 00107 double real; 00108 uint64_t base; 00109 } u_resolution; 00110 u_resolution.base = 0; 00111 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00112 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00113 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00114 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00115 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00116 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00117 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00118 u_resolution.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00119 this->resolution = u_resolution.real; 00120 offset += sizeof(this->resolution); 00121 uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset))); 00122 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00123 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00124 data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00125 offset += sizeof(this->data_length); 00126 if(data_lengthT > data_length) 00127 this->data = (int8_t*)realloc(this->data, data_lengthT * sizeof(int8_t)); 00128 data_length = data_lengthT; 00129 for( uint32_t i = 0; i < data_length; i++){ 00130 union { 00131 int8_t real; 00132 uint8_t base; 00133 } u_st_data; 00134 u_st_data.base = 0; 00135 u_st_data.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00136 this->st_data = u_st_data.real; 00137 offset += sizeof(this->st_data); 00138 memcpy( &(this->data[i]), &(this->st_data), sizeof(int8_t)); 00139 } 00140 return offset; 00141 } 00142 00143 virtual const char * getType(){ return "octomap_msgs/Octomap"; }; 00144 virtual const char * getMD5(){ return "9a45536b45c5e409cd49f04bb2d9999f"; }; 00145 00146 }; 00147 00148 } 00149 #endif
Generated on Mon Sep 26 2022 13:47:02 by
