Go to the documentation of this file.00001 #ifndef _ROS_moveit_msgs_ConstraintEvalResult_h
00002 #define _ROS_moveit_msgs_ConstraintEvalResult_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008
00009 namespace moveit_msgs
00010 {
00011
00012 class ConstraintEvalResult : public ros::Msg
00013 {
00014 public:
00015 bool result;
00016 float distance;
00017
00018 virtual int serialize(unsigned char *outbuffer) const
00019 {
00020 int offset = 0;
00021 union {
00022 bool real;
00023 uint8_t base;
00024 } u_result;
00025 u_result.real = this->result;
00026 *(outbuffer + offset + 0) = (u_result.base >> (8 * 0)) & 0xFF;
00027 offset += sizeof(this->result);
00028 int32_t * val_distance = (int32_t *) &(this->distance);
00029 int32_t exp_distance = (((*val_distance)>>23)&255);
00030 if(exp_distance != 0)
00031 exp_distance += 1023-127;
00032 int32_t sig_distance = *val_distance;
00033 *(outbuffer + offset++) = 0;
00034 *(outbuffer + offset++) = 0;
00035 *(outbuffer + offset++) = 0;
00036 *(outbuffer + offset++) = (sig_distance<<5) & 0xff;
00037 *(outbuffer + offset++) = (sig_distance>>3) & 0xff;
00038 *(outbuffer + offset++) = (sig_distance>>11) & 0xff;
00039 *(outbuffer + offset++) = ((exp_distance<<4) & 0xF0) | ((sig_distance>>19)&0x0F);
00040 *(outbuffer + offset++) = (exp_distance>>4) & 0x7F;
00041 if(this->distance < 0) *(outbuffer + offset -1) |= 0x80;
00042 return offset;
00043 }
00044
00045 virtual int deserialize(unsigned char *inbuffer)
00046 {
00047 int offset = 0;
00048 union {
00049 bool real;
00050 uint8_t base;
00051 } u_result;
00052 u_result.base = 0;
00053 u_result.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00054 this->result = u_result.real;
00055 offset += sizeof(this->result);
00056 uint32_t * val_distance = (uint32_t*) &(this->distance);
00057 offset += 3;
00058 *val_distance = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00059 *val_distance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00060 *val_distance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00061 *val_distance |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00062 uint32_t exp_distance = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00063 exp_distance |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00064 if(exp_distance !=0)
00065 *val_distance |= ((exp_distance)-1023+127)<<23;
00066 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->distance = -this->distance;
00067 return offset;
00068 }
00069
00070 const char * getType(){ return "moveit_msgs/ConstraintEvalResult"; };
00071 const char * getMD5(){ return "093643083d24f6488cb5a868bd47c090"; };
00072
00073 };
00074
00075 }
00076 #endif