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