Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GraspPlanning_h
00002 #define _ROS_SERVICE_GraspPlanning_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "manipulation_msgs/GraspPlanningErrorCode.h"
00008 #include "manipulation_msgs/GraspableObject.h"
00009 #include "manipulation_msgs/Grasp.h"
00010
00011 namespace manipulation_msgs
00012 {
00013
00014 static const char GRASPPLANNING[] = "manipulation_msgs/GraspPlanning";
00015
00016 class GraspPlanningRequest : public ros::Msg
00017 {
00018 public:
00019 const char* arm_name;
00020 manipulation_msgs::GraspableObject target;
00021 const char* collision_object_name;
00022 const char* collision_support_surface_name;
00023 uint8_t grasps_to_evaluate_length;
00024 manipulation_msgs::Grasp st_grasps_to_evaluate;
00025 manipulation_msgs::Grasp * grasps_to_evaluate;
00026 uint8_t movable_obstacles_length;
00027 manipulation_msgs::GraspableObject st_movable_obstacles;
00028 manipulation_msgs::GraspableObject * movable_obstacles;
00029
00030 virtual int serialize(unsigned char *outbuffer) const
00031 {
00032 int offset = 0;
00033 uint32_t length_arm_name = strlen(this->arm_name);
00034 memcpy(outbuffer + offset, &length_arm_name, sizeof(uint32_t));
00035 offset += 4;
00036 memcpy(outbuffer + offset, this->arm_name, length_arm_name);
00037 offset += length_arm_name;
00038 offset += this->target.serialize(outbuffer + offset);
00039 uint32_t length_collision_object_name = strlen(this->collision_object_name);
00040 memcpy(outbuffer + offset, &length_collision_object_name, sizeof(uint32_t));
00041 offset += 4;
00042 memcpy(outbuffer + offset, this->collision_object_name, length_collision_object_name);
00043 offset += length_collision_object_name;
00044 uint32_t length_collision_support_surface_name = strlen(this->collision_support_surface_name);
00045 memcpy(outbuffer + offset, &length_collision_support_surface_name, sizeof(uint32_t));
00046 offset += 4;
00047 memcpy(outbuffer + offset, this->collision_support_surface_name, length_collision_support_surface_name);
00048 offset += length_collision_support_surface_name;
00049 *(outbuffer + offset++) = grasps_to_evaluate_length;
00050 *(outbuffer + offset++) = 0;
00051 *(outbuffer + offset++) = 0;
00052 *(outbuffer + offset++) = 0;
00053 for( uint8_t i = 0; i < grasps_to_evaluate_length; i++){
00054 offset += this->grasps_to_evaluate[i].serialize(outbuffer + offset);
00055 }
00056 *(outbuffer + offset++) = movable_obstacles_length;
00057 *(outbuffer + offset++) = 0;
00058 *(outbuffer + offset++) = 0;
00059 *(outbuffer + offset++) = 0;
00060 for( uint8_t i = 0; i < movable_obstacles_length; i++){
00061 offset += this->movable_obstacles[i].serialize(outbuffer + offset);
00062 }
00063 return offset;
00064 }
00065
00066 virtual int deserialize(unsigned char *inbuffer)
00067 {
00068 int offset = 0;
00069 uint32_t length_arm_name;
00070 memcpy(&length_arm_name, (inbuffer + offset), sizeof(uint32_t));
00071 offset += 4;
00072 for(unsigned int k= offset; k< offset+length_arm_name; ++k){
00073 inbuffer[k-1]=inbuffer[k];
00074 }
00075 inbuffer[offset+length_arm_name-1]=0;
00076 this->arm_name = (char *)(inbuffer + offset-1);
00077 offset += length_arm_name;
00078 offset += this->target.deserialize(inbuffer + offset);
00079 uint32_t length_collision_object_name;
00080 memcpy(&length_collision_object_name, (inbuffer + offset), sizeof(uint32_t));
00081 offset += 4;
00082 for(unsigned int k= offset; k< offset+length_collision_object_name; ++k){
00083 inbuffer[k-1]=inbuffer[k];
00084 }
00085 inbuffer[offset+length_collision_object_name-1]=0;
00086 this->collision_object_name = (char *)(inbuffer + offset-1);
00087 offset += length_collision_object_name;
00088 uint32_t length_collision_support_surface_name;
00089 memcpy(&length_collision_support_surface_name, (inbuffer + offset), sizeof(uint32_t));
00090 offset += 4;
00091 for(unsigned int k= offset; k< offset+length_collision_support_surface_name; ++k){
00092 inbuffer[k-1]=inbuffer[k];
00093 }
00094 inbuffer[offset+length_collision_support_surface_name-1]=0;
00095 this->collision_support_surface_name = (char *)(inbuffer + offset-1);
00096 offset += length_collision_support_surface_name;
00097 uint8_t grasps_to_evaluate_lengthT = *(inbuffer + offset++);
00098 if(grasps_to_evaluate_lengthT > grasps_to_evaluate_length)
00099 this->grasps_to_evaluate = (manipulation_msgs::Grasp*)realloc(this->grasps_to_evaluate, grasps_to_evaluate_lengthT * sizeof(manipulation_msgs::Grasp));
00100 offset += 3;
00101 grasps_to_evaluate_length = grasps_to_evaluate_lengthT;
00102 for( uint8_t i = 0; i < grasps_to_evaluate_length; i++){
00103 offset += this->st_grasps_to_evaluate.deserialize(inbuffer + offset);
00104 memcpy( &(this->grasps_to_evaluate[i]), &(this->st_grasps_to_evaluate), sizeof(manipulation_msgs::Grasp));
00105 }
00106 uint8_t movable_obstacles_lengthT = *(inbuffer + offset++);
00107 if(movable_obstacles_lengthT > movable_obstacles_length)
00108 this->movable_obstacles = (manipulation_msgs::GraspableObject*)realloc(this->movable_obstacles, movable_obstacles_lengthT * sizeof(manipulation_msgs::GraspableObject));
00109 offset += 3;
00110 movable_obstacles_length = movable_obstacles_lengthT;
00111 for( uint8_t i = 0; i < movable_obstacles_length; i++){
00112 offset += this->st_movable_obstacles.deserialize(inbuffer + offset);
00113 memcpy( &(this->movable_obstacles[i]), &(this->st_movable_obstacles), sizeof(manipulation_msgs::GraspableObject));
00114 }
00115 return offset;
00116 }
00117
00118 const char * getType(){ return GRASPPLANNING; };
00119 const char * getMD5(){ return "077dca08a07415d82d6ab047890161f4"; };
00120
00121 };
00122
00123 class GraspPlanningResponse : public ros::Msg
00124 {
00125 public:
00126 uint8_t grasps_length;
00127 manipulation_msgs::Grasp st_grasps;
00128 manipulation_msgs::Grasp * grasps;
00129 manipulation_msgs::GraspPlanningErrorCode error_code;
00130
00131 virtual int serialize(unsigned char *outbuffer) const
00132 {
00133 int offset = 0;
00134 *(outbuffer + offset++) = grasps_length;
00135 *(outbuffer + offset++) = 0;
00136 *(outbuffer + offset++) = 0;
00137 *(outbuffer + offset++) = 0;
00138 for( uint8_t i = 0; i < grasps_length; i++){
00139 offset += this->grasps[i].serialize(outbuffer + offset);
00140 }
00141 offset += this->error_code.serialize(outbuffer + offset);
00142 return offset;
00143 }
00144
00145 virtual int deserialize(unsigned char *inbuffer)
00146 {
00147 int offset = 0;
00148 uint8_t grasps_lengthT = *(inbuffer + offset++);
00149 if(grasps_lengthT > grasps_length)
00150 this->grasps = (manipulation_msgs::Grasp*)realloc(this->grasps, grasps_lengthT * sizeof(manipulation_msgs::Grasp));
00151 offset += 3;
00152 grasps_length = grasps_lengthT;
00153 for( uint8_t i = 0; i < grasps_length; i++){
00154 offset += this->st_grasps.deserialize(inbuffer + offset);
00155 memcpy( &(this->grasps[i]), &(this->st_grasps), sizeof(manipulation_msgs::Grasp));
00156 }
00157 offset += this->error_code.deserialize(inbuffer + offset);
00158 return offset;
00159 }
00160
00161 const char * getType(){ return GRASPPLANNING; };
00162 const char * getMD5(){ return "ff7a88c4aec40207164535a24dc9c440"; };
00163
00164 };
00165
00166 class GraspPlanning {
00167 public:
00168 typedef GraspPlanningRequest Request;
00169 typedef GraspPlanningResponse Response;
00170 };
00171
00172 }
00173 #endif