JointConstraint.h
Go to the documentation of this file.
00001 #ifndef _ROS_moveit_msgs_JointConstraint_h
00002 #define _ROS_moveit_msgs_JointConstraint_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 JointConstraint : public ros::Msg
00013   {
00014     public:
00015       const char* joint_name;
00016       float position;
00017       float tolerance_above;
00018       float tolerance_below;
00019       float weight;
00020 
00021     virtual int serialize(unsigned char *outbuffer) const
00022     {
00023       int offset = 0;
00024       uint32_t length_joint_name = strlen(this->joint_name);
00025       memcpy(outbuffer + offset, &length_joint_name, sizeof(uint32_t));
00026       offset += 4;
00027       memcpy(outbuffer + offset, this->joint_name, length_joint_name);
00028       offset += length_joint_name;
00029       int32_t * val_position = (int32_t *) &(this->position);
00030       int32_t exp_position = (((*val_position)>>23)&255);
00031       if(exp_position != 0)
00032         exp_position += 1023-127;
00033       int32_t sig_position = *val_position;
00034       *(outbuffer + offset++) = 0;
00035       *(outbuffer + offset++) = 0;
00036       *(outbuffer + offset++) = 0;
00037       *(outbuffer + offset++) = (sig_position<<5) & 0xff;
00038       *(outbuffer + offset++) = (sig_position>>3) & 0xff;
00039       *(outbuffer + offset++) = (sig_position>>11) & 0xff;
00040       *(outbuffer + offset++) = ((exp_position<<4) & 0xF0) | ((sig_position>>19)&0x0F);
00041       *(outbuffer + offset++) = (exp_position>>4) & 0x7F;
00042       if(this->position < 0) *(outbuffer + offset -1) |= 0x80;
00043       int32_t * val_tolerance_above = (int32_t *) &(this->tolerance_above);
00044       int32_t exp_tolerance_above = (((*val_tolerance_above)>>23)&255);
00045       if(exp_tolerance_above != 0)
00046         exp_tolerance_above += 1023-127;
00047       int32_t sig_tolerance_above = *val_tolerance_above;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       *(outbuffer + offset++) = 0;
00051       *(outbuffer + offset++) = (sig_tolerance_above<<5) & 0xff;
00052       *(outbuffer + offset++) = (sig_tolerance_above>>3) & 0xff;
00053       *(outbuffer + offset++) = (sig_tolerance_above>>11) & 0xff;
00054       *(outbuffer + offset++) = ((exp_tolerance_above<<4) & 0xF0) | ((sig_tolerance_above>>19)&0x0F);
00055       *(outbuffer + offset++) = (exp_tolerance_above>>4) & 0x7F;
00056       if(this->tolerance_above < 0) *(outbuffer + offset -1) |= 0x80;
00057       int32_t * val_tolerance_below = (int32_t *) &(this->tolerance_below);
00058       int32_t exp_tolerance_below = (((*val_tolerance_below)>>23)&255);
00059       if(exp_tolerance_below != 0)
00060         exp_tolerance_below += 1023-127;
00061       int32_t sig_tolerance_below = *val_tolerance_below;
00062       *(outbuffer + offset++) = 0;
00063       *(outbuffer + offset++) = 0;
00064       *(outbuffer + offset++) = 0;
00065       *(outbuffer + offset++) = (sig_tolerance_below<<5) & 0xff;
00066       *(outbuffer + offset++) = (sig_tolerance_below>>3) & 0xff;
00067       *(outbuffer + offset++) = (sig_tolerance_below>>11) & 0xff;
00068       *(outbuffer + offset++) = ((exp_tolerance_below<<4) & 0xF0) | ((sig_tolerance_below>>19)&0x0F);
00069       *(outbuffer + offset++) = (exp_tolerance_below>>4) & 0x7F;
00070       if(this->tolerance_below < 0) *(outbuffer + offset -1) |= 0x80;
00071       int32_t * val_weight = (int32_t *) &(this->weight);
00072       int32_t exp_weight = (((*val_weight)>>23)&255);
00073       if(exp_weight != 0)
00074         exp_weight += 1023-127;
00075       int32_t sig_weight = *val_weight;
00076       *(outbuffer + offset++) = 0;
00077       *(outbuffer + offset++) = 0;
00078       *(outbuffer + offset++) = 0;
00079       *(outbuffer + offset++) = (sig_weight<<5) & 0xff;
00080       *(outbuffer + offset++) = (sig_weight>>3) & 0xff;
00081       *(outbuffer + offset++) = (sig_weight>>11) & 0xff;
00082       *(outbuffer + offset++) = ((exp_weight<<4) & 0xF0) | ((sig_weight>>19)&0x0F);
00083       *(outbuffer + offset++) = (exp_weight>>4) & 0x7F;
00084       if(this->weight < 0) *(outbuffer + offset -1) |= 0x80;
00085       return offset;
00086     }
00087 
00088     virtual int deserialize(unsigned char *inbuffer)
00089     {
00090       int offset = 0;
00091       uint32_t length_joint_name;
00092       memcpy(&length_joint_name, (inbuffer + offset), sizeof(uint32_t));
00093       offset += 4;
00094       for(unsigned int k= offset; k< offset+length_joint_name; ++k){
00095           inbuffer[k-1]=inbuffer[k];
00096       }
00097       inbuffer[offset+length_joint_name-1]=0;
00098       this->joint_name = (char *)(inbuffer + offset-1);
00099       offset += length_joint_name;
00100       uint32_t * val_position = (uint32_t*) &(this->position);
00101       offset += 3;
00102       *val_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00103       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00104       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00105       *val_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00106       uint32_t exp_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00107       exp_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00108       if(exp_position !=0)
00109         *val_position |= ((exp_position)-1023+127)<<23;
00110       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->position = -this->position;
00111       uint32_t * val_tolerance_above = (uint32_t*) &(this->tolerance_above);
00112       offset += 3;
00113       *val_tolerance_above = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00114       *val_tolerance_above |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00115       *val_tolerance_above |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00116       *val_tolerance_above |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00117       uint32_t exp_tolerance_above = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00118       exp_tolerance_above |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00119       if(exp_tolerance_above !=0)
00120         *val_tolerance_above |= ((exp_tolerance_above)-1023+127)<<23;
00121       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->tolerance_above = -this->tolerance_above;
00122       uint32_t * val_tolerance_below = (uint32_t*) &(this->tolerance_below);
00123       offset += 3;
00124       *val_tolerance_below = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00125       *val_tolerance_below |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00126       *val_tolerance_below |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00127       *val_tolerance_below |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00128       uint32_t exp_tolerance_below = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00129       exp_tolerance_below |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00130       if(exp_tolerance_below !=0)
00131         *val_tolerance_below |= ((exp_tolerance_below)-1023+127)<<23;
00132       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->tolerance_below = -this->tolerance_below;
00133       uint32_t * val_weight = (uint32_t*) &(this->weight);
00134       offset += 3;
00135       *val_weight = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00136       *val_weight |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00137       *val_weight |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00138       *val_weight |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00139       uint32_t exp_weight = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00140       exp_weight |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00141       if(exp_weight !=0)
00142         *val_weight |= ((exp_weight)-1023+127)<<23;
00143       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->weight = -this->weight;
00144      return offset;
00145     }
00146 
00147     const char * getType(){ return "moveit_msgs/JointConstraint"; };
00148     const char * getMD5(){ return "c02a15146bec0ce13564807805b008f0"; };
00149 
00150   };
00151 
00152 }
00153 #endif


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