Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h
Dependents: WRS2020_mecanum_node
KeyValue.h
00001 #ifndef _ROS_diagnostic_msgs_KeyValue_h 00002 #define _ROS_diagnostic_msgs_KeyValue_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace diagnostic_msgs 00010 { 00011 00012 class KeyValue : public ros::Msg 00013 { 00014 public: 00015 typedef const char* _key_type; 00016 _key_type key; 00017 typedef const char* _value_type; 00018 _value_type value; 00019 00020 KeyValue(): 00021 key(""), 00022 value("") 00023 { 00024 } 00025 00026 virtual int serialize(unsigned char *outbuffer) const 00027 { 00028 int offset = 0; 00029 uint32_t length_key = strlen(this->key); 00030 varToArr(outbuffer + offset, length_key); 00031 offset += 4; 00032 memcpy(outbuffer + offset, this->key, length_key); 00033 offset += length_key; 00034 uint32_t length_value = strlen(this->value); 00035 varToArr(outbuffer + offset, length_value); 00036 offset += 4; 00037 memcpy(outbuffer + offset, this->value, length_value); 00038 offset += length_value; 00039 return offset; 00040 } 00041 00042 virtual int deserialize(unsigned char *inbuffer) 00043 { 00044 int offset = 0; 00045 uint32_t length_key; 00046 arrToVar(length_key, (inbuffer + offset)); 00047 offset += 4; 00048 for(unsigned int k= offset; k< offset+length_key; ++k){ 00049 inbuffer[k-1]=inbuffer[k]; 00050 } 00051 inbuffer[offset+length_key-1]=0; 00052 this->key = (char *)(inbuffer + offset-1); 00053 offset += length_key; 00054 uint32_t length_value; 00055 arrToVar(length_value, (inbuffer + offset)); 00056 offset += 4; 00057 for(unsigned int k= offset; k< offset+length_value; ++k){ 00058 inbuffer[k-1]=inbuffer[k]; 00059 } 00060 inbuffer[offset+length_value-1]=0; 00061 this->value = (char *)(inbuffer + offset-1); 00062 offset += length_value; 00063 return offset; 00064 } 00065 00066 const char * getType(){ return "diagnostic_msgs/KeyValue"; }; 00067 const char * getMD5(){ return "cf57fdc6617a881a88c16e768132149c"; }; 00068 00069 }; 00070 00071 } 00072 #endif
Generated on Tue Jul 12 2022 18:49:19 by 1.7.2