Go to the documentation of this file.00001 #ifndef _ROS_moveit_msgs_MotionPlanDetailedResponse_h
00002 #define _ROS_moveit_msgs_MotionPlanDetailedResponse_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "moveit_msgs/RobotState.h"
00009 #include "moveit_msgs/RobotTrajectory.h"
00010 #include "moveit_msgs/MoveItErrorCodes.h"
00011
00012 namespace moveit_msgs
00013 {
00014
00015 class MotionPlanDetailedResponse : public ros::Msg
00016 {
00017 public:
00018 moveit_msgs::RobotState trajectory_start;
00019 const char* group_name;
00020 uint8_t trajectory_length;
00021 moveit_msgs::RobotTrajectory st_trajectory;
00022 moveit_msgs::RobotTrajectory * trajectory;
00023 uint8_t description_length;
00024 char* st_description;
00025 char* * description;
00026 uint8_t processing_time_length;
00027 float st_processing_time;
00028 float * processing_time;
00029 moveit_msgs::MoveItErrorCodes error_code;
00030
00031 virtual int serialize(unsigned char *outbuffer) const
00032 {
00033 int offset = 0;
00034 offset += this->trajectory_start.serialize(outbuffer + offset);
00035 uint32_t length_group_name = strlen(this->group_name);
00036 memcpy(outbuffer + offset, &length_group_name, sizeof(uint32_t));
00037 offset += 4;
00038 memcpy(outbuffer + offset, this->group_name, length_group_name);
00039 offset += length_group_name;
00040 *(outbuffer + offset++) = trajectory_length;
00041 *(outbuffer + offset++) = 0;
00042 *(outbuffer + offset++) = 0;
00043 *(outbuffer + offset++) = 0;
00044 for( uint8_t i = 0; i < trajectory_length; i++){
00045 offset += this->trajectory[i].serialize(outbuffer + offset);
00046 }
00047 *(outbuffer + offset++) = description_length;
00048 *(outbuffer + offset++) = 0;
00049 *(outbuffer + offset++) = 0;
00050 *(outbuffer + offset++) = 0;
00051 for( uint8_t i = 0; i < description_length; i++){
00052 uint32_t length_descriptioni = strlen(this->description[i]);
00053 memcpy(outbuffer + offset, &length_descriptioni, sizeof(uint32_t));
00054 offset += 4;
00055 memcpy(outbuffer + offset, this->description[i], length_descriptioni);
00056 offset += length_descriptioni;
00057 }
00058 *(outbuffer + offset++) = processing_time_length;
00059 *(outbuffer + offset++) = 0;
00060 *(outbuffer + offset++) = 0;
00061 *(outbuffer + offset++) = 0;
00062 for( uint8_t i = 0; i < processing_time_length; i++){
00063 int32_t * val_processing_timei = (int32_t *) &(this->processing_time[i]);
00064 int32_t exp_processing_timei = (((*val_processing_timei)>>23)&255);
00065 if(exp_processing_timei != 0)
00066 exp_processing_timei += 1023-127;
00067 int32_t sig_processing_timei = *val_processing_timei;
00068 *(outbuffer + offset++) = 0;
00069 *(outbuffer + offset++) = 0;
00070 *(outbuffer + offset++) = 0;
00071 *(outbuffer + offset++) = (sig_processing_timei<<5) & 0xff;
00072 *(outbuffer + offset++) = (sig_processing_timei>>3) & 0xff;
00073 *(outbuffer + offset++) = (sig_processing_timei>>11) & 0xff;
00074 *(outbuffer + offset++) = ((exp_processing_timei<<4) & 0xF0) | ((sig_processing_timei>>19)&0x0F);
00075 *(outbuffer + offset++) = (exp_processing_timei>>4) & 0x7F;
00076 if(this->processing_time[i] < 0) *(outbuffer + offset -1) |= 0x80;
00077 }
00078 offset += this->error_code.serialize(outbuffer + offset);
00079 return offset;
00080 }
00081
00082 virtual int deserialize(unsigned char *inbuffer)
00083 {
00084 int offset = 0;
00085 offset += this->trajectory_start.deserialize(inbuffer + offset);
00086 uint32_t length_group_name;
00087 memcpy(&length_group_name, (inbuffer + offset), sizeof(uint32_t));
00088 offset += 4;
00089 for(unsigned int k= offset; k< offset+length_group_name; ++k){
00090 inbuffer[k-1]=inbuffer[k];
00091 }
00092 inbuffer[offset+length_group_name-1]=0;
00093 this->group_name = (char *)(inbuffer + offset-1);
00094 offset += length_group_name;
00095 uint8_t trajectory_lengthT = *(inbuffer + offset++);
00096 if(trajectory_lengthT > trajectory_length)
00097 this->trajectory = (moveit_msgs::RobotTrajectory*)realloc(this->trajectory, trajectory_lengthT * sizeof(moveit_msgs::RobotTrajectory));
00098 offset += 3;
00099 trajectory_length = trajectory_lengthT;
00100 for( uint8_t i = 0; i < trajectory_length; i++){
00101 offset += this->st_trajectory.deserialize(inbuffer + offset);
00102 memcpy( &(this->trajectory[i]), &(this->st_trajectory), sizeof(moveit_msgs::RobotTrajectory));
00103 }
00104 uint8_t description_lengthT = *(inbuffer + offset++);
00105 if(description_lengthT > description_length)
00106 this->description = (char**)realloc(this->description, description_lengthT * sizeof(char*));
00107 offset += 3;
00108 description_length = description_lengthT;
00109 for( uint8_t i = 0; i < description_length; i++){
00110 uint32_t length_st_description;
00111 memcpy(&length_st_description, (inbuffer + offset), sizeof(uint32_t));
00112 offset += 4;
00113 for(unsigned int k= offset; k< offset+length_st_description; ++k){
00114 inbuffer[k-1]=inbuffer[k];
00115 }
00116 inbuffer[offset+length_st_description-1]=0;
00117 this->st_description = (char *)(inbuffer + offset-1);
00118 offset += length_st_description;
00119 memcpy( &(this->description[i]), &(this->st_description), sizeof(char*));
00120 }
00121 uint8_t processing_time_lengthT = *(inbuffer + offset++);
00122 if(processing_time_lengthT > processing_time_length)
00123 this->processing_time = (float*)realloc(this->processing_time, processing_time_lengthT * sizeof(float));
00124 offset += 3;
00125 processing_time_length = processing_time_lengthT;
00126 for( uint8_t i = 0; i < processing_time_length; i++){
00127 uint32_t * val_st_processing_time = (uint32_t*) &(this->st_processing_time);
00128 offset += 3;
00129 *val_st_processing_time = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00130 *val_st_processing_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00131 *val_st_processing_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00132 *val_st_processing_time |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00133 uint32_t exp_st_processing_time = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00134 exp_st_processing_time |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00135 if(exp_st_processing_time !=0)
00136 *val_st_processing_time |= ((exp_st_processing_time)-1023+127)<<23;
00137 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->st_processing_time = -this->st_processing_time;
00138 memcpy( &(this->processing_time[i]), &(this->st_processing_time), sizeof(float));
00139 }
00140 offset += this->error_code.deserialize(inbuffer + offset);
00141 return offset;
00142 }
00143
00144 const char * getType(){ return "moveit_msgs/MotionPlanDetailedResponse"; };
00145 const char * getMD5(){ return "7b84c374bb2e37bdc0eba664f7636a8f"; };
00146
00147 };
00148
00149 }
00150 #endif