Go to the documentation of this file.00001 #ifndef _ROS_moveit_msgs_MotionPlanResponse_h
00002 #define _ROS_moveit_msgs_MotionPlanResponse_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 MotionPlanResponse : public ros::Msg
00016 {
00017 public:
00018 moveit_msgs::RobotState trajectory_start;
00019 const char* group_name;
00020 moveit_msgs::RobotTrajectory trajectory;
00021 float planning_time;
00022 moveit_msgs::MoveItErrorCodes error_code;
00023
00024 virtual int serialize(unsigned char *outbuffer) const
00025 {
00026 int offset = 0;
00027 offset += this->trajectory_start.serialize(outbuffer + offset);
00028 uint32_t length_group_name = strlen(this->group_name);
00029 memcpy(outbuffer + offset, &length_group_name, sizeof(uint32_t));
00030 offset += 4;
00031 memcpy(outbuffer + offset, this->group_name, length_group_name);
00032 offset += length_group_name;
00033 offset += this->trajectory.serialize(outbuffer + offset);
00034 int32_t * val_planning_time = (int32_t *) &(this->planning_time);
00035 int32_t exp_planning_time = (((*val_planning_time)>>23)&255);
00036 if(exp_planning_time != 0)
00037 exp_planning_time += 1023-127;
00038 int32_t sig_planning_time = *val_planning_time;
00039 *(outbuffer + offset++) = 0;
00040 *(outbuffer + offset++) = 0;
00041 *(outbuffer + offset++) = 0;
00042 *(outbuffer + offset++) = (sig_planning_time<<5) & 0xff;
00043 *(outbuffer + offset++) = (sig_planning_time>>3) & 0xff;
00044 *(outbuffer + offset++) = (sig_planning_time>>11) & 0xff;
00045 *(outbuffer + offset++) = ((exp_planning_time<<4) & 0xF0) | ((sig_planning_time>>19)&0x0F);
00046 *(outbuffer + offset++) = (exp_planning_time>>4) & 0x7F;
00047 if(this->planning_time < 0) *(outbuffer + offset -1) |= 0x80;
00048 offset += this->error_code.serialize(outbuffer + offset);
00049 return offset;
00050 }
00051
00052 virtual int deserialize(unsigned char *inbuffer)
00053 {
00054 int offset = 0;
00055 offset += this->trajectory_start.deserialize(inbuffer + offset);
00056 uint32_t length_group_name;
00057 memcpy(&length_group_name, (inbuffer + offset), sizeof(uint32_t));
00058 offset += 4;
00059 for(unsigned int k= offset; k< offset+length_group_name; ++k){
00060 inbuffer[k-1]=inbuffer[k];
00061 }
00062 inbuffer[offset+length_group_name-1]=0;
00063 this->group_name = (char *)(inbuffer + offset-1);
00064 offset += length_group_name;
00065 offset += this->trajectory.deserialize(inbuffer + offset);
00066 uint32_t * val_planning_time = (uint32_t*) &(this->planning_time);
00067 offset += 3;
00068 *val_planning_time = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00069 *val_planning_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00070 *val_planning_time |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00071 *val_planning_time |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00072 uint32_t exp_planning_time = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00073 exp_planning_time |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00074 if(exp_planning_time !=0)
00075 *val_planning_time |= ((exp_planning_time)-1023+127)<<23;
00076 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->planning_time = -this->planning_time;
00077 offset += this->error_code.deserialize(inbuffer + offset);
00078 return offset;
00079 }
00080
00081 const char * getType(){ return "moveit_msgs/MotionPlanResponse"; };
00082 const char * getMD5(){ return "e493d20ab41424c48f671e152c70fc74"; };
00083
00084 };
00085
00086 }
00087 #endif