catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MarkerPose.h Source File

MarkerPose.h

00001 #ifndef _ROS_jsk_interactive_marker_MarkerPose_h
00002 #define _ROS_jsk_interactive_marker_MarkerPose_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "geometry_msgs/PoseStamped.h"
00009 
00010 namespace jsk_interactive_marker
00011 {
00012 
00013   class MarkerPose : public ros::Msg
00014   {
00015     public:
00016       typedef int8_t _type_type;
00017       _type_type type;
00018       typedef geometry_msgs::PoseStamped _pose_type;
00019       _pose_type pose;
00020       typedef const char* _marker_name_type;
00021       _marker_name_type marker_name;
00022       enum { GENERAL = 0 };
00023       enum { HEAD_MARKER = 1 };
00024       enum { RHAND_MARKER = 2 };
00025       enum { LHAND_MARKER = 3 };
00026       enum { RLEG_MARKER = 4 };
00027       enum { LLEG_MARKER = 5 };
00028       enum { BASE_MARKER = 6 };
00029       enum { RFINGER_MARKER = 7 };
00030       enum { LFINGER_MARKER = 8 };
00031       enum { SPHERE_MARKER = 9 };
00032 
00033     MarkerPose():
00034       type(0),
00035       pose(),
00036       marker_name("")
00037     {
00038     }
00039 
00040     virtual int serialize(unsigned char *outbuffer) const
00041     {
00042       int offset = 0;
00043       union {
00044         int8_t real;
00045         uint8_t base;
00046       } u_type;
00047       u_type.real = this->type;
00048       *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF;
00049       offset += sizeof(this->type);
00050       offset += this->pose.serialize(outbuffer + offset);
00051       uint32_t length_marker_name = strlen(this->marker_name);
00052       varToArr(outbuffer + offset, length_marker_name);
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->marker_name, length_marker_name);
00055       offset += length_marker_name;
00056       return offset;
00057     }
00058 
00059     virtual int deserialize(unsigned char *inbuffer)
00060     {
00061       int offset = 0;
00062       union {
00063         int8_t real;
00064         uint8_t base;
00065       } u_type;
00066       u_type.base = 0;
00067       u_type.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00068       this->type = u_type.real;
00069       offset += sizeof(this->type);
00070       offset += this->pose.deserialize(inbuffer + offset);
00071       uint32_t length_marker_name;
00072       arrToVar(length_marker_name, (inbuffer + offset));
00073       offset += 4;
00074       for(unsigned int k= offset; k< offset+length_marker_name; ++k){
00075           inbuffer[k-1]=inbuffer[k];
00076       }
00077       inbuffer[offset+length_marker_name-1]=0;
00078       this->marker_name = (char *)(inbuffer + offset-1);
00079       offset += length_marker_name;
00080      return offset;
00081     }
00082 
00083     virtual const char * getType(){ return "jsk_interactive_marker/MarkerPose"; };
00084     virtual const char * getMD5(){ return "cbb82805055f8f87cec211c5459c476c"; };
00085 
00086   };
00087 
00088 }
00089 #endif