Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h
Dependents: WRS2020_mecanum_node
Test.h
00001 #ifndef _ROS_SERVICE_Test_h 00002 #define _ROS_SERVICE_Test_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 00008 namespace rosserial_arduino 00009 { 00010 00011 static const char TEST[] = "rosserial_arduino/Test"; 00012 00013 class TestRequest : public ros::Msg 00014 { 00015 public: 00016 typedef const char* _input_type; 00017 _input_type input; 00018 00019 TestRequest(): 00020 input("") 00021 { 00022 } 00023 00024 virtual int serialize(unsigned char *outbuffer) const 00025 { 00026 int offset = 0; 00027 uint32_t length_input = strlen(this->input); 00028 varToArr(outbuffer + offset, length_input); 00029 offset += 4; 00030 memcpy(outbuffer + offset, this->input, length_input); 00031 offset += length_input; 00032 return offset; 00033 } 00034 00035 virtual int deserialize(unsigned char *inbuffer) 00036 { 00037 int offset = 0; 00038 uint32_t length_input; 00039 arrToVar(length_input, (inbuffer + offset)); 00040 offset += 4; 00041 for(unsigned int k= offset; k< offset+length_input; ++k){ 00042 inbuffer[k-1]=inbuffer[k]; 00043 } 00044 inbuffer[offset+length_input-1]=0; 00045 this->input = (char *)(inbuffer + offset-1); 00046 offset += length_input; 00047 return offset; 00048 } 00049 00050 const char * getType(){ return TEST; }; 00051 const char * getMD5(){ return "39e92f1778057359c64c7b8a7d7b19de"; }; 00052 00053 }; 00054 00055 class TestResponse : public ros::Msg 00056 { 00057 public: 00058 typedef const char* _output_type; 00059 _output_type output; 00060 00061 TestResponse(): 00062 output("") 00063 { 00064 } 00065 00066 virtual int serialize(unsigned char *outbuffer) const 00067 { 00068 int offset = 0; 00069 uint32_t length_output = strlen(this->output); 00070 varToArr(outbuffer + offset, length_output); 00071 offset += 4; 00072 memcpy(outbuffer + offset, this->output, length_output); 00073 offset += length_output; 00074 return offset; 00075 } 00076 00077 virtual int deserialize(unsigned char *inbuffer) 00078 { 00079 int offset = 0; 00080 uint32_t length_output; 00081 arrToVar(length_output, (inbuffer + offset)); 00082 offset += 4; 00083 for(unsigned int k= offset; k< offset+length_output; ++k){ 00084 inbuffer[k-1]=inbuffer[k]; 00085 } 00086 inbuffer[offset+length_output-1]=0; 00087 this->output = (char *)(inbuffer + offset-1); 00088 offset += length_output; 00089 return offset; 00090 } 00091 00092 const char * getType(){ return TEST; }; 00093 const char * getMD5(){ return "0825d95fdfa2c8f4bbb4e9c74bccd3fd"; }; 00094 00095 }; 00096 00097 class Test { 00098 public: 00099 typedef TestRequest Request; 00100 typedef TestResponse Response; 00101 }; 00102 00103 } 00104 #endif
Generated on Tue Jul 12 2022 18:49:20 by 1.7.2