catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ObjectInformation.h Source File

ObjectInformation.h

00001 #ifndef _ROS_object_recognition_msgs_ObjectInformation_h
00002 #define _ROS_object_recognition_msgs_ObjectInformation_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "shape_msgs/Mesh.h"
00009 #include "sensor_msgs/PointCloud2.h"
00010 
00011 namespace object_recognition_msgs
00012 {
00013 
00014   class ObjectInformation : public ros::Msg
00015   {
00016     public:
00017       typedef const char* _name_type;
00018       _name_type name;
00019       typedef shape_msgs::Mesh _ground_truth_mesh_type;
00020       _ground_truth_mesh_type ground_truth_mesh;
00021       typedef sensor_msgs::PointCloud2 _ground_truth_point_cloud_type;
00022       _ground_truth_point_cloud_type ground_truth_point_cloud;
00023 
00024     ObjectInformation():
00025       name(""),
00026       ground_truth_mesh(),
00027       ground_truth_point_cloud()
00028     {
00029     }
00030 
00031     virtual int serialize(unsigned char *outbuffer) const
00032     {
00033       int offset = 0;
00034       uint32_t length_name = strlen(this->name);
00035       varToArr(outbuffer + offset, length_name);
00036       offset += 4;
00037       memcpy(outbuffer + offset, this->name, length_name);
00038       offset += length_name;
00039       offset += this->ground_truth_mesh.serialize(outbuffer + offset);
00040       offset += this->ground_truth_point_cloud.serialize(outbuffer + offset);
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       uint32_t length_name;
00048       arrToVar(length_name, (inbuffer + offset));
00049       offset += 4;
00050       for(unsigned int k= offset; k< offset+length_name; ++k){
00051           inbuffer[k-1]=inbuffer[k];
00052       }
00053       inbuffer[offset+length_name-1]=0;
00054       this->name = (char *)(inbuffer + offset-1);
00055       offset += length_name;
00056       offset += this->ground_truth_mesh.deserialize(inbuffer + offset);
00057       offset += this->ground_truth_point_cloud.deserialize(inbuffer + offset);
00058      return offset;
00059     }
00060 
00061     virtual const char * getType(){ return "object_recognition_msgs/ObjectInformation"; };
00062     virtual const char * getMD5(){ return "921ec39f51c7b927902059cf3300ecde"; };
00063 
00064   };
00065 
00066 }
00067 #endif