catchrobo2022 mbed LPC1768 メインプログラム

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ObjectColor.h Source File

ObjectColor.h

00001 #ifndef _ROS_moveit_msgs_ObjectColor_h
00002 #define _ROS_moveit_msgs_ObjectColor_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/ColorRGBA.h"
00009 
00010 namespace moveit_msgs
00011 {
00012 
00013   class ObjectColor : public ros::Msg
00014   {
00015     public:
00016       typedef const char* _id_type;
00017       _id_type id;
00018       typedef std_msgs::ColorRGBA _color_type;
00019       _color_type color;
00020 
00021     ObjectColor():
00022       id(""),
00023       color()
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       uint32_t length_id = strlen(this->id);
00031       varToArr(outbuffer + offset, length_id);
00032       offset += 4;
00033       memcpy(outbuffer + offset, this->id, length_id);
00034       offset += length_id;
00035       offset += this->color.serialize(outbuffer + offset);
00036       return offset;
00037     }
00038 
00039     virtual int deserialize(unsigned char *inbuffer)
00040     {
00041       int offset = 0;
00042       uint32_t length_id;
00043       arrToVar(length_id, (inbuffer + offset));
00044       offset += 4;
00045       for(unsigned int k= offset; k< offset+length_id; ++k){
00046           inbuffer[k-1]=inbuffer[k];
00047       }
00048       inbuffer[offset+length_id-1]=0;
00049       this->id = (char *)(inbuffer + offset-1);
00050       offset += length_id;
00051       offset += this->color.deserialize(inbuffer + offset);
00052      return offset;
00053     }
00054 
00055     virtual const char * getType(){ return "moveit_msgs/ObjectColor"; };
00056     virtual const char * getMD5(){ return "ec3bd6f103430e64b2ae706a67d8488e"; };
00057 
00058   };
00059 
00060 }
00061 #endif