GraspPlanningGoal.h
Go to the documentation of this file.
00001 #ifndef _ROS_manipulation_msgs_GraspPlanningGoal_h
00002 #define _ROS_manipulation_msgs_GraspPlanningGoal_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "manipulation_msgs/GraspableObject.h"
00009 #include "manipulation_msgs/Grasp.h"
00010 
00011 namespace manipulation_msgs
00012 {
00013 
00014   class GraspPlanningGoal : public ros::Msg
00015   {
00016     public:
00017       const char* arm_name;
00018       manipulation_msgs::GraspableObject target;
00019       const char* collision_object_name;
00020       const char* collision_support_surface_name;
00021       uint8_t grasps_to_evaluate_length;
00022       manipulation_msgs::Grasp st_grasps_to_evaluate;
00023       manipulation_msgs::Grasp * grasps_to_evaluate;
00024       uint8_t movable_obstacles_length;
00025       manipulation_msgs::GraspableObject st_movable_obstacles;
00026       manipulation_msgs::GraspableObject * movable_obstacles;
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       uint32_t length_arm_name = strlen(this->arm_name);
00032       memcpy(outbuffer + offset, &length_arm_name, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->arm_name, length_arm_name);
00035       offset += length_arm_name;
00036       offset += this->target.serialize(outbuffer + offset);
00037       uint32_t length_collision_object_name = strlen(this->collision_object_name);
00038       memcpy(outbuffer + offset, &length_collision_object_name, sizeof(uint32_t));
00039       offset += 4;
00040       memcpy(outbuffer + offset, this->collision_object_name, length_collision_object_name);
00041       offset += length_collision_object_name;
00042       uint32_t length_collision_support_surface_name = strlen(this->collision_support_surface_name);
00043       memcpy(outbuffer + offset, &length_collision_support_surface_name, sizeof(uint32_t));
00044       offset += 4;
00045       memcpy(outbuffer + offset, this->collision_support_surface_name, length_collision_support_surface_name);
00046       offset += length_collision_support_surface_name;
00047       *(outbuffer + offset++) = grasps_to_evaluate_length;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       *(outbuffer + offset++) = 0;
00051       for( uint8_t i = 0; i < grasps_to_evaluate_length; i++){
00052       offset += this->grasps_to_evaluate[i].serialize(outbuffer + offset);
00053       }
00054       *(outbuffer + offset++) = movable_obstacles_length;
00055       *(outbuffer + offset++) = 0;
00056       *(outbuffer + offset++) = 0;
00057       *(outbuffer + offset++) = 0;
00058       for( uint8_t i = 0; i < movable_obstacles_length; i++){
00059       offset += this->movable_obstacles[i].serialize(outbuffer + offset);
00060       }
00061       return offset;
00062     }
00063 
00064     virtual int deserialize(unsigned char *inbuffer)
00065     {
00066       int offset = 0;
00067       uint32_t length_arm_name;
00068       memcpy(&length_arm_name, (inbuffer + offset), sizeof(uint32_t));
00069       offset += 4;
00070       for(unsigned int k= offset; k< offset+length_arm_name; ++k){
00071           inbuffer[k-1]=inbuffer[k];
00072       }
00073       inbuffer[offset+length_arm_name-1]=0;
00074       this->arm_name = (char *)(inbuffer + offset-1);
00075       offset += length_arm_name;
00076       offset += this->target.deserialize(inbuffer + offset);
00077       uint32_t length_collision_object_name;
00078       memcpy(&length_collision_object_name, (inbuffer + offset), sizeof(uint32_t));
00079       offset += 4;
00080       for(unsigned int k= offset; k< offset+length_collision_object_name; ++k){
00081           inbuffer[k-1]=inbuffer[k];
00082       }
00083       inbuffer[offset+length_collision_object_name-1]=0;
00084       this->collision_object_name = (char *)(inbuffer + offset-1);
00085       offset += length_collision_object_name;
00086       uint32_t length_collision_support_surface_name;
00087       memcpy(&length_collision_support_surface_name, (inbuffer + offset), sizeof(uint32_t));
00088       offset += 4;
00089       for(unsigned int k= offset; k< offset+length_collision_support_surface_name; ++k){
00090           inbuffer[k-1]=inbuffer[k];
00091       }
00092       inbuffer[offset+length_collision_support_surface_name-1]=0;
00093       this->collision_support_surface_name = (char *)(inbuffer + offset-1);
00094       offset += length_collision_support_surface_name;
00095       uint8_t grasps_to_evaluate_lengthT = *(inbuffer + offset++);
00096       if(grasps_to_evaluate_lengthT > grasps_to_evaluate_length)
00097         this->grasps_to_evaluate = (manipulation_msgs::Grasp*)realloc(this->grasps_to_evaluate, grasps_to_evaluate_lengthT * sizeof(manipulation_msgs::Grasp));
00098       offset += 3;
00099       grasps_to_evaluate_length = grasps_to_evaluate_lengthT;
00100       for( uint8_t i = 0; i < grasps_to_evaluate_length; i++){
00101       offset += this->st_grasps_to_evaluate.deserialize(inbuffer + offset);
00102         memcpy( &(this->grasps_to_evaluate[i]), &(this->st_grasps_to_evaluate), sizeof(manipulation_msgs::Grasp));
00103       }
00104       uint8_t movable_obstacles_lengthT = *(inbuffer + offset++);
00105       if(movable_obstacles_lengthT > movable_obstacles_length)
00106         this->movable_obstacles = (manipulation_msgs::GraspableObject*)realloc(this->movable_obstacles, movable_obstacles_lengthT * sizeof(manipulation_msgs::GraspableObject));
00107       offset += 3;
00108       movable_obstacles_length = movable_obstacles_lengthT;
00109       for( uint8_t i = 0; i < movable_obstacles_length; i++){
00110       offset += this->st_movable_obstacles.deserialize(inbuffer + offset);
00111         memcpy( &(this->movable_obstacles[i]), &(this->st_movable_obstacles), sizeof(manipulation_msgs::GraspableObject));
00112       }
00113      return offset;
00114     }
00115 
00116     const char * getType(){ return "manipulation_msgs/GraspPlanningGoal"; };
00117     const char * getMD5(){ return "077dca08a07415d82d6ab047890161f4"; };
00118 
00119   };
00120 
00121 }
00122 #endif


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