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
PointField.h
00001 #ifndef _ROS_sensor_msgs_PointField_h 00002 #define _ROS_sensor_msgs_PointField_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace sensor_msgs 00010 { 00011 00012 class PointField : public ros::Msg 00013 { 00014 public: 00015 const char* name; 00016 uint32_t offset; 00017 uint8_t datatype; 00018 uint32_t count; 00019 enum { INT8 = 1 }; 00020 enum { UINT8 = 2 }; 00021 enum { INT16 = 3 }; 00022 enum { UINT16 = 4 }; 00023 enum { INT32 = 5 }; 00024 enum { UINT32 = 6 }; 00025 enum { FLOAT32 = 7 }; 00026 enum { FLOAT64 = 8 }; 00027 00028 PointField(): 00029 name(""), 00030 offset(0), 00031 datatype(0), 00032 count(0) 00033 { 00034 } 00035 00036 virtual int serialize(unsigned char *outbuffer) const 00037 { 00038 int offset = 0; 00039 uint32_t length_name = strlen(this->name); 00040 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t)); 00041 offset += 4; 00042 memcpy(outbuffer + offset, this->name, length_name); 00043 offset += length_name; 00044 *(outbuffer + offset + 0) = (this->offset >> (8 * 0)) & 0xFF; 00045 *(outbuffer + offset + 1) = (this->offset >> (8 * 1)) & 0xFF; 00046 *(outbuffer + offset + 2) = (this->offset >> (8 * 2)) & 0xFF; 00047 *(outbuffer + offset + 3) = (this->offset >> (8 * 3)) & 0xFF; 00048 offset += sizeof(this->offset); 00049 *(outbuffer + offset + 0) = (this->datatype >> (8 * 0)) & 0xFF; 00050 offset += sizeof(this->datatype); 00051 *(outbuffer + offset + 0) = (this->count >> (8 * 0)) & 0xFF; 00052 *(outbuffer + offset + 1) = (this->count >> (8 * 1)) & 0xFF; 00053 *(outbuffer + offset + 2) = (this->count >> (8 * 2)) & 0xFF; 00054 *(outbuffer + offset + 3) = (this->count >> (8 * 3)) & 0xFF; 00055 offset += sizeof(this->count); 00056 return offset; 00057 } 00058 00059 virtual int deserialize(unsigned char *inbuffer) 00060 { 00061 int offset = 0; 00062 uint32_t length_name; 00063 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t)); 00064 offset += 4; 00065 for(unsigned int k= offset; k< offset+length_name; ++k){ 00066 inbuffer[k-1]=inbuffer[k]; 00067 } 00068 inbuffer[offset+length_name-1]=0; 00069 this->name = (char *)(inbuffer + offset-1); 00070 offset += length_name; 00071 this->offset = ((uint32_t) (*(inbuffer + offset))); 00072 this->offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00073 this->offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00074 this->offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00075 offset += sizeof(this->offset); 00076 this->datatype = ((uint8_t) (*(inbuffer + offset))); 00077 offset += sizeof(this->datatype); 00078 this->count = ((uint32_t) (*(inbuffer + offset))); 00079 this->count |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00080 this->count |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00081 this->count |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00082 offset += sizeof(this->count); 00083 return offset; 00084 } 00085 00086 const char * getType(){ return "sensor_msgs/PointField"; }; 00087 const char * getMD5(){ return "268eacb2962780ceac86cbd17e328150"; }; 00088 00089 }; 00090 00091 } 00092 #endif
Generated on Tue Jul 12 2022 18:39:40 by 1.7.2