PositionConstraint.h
Go to the documentation of this file.
00001 #ifndef _ROS_moveit_msgs_PositionConstraint_h
00002 #define _ROS_moveit_msgs_PositionConstraint_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "geometry_msgs/Vector3.h"
00010 #include "moveit_msgs/BoundingVolume.h"
00011 
00012 namespace moveit_msgs
00013 {
00014 
00015   class PositionConstraint : public ros::Msg
00016   {
00017     public:
00018       std_msgs::Header header;
00019       const char* link_name;
00020       geometry_msgs::Vector3 target_point_offset;
00021       moveit_msgs::BoundingVolume constraint_region;
00022       float weight;
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       offset += this->header.serialize(outbuffer + offset);
00028       uint32_t length_link_name = strlen(this->link_name);
00029       memcpy(outbuffer + offset, &length_link_name, sizeof(uint32_t));
00030       offset += 4;
00031       memcpy(outbuffer + offset, this->link_name, length_link_name);
00032       offset += length_link_name;
00033       offset += this->target_point_offset.serialize(outbuffer + offset);
00034       offset += this->constraint_region.serialize(outbuffer + offset);
00035       int32_t * val_weight = (int32_t *) &(this->weight);
00036       int32_t exp_weight = (((*val_weight)>>23)&255);
00037       if(exp_weight != 0)
00038         exp_weight += 1023-127;
00039       int32_t sig_weight = *val_weight;
00040       *(outbuffer + offset++) = 0;
00041       *(outbuffer + offset++) = 0;
00042       *(outbuffer + offset++) = 0;
00043       *(outbuffer + offset++) = (sig_weight<<5) & 0xff;
00044       *(outbuffer + offset++) = (sig_weight>>3) & 0xff;
00045       *(outbuffer + offset++) = (sig_weight>>11) & 0xff;
00046       *(outbuffer + offset++) = ((exp_weight<<4) & 0xF0) | ((sig_weight>>19)&0x0F);
00047       *(outbuffer + offset++) = (exp_weight>>4) & 0x7F;
00048       if(this->weight < 0) *(outbuffer + offset -1) |= 0x80;
00049       return offset;
00050     }
00051 
00052     virtual int deserialize(unsigned char *inbuffer)
00053     {
00054       int offset = 0;
00055       offset += this->header.deserialize(inbuffer + offset);
00056       uint32_t length_link_name;
00057       memcpy(&length_link_name, (inbuffer + offset), sizeof(uint32_t));
00058       offset += 4;
00059       for(unsigned int k= offset; k< offset+length_link_name; ++k){
00060           inbuffer[k-1]=inbuffer[k];
00061       }
00062       inbuffer[offset+length_link_name-1]=0;
00063       this->link_name = (char *)(inbuffer + offset-1);
00064       offset += length_link_name;
00065       offset += this->target_point_offset.deserialize(inbuffer + offset);
00066       offset += this->constraint_region.deserialize(inbuffer + offset);
00067       uint32_t * val_weight = (uint32_t*) &(this->weight);
00068       offset += 3;
00069       *val_weight = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00070       *val_weight |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00071       *val_weight |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00072       *val_weight |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00073       uint32_t exp_weight = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00074       exp_weight |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00075       if(exp_weight !=0)
00076         *val_weight |= ((exp_weight)-1023+127)<<23;
00077       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->weight = -this->weight;
00078      return offset;
00079     }
00080 
00081     const char * getType(){ return "moveit_msgs/PositionConstraint"; };
00082     const char * getMD5(){ return "c83edf208d87d3aa3169f47775a58e6a"; };
00083 
00084   };
00085 
00086 }
00087 #endif


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