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
PolygonOnEnvironment.h
00001 #ifndef _ROS_SERVICE_PolygonOnEnvironment_h 00002 #define _ROS_SERVICE_PolygonOnEnvironment_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 #include "geometry_msgs/PolygonStamped.h" 00008 00009 namespace jsk_recognition_msgs 00010 { 00011 00012 static const char POLYGONONENVIRONMENT[] = "jsk_recognition_msgs/PolygonOnEnvironment"; 00013 00014 class PolygonOnEnvironmentRequest : public ros::Msg 00015 { 00016 public: 00017 typedef uint32_t _environment_id_type; 00018 _environment_id_type environment_id; 00019 typedef uint32_t _plane_index_type; 00020 _plane_index_type plane_index; 00021 typedef geometry_msgs::PolygonStamped _polygon_type; 00022 _polygon_type polygon; 00023 00024 PolygonOnEnvironmentRequest(): 00025 environment_id(0), 00026 plane_index(0), 00027 polygon() 00028 { 00029 } 00030 00031 virtual int serialize(unsigned char *outbuffer) const 00032 { 00033 int offset = 0; 00034 *(outbuffer + offset + 0) = (this->environment_id >> (8 * 0)) & 0xFF; 00035 *(outbuffer + offset + 1) = (this->environment_id >> (8 * 1)) & 0xFF; 00036 *(outbuffer + offset + 2) = (this->environment_id >> (8 * 2)) & 0xFF; 00037 *(outbuffer + offset + 3) = (this->environment_id >> (8 * 3)) & 0xFF; 00038 offset += sizeof(this->environment_id); 00039 *(outbuffer + offset + 0) = (this->plane_index >> (8 * 0)) & 0xFF; 00040 *(outbuffer + offset + 1) = (this->plane_index >> (8 * 1)) & 0xFF; 00041 *(outbuffer + offset + 2) = (this->plane_index >> (8 * 2)) & 0xFF; 00042 *(outbuffer + offset + 3) = (this->plane_index >> (8 * 3)) & 0xFF; 00043 offset += sizeof(this->plane_index); 00044 offset += this->polygon.serialize(outbuffer + offset); 00045 return offset; 00046 } 00047 00048 virtual int deserialize(unsigned char *inbuffer) 00049 { 00050 int offset = 0; 00051 this->environment_id = ((uint32_t) (*(inbuffer + offset))); 00052 this->environment_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00053 this->environment_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00054 this->environment_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00055 offset += sizeof(this->environment_id); 00056 this->plane_index = ((uint32_t) (*(inbuffer + offset))); 00057 this->plane_index |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00058 this->plane_index |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00059 this->plane_index |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00060 offset += sizeof(this->plane_index); 00061 offset += this->polygon.deserialize(inbuffer + offset); 00062 return offset; 00063 } 00064 00065 virtual const char * getType(){ return POLYGONONENVIRONMENT; }; 00066 virtual const char * getMD5(){ return "5c876f97015e6a599aa3c09455882c02"; }; 00067 00068 }; 00069 00070 class PolygonOnEnvironmentResponse : public ros::Msg 00071 { 00072 public: 00073 typedef bool _result_type; 00074 _result_type result; 00075 typedef const char* _reason_type; 00076 _reason_type reason; 00077 00078 PolygonOnEnvironmentResponse(): 00079 result(0), 00080 reason("") 00081 { 00082 } 00083 00084 virtual int serialize(unsigned char *outbuffer) const 00085 { 00086 int offset = 0; 00087 union { 00088 bool real; 00089 uint8_t base; 00090 } u_result; 00091 u_result.real = this->result; 00092 *(outbuffer + offset + 0) = (u_result.base >> (8 * 0)) & 0xFF; 00093 offset += sizeof(this->result); 00094 uint32_t length_reason = strlen(this->reason); 00095 varToArr(outbuffer + offset, length_reason); 00096 offset += 4; 00097 memcpy(outbuffer + offset, this->reason, length_reason); 00098 offset += length_reason; 00099 return offset; 00100 } 00101 00102 virtual int deserialize(unsigned char *inbuffer) 00103 { 00104 int offset = 0; 00105 union { 00106 bool real; 00107 uint8_t base; 00108 } u_result; 00109 u_result.base = 0; 00110 u_result.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00111 this->result = u_result.real; 00112 offset += sizeof(this->result); 00113 uint32_t length_reason; 00114 arrToVar(length_reason, (inbuffer + offset)); 00115 offset += 4; 00116 for(unsigned int k= offset; k< offset+length_reason; ++k){ 00117 inbuffer[k-1]=inbuffer[k]; 00118 } 00119 inbuffer[offset+length_reason-1]=0; 00120 this->reason = (char *)(inbuffer + offset-1); 00121 offset += length_reason; 00122 return offset; 00123 } 00124 00125 virtual const char * getType(){ return POLYGONONENVIRONMENT; }; 00126 virtual const char * getMD5(){ return "5d3fee08bf23ddff8ab543476a855d3f"; }; 00127 00128 }; 00129 00130 class PolygonOnEnvironment { 00131 public: 00132 typedef PolygonOnEnvironmentRequest Request; 00133 typedef PolygonOnEnvironmentResponse Response; 00134 }; 00135 00136 } 00137 #endif
Generated on Mon Sep 26 2022 13:47:03 by
1.7.2