catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AssocTF.h Source File

AssocTF.h

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