catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SetPointCloud2.h Source File

SetPointCloud2.h

00001 #ifndef _ROS_SERVICE_SetPointCloud2_h
00002 #define _ROS_SERVICE_SetPointCloud2_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "sensor_msgs/PointCloud2.h"
00008 
00009 namespace jsk_recognition_msgs
00010 {
00011 
00012 static const char SETPOINTCLOUD2[] = "jsk_recognition_msgs/SetPointCloud2";
00013 
00014   class SetPointCloud2Request : public ros::Msg
00015   {
00016     public:
00017       typedef sensor_msgs::PointCloud2 _cloud_type;
00018       _cloud_type cloud;
00019       typedef const char* _name_type;
00020       _name_type name;
00021 
00022     SetPointCloud2Request():
00023       cloud(),
00024       name("")
00025     {
00026     }
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       offset += this->cloud.serialize(outbuffer + offset);
00032       uint32_t length_name = strlen(this->name);
00033       varToArr(outbuffer + offset, length_name);
00034       offset += 4;
00035       memcpy(outbuffer + offset, this->name, length_name);
00036       offset += length_name;
00037       return offset;
00038     }
00039 
00040     virtual int deserialize(unsigned char *inbuffer)
00041     {
00042       int offset = 0;
00043       offset += this->cloud.deserialize(inbuffer + offset);
00044       uint32_t length_name;
00045       arrToVar(length_name, (inbuffer + offset));
00046       offset += 4;
00047       for(unsigned int k= offset; k< offset+length_name; ++k){
00048           inbuffer[k-1]=inbuffer[k];
00049       }
00050       inbuffer[offset+length_name-1]=0;
00051       this->name = (char *)(inbuffer + offset-1);
00052       offset += length_name;
00053      return offset;
00054     }
00055 
00056     virtual const char * getType(){ return SETPOINTCLOUD2; };
00057     virtual const char * getMD5(){ return "f233222fb244758562fcd56961c317c9"; };
00058 
00059   };
00060 
00061   class SetPointCloud2Response : public ros::Msg
00062   {
00063     public:
00064       typedef const char* _output_type;
00065       _output_type output;
00066 
00067     SetPointCloud2Response():
00068       output("")
00069     {
00070     }
00071 
00072     virtual int serialize(unsigned char *outbuffer) const
00073     {
00074       int offset = 0;
00075       uint32_t length_output = strlen(this->output);
00076       varToArr(outbuffer + offset, length_output);
00077       offset += 4;
00078       memcpy(outbuffer + offset, this->output, length_output);
00079       offset += length_output;
00080       return offset;
00081     }
00082 
00083     virtual int deserialize(unsigned char *inbuffer)
00084     {
00085       int offset = 0;
00086       uint32_t length_output;
00087       arrToVar(length_output, (inbuffer + offset));
00088       offset += 4;
00089       for(unsigned int k= offset; k< offset+length_output; ++k){
00090           inbuffer[k-1]=inbuffer[k];
00091       }
00092       inbuffer[offset+length_output-1]=0;
00093       this->output = (char *)(inbuffer + offset-1);
00094       offset += length_output;
00095      return offset;
00096     }
00097 
00098     virtual const char * getType(){ return SETPOINTCLOUD2; };
00099     virtual const char * getMD5(){ return "0825d95fdfa2c8f4bbb4e9c74bccd3fd"; };
00100 
00101   };
00102 
00103   class SetPointCloud2 {
00104     public:
00105     typedef SetPointCloud2Request Request;
00106     typedef SetPointCloud2Response Response;
00107   };
00108 
00109 }
00110 #endif