catchrobo2022 mbed LPC1768 メインプログラム
Dependencies: mbed
SparseOccupancyGrid.h
00001 #ifndef _ROS_jsk_recognition_msgs_SparseOccupancyGrid_h 00002 #define _ROS_jsk_recognition_msgs_SparseOccupancyGrid_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/Pose.h" 00010 #include "jsk_recognition_msgs/SparseOccupancyGridColumn.h" 00011 00012 namespace jsk_recognition_msgs 00013 { 00014 00015 class SparseOccupancyGrid : public ros::Msg 00016 { 00017 public: 00018 typedef std_msgs::Header _header_type; 00019 _header_type header; 00020 typedef geometry_msgs::Pose _origin_pose_type; 00021 _origin_pose_type origin_pose; 00022 typedef float _resolution_type; 00023 _resolution_type resolution; 00024 uint32_t columns_length; 00025 typedef jsk_recognition_msgs::SparseOccupancyGridColumn _columns_type; 00026 _columns_type st_columns; 00027 _columns_type * columns; 00028 00029 SparseOccupancyGrid(): 00030 header(), 00031 origin_pose(), 00032 resolution(0), 00033 columns_length(0), columns(NULL) 00034 { 00035 } 00036 00037 virtual int serialize(unsigned char *outbuffer) const 00038 { 00039 int offset = 0; 00040 offset += this->header.serialize(outbuffer + offset); 00041 offset += this->origin_pose.serialize(outbuffer + offset); 00042 union { 00043 float real; 00044 uint32_t base; 00045 } u_resolution; 00046 u_resolution.real = this->resolution; 00047 *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; 00048 *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; 00049 *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; 00050 *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; 00051 offset += sizeof(this->resolution); 00052 *(outbuffer + offset + 0) = (this->columns_length >> (8 * 0)) & 0xFF; 00053 *(outbuffer + offset + 1) = (this->columns_length >> (8 * 1)) & 0xFF; 00054 *(outbuffer + offset + 2) = (this->columns_length >> (8 * 2)) & 0xFF; 00055 *(outbuffer + offset + 3) = (this->columns_length >> (8 * 3)) & 0xFF; 00056 offset += sizeof(this->columns_length); 00057 for( uint32_t i = 0; i < columns_length; i++){ 00058 offset += this->columns[i].serialize(outbuffer + offset); 00059 } 00060 return offset; 00061 } 00062 00063 virtual int deserialize(unsigned char *inbuffer) 00064 { 00065 int offset = 0; 00066 offset += this->header.deserialize(inbuffer + offset); 00067 offset += this->origin_pose.deserialize(inbuffer + offset); 00068 union { 00069 float real; 00070 uint32_t base; 00071 } u_resolution; 00072 u_resolution.base = 0; 00073 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00074 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00075 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00076 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00077 this->resolution = u_resolution.real; 00078 offset += sizeof(this->resolution); 00079 uint32_t columns_lengthT = ((uint32_t) (*(inbuffer + offset))); 00080 columns_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00081 columns_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00082 columns_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00083 offset += sizeof(this->columns_length); 00084 if(columns_lengthT > columns_length) 00085 this->columns = (jsk_recognition_msgs::SparseOccupancyGridColumn*)realloc(this->columns, columns_lengthT * sizeof(jsk_recognition_msgs::SparseOccupancyGridColumn)); 00086 columns_length = columns_lengthT; 00087 for( uint32_t i = 0; i < columns_length; i++){ 00088 offset += this->st_columns.deserialize(inbuffer + offset); 00089 memcpy( &(this->columns[i]), &(this->st_columns), sizeof(jsk_recognition_msgs::SparseOccupancyGridColumn)); 00090 } 00091 return offset; 00092 } 00093 00094 virtual const char * getType(){ return "jsk_recognition_msgs/SparseOccupancyGrid"; }; 00095 virtual const char * getMD5(){ return "497269ddab6058d0d4860f25dc49448f"; }; 00096 00097 }; 00098 00099 } 00100 #endif
Generated on Mon Sep 26 2022 13:47:03 by
1.7.2