ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
MapMetaData.h
00001 #ifndef _ROS_nav_msgs_MapMetaData_h 00002 #define _ROS_nav_msgs_MapMetaData_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "ros/time.h" 00009 #include "geometry_msgs/Pose.h" 00010 00011 namespace nav_msgs 00012 { 00013 00014 class MapMetaData : public ros::Msg 00015 { 00016 public: 00017 ros::Time map_load_time; 00018 float resolution; 00019 uint32_t width; 00020 uint32_t height; 00021 geometry_msgs::Pose origin; 00022 00023 MapMetaData(): 00024 map_load_time(), 00025 resolution(0), 00026 width(0), 00027 height(0), 00028 origin() 00029 { 00030 } 00031 00032 virtual int serialize(unsigned char *outbuffer) const 00033 { 00034 int offset = 0; 00035 *(outbuffer + offset + 0) = (this->map_load_time.sec >> (8 * 0)) & 0xFF; 00036 *(outbuffer + offset + 1) = (this->map_load_time.sec >> (8 * 1)) & 0xFF; 00037 *(outbuffer + offset + 2) = (this->map_load_time.sec >> (8 * 2)) & 0xFF; 00038 *(outbuffer + offset + 3) = (this->map_load_time.sec >> (8 * 3)) & 0xFF; 00039 offset += sizeof(this->map_load_time.sec); 00040 *(outbuffer + offset + 0) = (this->map_load_time.nsec >> (8 * 0)) & 0xFF; 00041 *(outbuffer + offset + 1) = (this->map_load_time.nsec >> (8 * 1)) & 0xFF; 00042 *(outbuffer + offset + 2) = (this->map_load_time.nsec >> (8 * 2)) & 0xFF; 00043 *(outbuffer + offset + 3) = (this->map_load_time.nsec >> (8 * 3)) & 0xFF; 00044 offset += sizeof(this->map_load_time.nsec); 00045 union { 00046 float real; 00047 uint32_t base; 00048 } u_resolution; 00049 u_resolution.real = this->resolution; 00050 *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; 00051 *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; 00052 *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; 00053 *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; 00054 offset += sizeof(this->resolution); 00055 *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; 00056 *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF; 00057 *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF; 00058 *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF; 00059 offset += sizeof(this->width); 00060 *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF; 00061 *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF; 00062 *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF; 00063 *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF; 00064 offset += sizeof(this->height); 00065 offset += this->origin.serialize(outbuffer + offset); 00066 return offset; 00067 } 00068 00069 virtual int deserialize(unsigned char *inbuffer) 00070 { 00071 int offset = 0; 00072 this->map_load_time.sec = ((uint32_t) (*(inbuffer + offset))); 00073 this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00074 this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00075 this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00076 offset += sizeof(this->map_load_time.sec); 00077 this->map_load_time.nsec = ((uint32_t) (*(inbuffer + offset))); 00078 this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00079 this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00080 this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00081 offset += sizeof(this->map_load_time.nsec); 00082 union { 00083 float real; 00084 uint32_t base; 00085 } u_resolution; 00086 u_resolution.base = 0; 00087 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00088 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00089 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00090 u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00091 this->resolution = u_resolution.real; 00092 offset += sizeof(this->resolution); 00093 this->width = ((uint32_t) (*(inbuffer + offset))); 00094 this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00095 this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00096 this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00097 offset += sizeof(this->width); 00098 this->height = ((uint32_t) (*(inbuffer + offset))); 00099 this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00100 this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00101 this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00102 offset += sizeof(this->height); 00103 offset += this->origin.deserialize(inbuffer + offset); 00104 return offset; 00105 } 00106 00107 const char * getType(){ return "nav_msgs/MapMetaData"; }; 00108 const char * getMD5(){ return "10cfc8a2818024d3248802c00c95f11b"; }; 00109 00110 }; 00111 00112 } 00113 #endif
Generated on Tue Jul 12 2022 18:39:40 by 1.7.2