SetPidGains.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_SetPidGains_h
00002 #define _ROS_SERVICE_SetPidGains_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace control_toolbox
00009 {
00010 
00011 static const char SETPIDGAINS[] = "control_toolbox/SetPidGains";
00012 
00013   class SetPidGainsRequest : public ros::Msg
00014   {
00015     public:
00016       float p;
00017       float i;
00018       float d;
00019       float i_clamp;
00020 
00021     virtual int serialize(unsigned char *outbuffer) const
00022     {
00023       int offset = 0;
00024       int32_t * val_p = (int32_t *) &(this->p);
00025       int32_t exp_p = (((*val_p)>>23)&255);
00026       if(exp_p != 0)
00027         exp_p += 1023-127;
00028       int32_t sig_p = *val_p;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       *(outbuffer + offset++) = (sig_p<<5) & 0xff;
00033       *(outbuffer + offset++) = (sig_p>>3) & 0xff;
00034       *(outbuffer + offset++) = (sig_p>>11) & 0xff;
00035       *(outbuffer + offset++) = ((exp_p<<4) & 0xF0) | ((sig_p>>19)&0x0F);
00036       *(outbuffer + offset++) = (exp_p>>4) & 0x7F;
00037       if(this->p < 0) *(outbuffer + offset -1) |= 0x80;
00038       int32_t * val_i = (int32_t *) &(this->i);
00039       int32_t exp_i = (((*val_i)>>23)&255);
00040       if(exp_i != 0)
00041         exp_i += 1023-127;
00042       int32_t sig_i = *val_i;
00043       *(outbuffer + offset++) = 0;
00044       *(outbuffer + offset++) = 0;
00045       *(outbuffer + offset++) = 0;
00046       *(outbuffer + offset++) = (sig_i<<5) & 0xff;
00047       *(outbuffer + offset++) = (sig_i>>3) & 0xff;
00048       *(outbuffer + offset++) = (sig_i>>11) & 0xff;
00049       *(outbuffer + offset++) = ((exp_i<<4) & 0xF0) | ((sig_i>>19)&0x0F);
00050       *(outbuffer + offset++) = (exp_i>>4) & 0x7F;
00051       if(this->i < 0) *(outbuffer + offset -1) |= 0x80;
00052       int32_t * val_d = (int32_t *) &(this->d);
00053       int32_t exp_d = (((*val_d)>>23)&255);
00054       if(exp_d != 0)
00055         exp_d += 1023-127;
00056       int32_t sig_d = *val_d;
00057       *(outbuffer + offset++) = 0;
00058       *(outbuffer + offset++) = 0;
00059       *(outbuffer + offset++) = 0;
00060       *(outbuffer + offset++) = (sig_d<<5) & 0xff;
00061       *(outbuffer + offset++) = (sig_d>>3) & 0xff;
00062       *(outbuffer + offset++) = (sig_d>>11) & 0xff;
00063       *(outbuffer + offset++) = ((exp_d<<4) & 0xF0) | ((sig_d>>19)&0x0F);
00064       *(outbuffer + offset++) = (exp_d>>4) & 0x7F;
00065       if(this->d < 0) *(outbuffer + offset -1) |= 0x80;
00066       int32_t * val_i_clamp = (int32_t *) &(this->i_clamp);
00067       int32_t exp_i_clamp = (((*val_i_clamp)>>23)&255);
00068       if(exp_i_clamp != 0)
00069         exp_i_clamp += 1023-127;
00070       int32_t sig_i_clamp = *val_i_clamp;
00071       *(outbuffer + offset++) = 0;
00072       *(outbuffer + offset++) = 0;
00073       *(outbuffer + offset++) = 0;
00074       *(outbuffer + offset++) = (sig_i_clamp<<5) & 0xff;
00075       *(outbuffer + offset++) = (sig_i_clamp>>3) & 0xff;
00076       *(outbuffer + offset++) = (sig_i_clamp>>11) & 0xff;
00077       *(outbuffer + offset++) = ((exp_i_clamp<<4) & 0xF0) | ((sig_i_clamp>>19)&0x0F);
00078       *(outbuffer + offset++) = (exp_i_clamp>>4) & 0x7F;
00079       if(this->i_clamp < 0) *(outbuffer + offset -1) |= 0x80;
00080       return offset;
00081     }
00082 
00083     virtual int deserialize(unsigned char *inbuffer)
00084     {
00085       int offset = 0;
00086       uint32_t * val_p = (uint32_t*) &(this->p);
00087       offset += 3;
00088       *val_p = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00089       *val_p |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00090       *val_p |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00091       *val_p |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00092       uint32_t exp_p = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00093       exp_p |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00094       if(exp_p !=0)
00095         *val_p |= ((exp_p)-1023+127)<<23;
00096       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->p = -this->p;
00097       uint32_t * val_i = (uint32_t*) &(this->i);
00098       offset += 3;
00099       *val_i = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00100       *val_i |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00101       *val_i |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00102       *val_i |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00103       uint32_t exp_i = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00104       exp_i |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00105       if(exp_i !=0)
00106         *val_i |= ((exp_i)-1023+127)<<23;
00107       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->i = -this->i;
00108       uint32_t * val_d = (uint32_t*) &(this->d);
00109       offset += 3;
00110       *val_d = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00111       *val_d |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00112       *val_d |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00113       *val_d |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00114       uint32_t exp_d = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00115       exp_d |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00116       if(exp_d !=0)
00117         *val_d |= ((exp_d)-1023+127)<<23;
00118       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->d = -this->d;
00119       uint32_t * val_i_clamp = (uint32_t*) &(this->i_clamp);
00120       offset += 3;
00121       *val_i_clamp = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00122       *val_i_clamp |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00123       *val_i_clamp |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00124       *val_i_clamp |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00125       uint32_t exp_i_clamp = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00126       exp_i_clamp |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00127       if(exp_i_clamp !=0)
00128         *val_i_clamp |= ((exp_i_clamp)-1023+127)<<23;
00129       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->i_clamp = -this->i_clamp;
00130      return offset;
00131     }
00132 
00133     const char * getType(){ return SETPIDGAINS; };
00134     const char * getMD5(){ return "b06494a6fc3d5b972ded4e2a9a71535a"; };
00135 
00136   };
00137 
00138   class SetPidGainsResponse : public ros::Msg
00139   {
00140     public:
00141 
00142     virtual int serialize(unsigned char *outbuffer) const
00143     {
00144       int offset = 0;
00145       return offset;
00146     }
00147 
00148     virtual int deserialize(unsigned char *inbuffer)
00149     {
00150       int offset = 0;
00151      return offset;
00152     }
00153 
00154     const char * getType(){ return SETPIDGAINS; };
00155     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00156 
00157   };
00158 
00159   class SetPidGains {
00160     public:
00161     typedef SetPidGainsRequest Request;
00162     typedef SetPidGainsResponse Response;
00163   };
00164 
00165 }
00166 #endif


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