CollisionObject.h
Go to the documentation of this file.
00001 #ifndef _ROS_moveit_msgs_CollisionObject_h
00002 #define _ROS_moveit_msgs_CollisionObject_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "object_recognition_msgs/ObjectType.h"
00010 #include "shape_msgs/SolidPrimitive.h"
00011 #include "geometry_msgs/Pose.h"
00012 #include "shape_msgs/Mesh.h"
00013 #include "shape_msgs/Plane.h"
00014 
00015 namespace moveit_msgs
00016 {
00017 
00018   class CollisionObject : public ros::Msg
00019   {
00020     public:
00021       std_msgs::Header header;
00022       const char* id;
00023       object_recognition_msgs::ObjectType type;
00024       uint8_t primitives_length;
00025       shape_msgs::SolidPrimitive st_primitives;
00026       shape_msgs::SolidPrimitive * primitives;
00027       uint8_t primitive_poses_length;
00028       geometry_msgs::Pose st_primitive_poses;
00029       geometry_msgs::Pose * primitive_poses;
00030       uint8_t meshes_length;
00031       shape_msgs::Mesh st_meshes;
00032       shape_msgs::Mesh * meshes;
00033       uint8_t mesh_poses_length;
00034       geometry_msgs::Pose st_mesh_poses;
00035       geometry_msgs::Pose * mesh_poses;
00036       uint8_t planes_length;
00037       shape_msgs::Plane st_planes;
00038       shape_msgs::Plane * planes;
00039       uint8_t plane_poses_length;
00040       geometry_msgs::Pose st_plane_poses;
00041       geometry_msgs::Pose * plane_poses;
00042       int8_t operation;
00043       enum { ADD = 0 };
00044       enum { REMOVE = 1 };
00045       enum { APPEND = 2 };
00046       enum { MOVE = 3 };
00047 
00048     virtual int serialize(unsigned char *outbuffer) const
00049     {
00050       int offset = 0;
00051       offset += this->header.serialize(outbuffer + offset);
00052       uint32_t length_id = strlen(this->id);
00053       memcpy(outbuffer + offset, &length_id, sizeof(uint32_t));
00054       offset += 4;
00055       memcpy(outbuffer + offset, this->id, length_id);
00056       offset += length_id;
00057       offset += this->type.serialize(outbuffer + offset);
00058       *(outbuffer + offset++) = primitives_length;
00059       *(outbuffer + offset++) = 0;
00060       *(outbuffer + offset++) = 0;
00061       *(outbuffer + offset++) = 0;
00062       for( uint8_t i = 0; i < primitives_length; i++){
00063       offset += this->primitives[i].serialize(outbuffer + offset);
00064       }
00065       *(outbuffer + offset++) = primitive_poses_length;
00066       *(outbuffer + offset++) = 0;
00067       *(outbuffer + offset++) = 0;
00068       *(outbuffer + offset++) = 0;
00069       for( uint8_t i = 0; i < primitive_poses_length; i++){
00070       offset += this->primitive_poses[i].serialize(outbuffer + offset);
00071       }
00072       *(outbuffer + offset++) = meshes_length;
00073       *(outbuffer + offset++) = 0;
00074       *(outbuffer + offset++) = 0;
00075       *(outbuffer + offset++) = 0;
00076       for( uint8_t i = 0; i < meshes_length; i++){
00077       offset += this->meshes[i].serialize(outbuffer + offset);
00078       }
00079       *(outbuffer + offset++) = mesh_poses_length;
00080       *(outbuffer + offset++) = 0;
00081       *(outbuffer + offset++) = 0;
00082       *(outbuffer + offset++) = 0;
00083       for( uint8_t i = 0; i < mesh_poses_length; i++){
00084       offset += this->mesh_poses[i].serialize(outbuffer + offset);
00085       }
00086       *(outbuffer + offset++) = planes_length;
00087       *(outbuffer + offset++) = 0;
00088       *(outbuffer + offset++) = 0;
00089       *(outbuffer + offset++) = 0;
00090       for( uint8_t i = 0; i < planes_length; i++){
00091       offset += this->planes[i].serialize(outbuffer + offset);
00092       }
00093       *(outbuffer + offset++) = plane_poses_length;
00094       *(outbuffer + offset++) = 0;
00095       *(outbuffer + offset++) = 0;
00096       *(outbuffer + offset++) = 0;
00097       for( uint8_t i = 0; i < plane_poses_length; i++){
00098       offset += this->plane_poses[i].serialize(outbuffer + offset);
00099       }
00100       union {
00101         int8_t real;
00102         uint8_t base;
00103       } u_operation;
00104       u_operation.real = this->operation;
00105       *(outbuffer + offset + 0) = (u_operation.base >> (8 * 0)) & 0xFF;
00106       offset += sizeof(this->operation);
00107       return offset;
00108     }
00109 
00110     virtual int deserialize(unsigned char *inbuffer)
00111     {
00112       int offset = 0;
00113       offset += this->header.deserialize(inbuffer + offset);
00114       uint32_t length_id;
00115       memcpy(&length_id, (inbuffer + offset), sizeof(uint32_t));
00116       offset += 4;
00117       for(unsigned int k= offset; k< offset+length_id; ++k){
00118           inbuffer[k-1]=inbuffer[k];
00119       }
00120       inbuffer[offset+length_id-1]=0;
00121       this->id = (char *)(inbuffer + offset-1);
00122       offset += length_id;
00123       offset += this->type.deserialize(inbuffer + offset);
00124       uint8_t primitives_lengthT = *(inbuffer + offset++);
00125       if(primitives_lengthT > primitives_length)
00126         this->primitives = (shape_msgs::SolidPrimitive*)realloc(this->primitives, primitives_lengthT * sizeof(shape_msgs::SolidPrimitive));
00127       offset += 3;
00128       primitives_length = primitives_lengthT;
00129       for( uint8_t i = 0; i < primitives_length; i++){
00130       offset += this->st_primitives.deserialize(inbuffer + offset);
00131         memcpy( &(this->primitives[i]), &(this->st_primitives), sizeof(shape_msgs::SolidPrimitive));
00132       }
00133       uint8_t primitive_poses_lengthT = *(inbuffer + offset++);
00134       if(primitive_poses_lengthT > primitive_poses_length)
00135         this->primitive_poses = (geometry_msgs::Pose*)realloc(this->primitive_poses, primitive_poses_lengthT * sizeof(geometry_msgs::Pose));
00136       offset += 3;
00137       primitive_poses_length = primitive_poses_lengthT;
00138       for( uint8_t i = 0; i < primitive_poses_length; i++){
00139       offset += this->st_primitive_poses.deserialize(inbuffer + offset);
00140         memcpy( &(this->primitive_poses[i]), &(this->st_primitive_poses), sizeof(geometry_msgs::Pose));
00141       }
00142       uint8_t meshes_lengthT = *(inbuffer + offset++);
00143       if(meshes_lengthT > meshes_length)
00144         this->meshes = (shape_msgs::Mesh*)realloc(this->meshes, meshes_lengthT * sizeof(shape_msgs::Mesh));
00145       offset += 3;
00146       meshes_length = meshes_lengthT;
00147       for( uint8_t i = 0; i < meshes_length; i++){
00148       offset += this->st_meshes.deserialize(inbuffer + offset);
00149         memcpy( &(this->meshes[i]), &(this->st_meshes), sizeof(shape_msgs::Mesh));
00150       }
00151       uint8_t mesh_poses_lengthT = *(inbuffer + offset++);
00152       if(mesh_poses_lengthT > mesh_poses_length)
00153         this->mesh_poses = (geometry_msgs::Pose*)realloc(this->mesh_poses, mesh_poses_lengthT * sizeof(geometry_msgs::Pose));
00154       offset += 3;
00155       mesh_poses_length = mesh_poses_lengthT;
00156       for( uint8_t i = 0; i < mesh_poses_length; i++){
00157       offset += this->st_mesh_poses.deserialize(inbuffer + offset);
00158         memcpy( &(this->mesh_poses[i]), &(this->st_mesh_poses), sizeof(geometry_msgs::Pose));
00159       }
00160       uint8_t planes_lengthT = *(inbuffer + offset++);
00161       if(planes_lengthT > planes_length)
00162         this->planes = (shape_msgs::Plane*)realloc(this->planes, planes_lengthT * sizeof(shape_msgs::Plane));
00163       offset += 3;
00164       planes_length = planes_lengthT;
00165       for( uint8_t i = 0; i < planes_length; i++){
00166       offset += this->st_planes.deserialize(inbuffer + offset);
00167         memcpy( &(this->planes[i]), &(this->st_planes), sizeof(shape_msgs::Plane));
00168       }
00169       uint8_t plane_poses_lengthT = *(inbuffer + offset++);
00170       if(plane_poses_lengthT > plane_poses_length)
00171         this->plane_poses = (geometry_msgs::Pose*)realloc(this->plane_poses, plane_poses_lengthT * sizeof(geometry_msgs::Pose));
00172       offset += 3;
00173       plane_poses_length = plane_poses_lengthT;
00174       for( uint8_t i = 0; i < plane_poses_length; i++){
00175       offset += this->st_plane_poses.deserialize(inbuffer + offset);
00176         memcpy( &(this->plane_poses[i]), &(this->st_plane_poses), sizeof(geometry_msgs::Pose));
00177       }
00178       union {
00179         int8_t real;
00180         uint8_t base;
00181       } u_operation;
00182       u_operation.base = 0;
00183       u_operation.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00184       this->operation = u_operation.real;
00185       offset += sizeof(this->operation);
00186      return offset;
00187     }
00188 
00189     const char * getType(){ return "moveit_msgs/CollisionObject"; };
00190     const char * getMD5(){ return "568a161b26dc46c54a5a07621ce82cf3"; };
00191 
00192   };
00193 
00194 }
00195 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55