catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TargetObj.h Source File

TargetObj.h

00001 #ifndef _ROS_SERVICE_TargetObj_h
00002 #define _ROS_SERVICE_TargetObj_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "posedetection_msgs/Object6DPose.h"
00008 
00009 namespace posedetection_msgs
00010 {
00011 
00012 static const char TARGETOBJ[] = "posedetection_msgs/TargetObj";
00013 
00014   class TargetObjRequest : public ros::Msg
00015   {
00016     public:
00017       typedef const char* _type_type;
00018       _type_type type;
00019 
00020     TargetObjRequest():
00021       type("")
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       uint32_t length_type = strlen(this->type);
00029       varToArr(outbuffer + offset, length_type);
00030       offset += 4;
00031       memcpy(outbuffer + offset, this->type, length_type);
00032       offset += length_type;
00033       return offset;
00034     }
00035 
00036     virtual int deserialize(unsigned char *inbuffer)
00037     {
00038       int offset = 0;
00039       uint32_t length_type;
00040       arrToVar(length_type, (inbuffer + offset));
00041       offset += 4;
00042       for(unsigned int k= offset; k< offset+length_type; ++k){
00043           inbuffer[k-1]=inbuffer[k];
00044       }
00045       inbuffer[offset+length_type-1]=0;
00046       this->type = (char *)(inbuffer + offset-1);
00047       offset += length_type;
00048      return offset;
00049     }
00050 
00051     virtual const char * getType(){ return TARGETOBJ; };
00052     virtual const char * getMD5(){ return "dc67331de85cf97091b7d45e5c64ab75"; };
00053 
00054   };
00055 
00056   class TargetObjResponse : public ros::Msg
00057   {
00058     public:
00059       typedef posedetection_msgs::Object6DPose _object_pose_type;
00060       _object_pose_type object_pose;
00061 
00062     TargetObjResponse():
00063       object_pose()
00064     {
00065     }
00066 
00067     virtual int serialize(unsigned char *outbuffer) const
00068     {
00069       int offset = 0;
00070       offset += this->object_pose.serialize(outbuffer + offset);
00071       return offset;
00072     }
00073 
00074     virtual int deserialize(unsigned char *inbuffer)
00075     {
00076       int offset = 0;
00077       offset += this->object_pose.deserialize(inbuffer + offset);
00078      return offset;
00079     }
00080 
00081     virtual const char * getType(){ return TARGETOBJ; };
00082     virtual const char * getMD5(){ return "9e3e0d9a56ba420ae5c3854c1194abf0"; };
00083 
00084   };
00085 
00086   class TargetObj {
00087     public:
00088     typedef TargetObjRequest Request;
00089     typedef TargetObjResponse Response;
00090   };
00091 
00092 }
00093 #endif