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
SimpleOccupancyGrid.h
00001 #ifndef _ROS_jsk_recognition_msgs_SimpleOccupancyGrid_h 00002 #define _ROS_jsk_recognition_msgs_SimpleOccupancyGrid_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 #include "geometry_msgs/Point.h" 00010 00011 namespace jsk_recognition_msgs 00012 { 00013 00014 class SimpleOccupancyGrid : public ros::Msg 00015 { 00016 public: 00017 typedef std_msgs::Header _header_type; 00018 _header_type header; 00019 float coefficients[4]; 00020 typedef float _resolution_type; 00021 _resolution_type resolution; 00022 uint32_t cells_length; 00023 typedef geometry_msgs::Point _cells_type; 00024 _cells_type st_cells; 00025 _cells_type * cells; 00026 00027 SimpleOccupancyGrid(): 00028 header(), 00029 coefficients(), 00030 resolution(0), 00031 cells_length(0), cells(NULL) 00032 { 00033 } 00034 00035 virtual int serialize(unsigned char *outbuffer) const 00036 { 00037 int offset = 0; 00038 offset += this->header.serialize(outbuffer + offset); 00039 for( uint32_t i = 0; i < 4; i++){ 00040 union { 00041 float real; 00042 uint32_t base; 00043 } u_coefficientsi; 00044 u_coefficientsi.real = this->coefficients[i]; 00045 *(outbuffer + offset + 0) = (u_coefficientsi.base >> (8 * 0)) & 0xFF; 00046 *(outbuffer + offset + 1) = (u_coefficientsi.base >> (8 * 1)) & 0xFF; 00047 *(outbuffer + offset + 2) = (u_coefficientsi.base >> (8 * 2)) & 0xFF; 00048 *(outbuffer + offset + 3) = (u_coefficientsi.base >> (8 * 3)) & 0xFF; 00049 offset += sizeof(this->coefficients[i]); 00050 } 00051 union { 00052 float real; 00053 uint32_t base; 00054 } u_resolution; 00055 u_resolution.real = this->resolution; 00056 *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; 00057 *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; 00058 *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; 00059 *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; 00060 offset += sizeof(this->resolution); 00061 *(outbuffer + offset + 0) = (this->cells_length >> (8 * 0)) & 0xFF; 00062 *(outbuffer + offset + 1) = (this->cells_length >> (8 * 1)) & 0xFF; 00063 *(outbuffer + offset + 2) = (this->cells_length >> (8 * 2)) & 0xFF; 00064 *(outbuffer + offset + 3) = (this->cells_length >> (8 * 3)) & 0xFF; 00065 offset += sizeof(this->cells_length); 00066 for( uint32_t i = 0; i < cells_length; i++){ 00067 offset += this->cells[i].serialize(outbuffer + offset); 00068 } 00069 return offset; 00070 } 00071 00072 virtual int deserialize(unsigned char *inbuffer) 00073 { 00074 int offset = 0; 00075 offset += this->header.deserialize(inbuffer + offset); 00076 for( uint32_t i = 0; i < 4; i++){ 00077 union { 00078 float real; 00079 uint32_t base; 00080 } u_coefficientsi; 00081 u_coefficientsi.base = 0; 00082 u_coefficientsi.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00083 u_coefficientsi.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00084 u_coefficientsi.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00085 u_coefficientsi.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00086 this->coefficients[i] = u_coefficientsi.real; 00087 offset += sizeof(this->coefficients[i]); 00088 } 00089 union { 00090 float real; 00091 uint32_t base; 00092 } u_resolution; 00093 u_resolution.base = 0; 00094 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00095 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00096 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00097 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00098 this->resolution = u_resolution.real; 00099 offset += sizeof(this->resolution); 00100 uint32_t cells_lengthT = ((uint32_t) (*(inbuffer + offset))); 00101 cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00102 cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00103 cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00104 offset += sizeof(this->cells_length); 00105 if(cells_lengthT > cells_length) 00106 this->cells = (geometry_msgs::Point*)realloc(this->cells, cells_lengthT * sizeof(geometry_msgs::Point)); 00107 cells_length = cells_lengthT; 00108 for( uint32_t i = 0; i < cells_length; i++){ 00109 offset += this->st_cells.deserialize(inbuffer + offset); 00110 memcpy( &(this->cells[i]), &(this->st_cells), sizeof(geometry_msgs::Point)); 00111 } 00112 return offset; 00113 } 00114 00115 virtual const char * getType(){ return "jsk_recognition_msgs/SimpleOccupancyGrid"; }; 00116 virtual const char * getMD5(){ return "25fb4ce5a31aab052ba1250fcdda9da7"; }; 00117 00118 }; 00119 00120 } 00121 #endif
Generated on Mon Sep 26 2022 13:47:03 by
