JointTolerance.h
Go to the documentation of this file.
00001 #ifndef _ROS_control_msgs_JointTolerance_h
00002 #define _ROS_control_msgs_JointTolerance_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace control_msgs
00010 {
00011 
00012   class JointTolerance : public ros::Msg
00013   {
00014     public:
00015       const char* name;
00016       float position;
00017       float velocity;
00018       float acceleration;
00019 
00020     virtual int serialize(unsigned char *outbuffer) const
00021     {
00022       int offset = 0;
00023       uint32_t length_name = strlen(this->name);
00024       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00025       offset += 4;
00026       memcpy(outbuffer + offset, this->name, length_name);
00027       offset += length_name;
00028       int32_t * val_position = (int32_t *) &(this->position);
00029       int32_t exp_position = (((*val_position)>>23)&255);
00030       if(exp_position != 0)
00031         exp_position += 1023-127;
00032       int32_t sig_position = *val_position;
00033       *(outbuffer + offset++) = 0;
00034       *(outbuffer + offset++) = 0;
00035       *(outbuffer + offset++) = 0;
00036       *(outbuffer + offset++) = (sig_position<<5) & 0xff;
00037       *(outbuffer + offset++) = (sig_position>>3) & 0xff;
00038       *(outbuffer + offset++) = (sig_position>>11) & 0xff;
00039       *(outbuffer + offset++) = ((exp_position<<4) & 0xF0) | ((sig_position>>19)&0x0F);
00040       *(outbuffer + offset++) = (exp_position>>4) & 0x7F;
00041       if(this->position < 0) *(outbuffer + offset -1) |= 0x80;
00042       int32_t * val_velocity = (int32_t *) &(this->velocity);
00043       int32_t exp_velocity = (((*val_velocity)>>23)&255);
00044       if(exp_velocity != 0)
00045         exp_velocity += 1023-127;
00046       int32_t sig_velocity = *val_velocity;
00047       *(outbuffer + offset++) = 0;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       *(outbuffer + offset++) = (sig_velocity<<5) & 0xff;
00051       *(outbuffer + offset++) = (sig_velocity>>3) & 0xff;
00052       *(outbuffer + offset++) = (sig_velocity>>11) & 0xff;
00053       *(outbuffer + offset++) = ((exp_velocity<<4) & 0xF0) | ((sig_velocity>>19)&0x0F);
00054       *(outbuffer + offset++) = (exp_velocity>>4) & 0x7F;
00055       if(this->velocity < 0) *(outbuffer + offset -1) |= 0x80;
00056       int32_t * val_acceleration = (int32_t *) &(this->acceleration);
00057       int32_t exp_acceleration = (((*val_acceleration)>>23)&255);
00058       if(exp_acceleration != 0)
00059         exp_acceleration += 1023-127;
00060       int32_t sig_acceleration = *val_acceleration;
00061       *(outbuffer + offset++) = 0;
00062       *(outbuffer + offset++) = 0;
00063       *(outbuffer + offset++) = 0;
00064       *(outbuffer + offset++) = (sig_acceleration<<5) & 0xff;
00065       *(outbuffer + offset++) = (sig_acceleration>>3) & 0xff;
00066       *(outbuffer + offset++) = (sig_acceleration>>11) & 0xff;
00067       *(outbuffer + offset++) = ((exp_acceleration<<4) & 0xF0) | ((sig_acceleration>>19)&0x0F);
00068       *(outbuffer + offset++) = (exp_acceleration>>4) & 0x7F;
00069       if(this->acceleration < 0) *(outbuffer + offset -1) |= 0x80;
00070       return offset;
00071     }
00072 
00073     virtual int deserialize(unsigned char *inbuffer)
00074     {
00075       int offset = 0;
00076       uint32_t length_name;
00077       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00078       offset += 4;
00079       for(unsigned int k= offset; k< offset+length_name; ++k){
00080           inbuffer[k-1]=inbuffer[k];
00081       }
00082       inbuffer[offset+length_name-1]=0;
00083       this->name = (char *)(inbuffer + offset-1);
00084       offset += length_name;
00085       uint32_t * val_position = (uint32_t*) &(this->position);
00086       offset += 3;
00087       *val_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00088       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00089       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00090       *val_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00091       uint32_t exp_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00092       exp_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00093       if(exp_position !=0)
00094         *val_position |= ((exp_position)-1023+127)<<23;
00095       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->position = -this->position;
00096       uint32_t * val_velocity = (uint32_t*) &(this->velocity);
00097       offset += 3;
00098       *val_velocity = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00099       *val_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00100       *val_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00101       *val_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00102       uint32_t exp_velocity = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00103       exp_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00104       if(exp_velocity !=0)
00105         *val_velocity |= ((exp_velocity)-1023+127)<<23;
00106       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->velocity = -this->velocity;
00107       uint32_t * val_acceleration = (uint32_t*) &(this->acceleration);
00108       offset += 3;
00109       *val_acceleration = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00110       *val_acceleration |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00111       *val_acceleration |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00112       *val_acceleration |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00113       uint32_t exp_acceleration = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00114       exp_acceleration |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00115       if(exp_acceleration !=0)
00116         *val_acceleration |= ((exp_acceleration)-1023+127)<<23;
00117       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->acceleration = -this->acceleration;
00118      return offset;
00119     }
00120 
00121     const char * getType(){ return "control_msgs/JointTolerance"; };
00122     const char * getMD5(){ return "f544fe9c16cf04547e135dd6063ff5be"; };
00123 
00124   };
00125 
00126 }
00127 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49