catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SetPose.h Source File

SetPose.h

00001 #ifndef _ROS_SERVICE_SetPose_h
00002 #define _ROS_SERVICE_SetPose_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "geometry_msgs/PoseStamped.h"
00008 #include "visualization_msgs/Marker.h"
00009 
00010 namespace jsk_interactive_marker
00011 {
00012 
00013 static const char SETPOSE[] = "jsk_interactive_marker/SetPose";
00014 
00015   class SetPoseRequest : public ros::Msg
00016   {
00017     public:
00018       typedef geometry_msgs::PoseStamped _pose_type;
00019       _pose_type pose;
00020       uint32_t markers_length;
00021       typedef visualization_msgs::Marker _markers_type;
00022       _markers_type st_markers;
00023       _markers_type * markers;
00024 
00025     SetPoseRequest():
00026       pose(),
00027       markers_length(0), markers(NULL)
00028     {
00029     }
00030 
00031     virtual int serialize(unsigned char *outbuffer) const
00032     {
00033       int offset = 0;
00034       offset += this->pose.serialize(outbuffer + offset);
00035       *(outbuffer + offset + 0) = (this->markers_length >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (this->markers_length >> (8 * 1)) & 0xFF;
00037       *(outbuffer + offset + 2) = (this->markers_length >> (8 * 2)) & 0xFF;
00038       *(outbuffer + offset + 3) = (this->markers_length >> (8 * 3)) & 0xFF;
00039       offset += sizeof(this->markers_length);
00040       for( uint32_t i = 0; i < markers_length; i++){
00041       offset += this->markers[i].serialize(outbuffer + offset);
00042       }
00043       return offset;
00044     }
00045 
00046     virtual int deserialize(unsigned char *inbuffer)
00047     {
00048       int offset = 0;
00049       offset += this->pose.deserialize(inbuffer + offset);
00050       uint32_t markers_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00051       markers_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00052       markers_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00053       markers_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00054       offset += sizeof(this->markers_length);
00055       if(markers_lengthT > markers_length)
00056         this->markers = (visualization_msgs::Marker*)realloc(this->markers, markers_lengthT * sizeof(visualization_msgs::Marker));
00057       markers_length = markers_lengthT;
00058       for( uint32_t i = 0; i < markers_length; i++){
00059       offset += this->st_markers.deserialize(inbuffer + offset);
00060         memcpy( &(this->markers[i]), &(this->st_markers), sizeof(visualization_msgs::Marker));
00061       }
00062      return offset;
00063     }
00064 
00065     virtual const char * getType(){ return SETPOSE; };
00066     virtual const char * getMD5(){ return "21980095fd7bf6047ed57a495f657428"; };
00067 
00068   };
00069 
00070   class SetPoseResponse : public ros::Msg
00071   {
00072     public:
00073       typedef geometry_msgs::PoseStamped _pose_type;
00074       _pose_type pose;
00075 
00076     SetPoseResponse():
00077       pose()
00078     {
00079     }
00080 
00081     virtual int serialize(unsigned char *outbuffer) const
00082     {
00083       int offset = 0;
00084       offset += this->pose.serialize(outbuffer + offset);
00085       return offset;
00086     }
00087 
00088     virtual int deserialize(unsigned char *inbuffer)
00089     {
00090       int offset = 0;
00091       offset += this->pose.deserialize(inbuffer + offset);
00092      return offset;
00093     }
00094 
00095     virtual const char * getType(){ return SETPOSE; };
00096     virtual const char * getMD5(){ return "3f8930d968a3e84d471dff917bb1cdae"; };
00097 
00098   };
00099 
00100   class SetPose {
00101     public:
00102     typedef SetPoseRequest Request;
00103     typedef SetPoseResponse Response;
00104   };
00105 
00106 }
00107 #endif