SetSpeed.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_SetSpeed_h
00002 #define _ROS_SERVICE_SetSpeed_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace dynamixel_controllers
00009 {
00010 
00011 static const char SETSPEED[] = "dynamixel_controllers/SetSpeed";
00012 
00013   class SetSpeedRequest : public ros::Msg
00014   {
00015     public:
00016       float speed;
00017 
00018     virtual int serialize(unsigned char *outbuffer) const
00019     {
00020       int offset = 0;
00021       int32_t * val_speed = (int32_t *) &(this->speed);
00022       int32_t exp_speed = (((*val_speed)>>23)&255);
00023       if(exp_speed != 0)
00024         exp_speed += 1023-127;
00025       int32_t sig_speed = *val_speed;
00026       *(outbuffer + offset++) = 0;
00027       *(outbuffer + offset++) = 0;
00028       *(outbuffer + offset++) = 0;
00029       *(outbuffer + offset++) = (sig_speed<<5) & 0xff;
00030       *(outbuffer + offset++) = (sig_speed>>3) & 0xff;
00031       *(outbuffer + offset++) = (sig_speed>>11) & 0xff;
00032       *(outbuffer + offset++) = ((exp_speed<<4) & 0xF0) | ((sig_speed>>19)&0x0F);
00033       *(outbuffer + offset++) = (exp_speed>>4) & 0x7F;
00034       if(this->speed < 0) *(outbuffer + offset -1) |= 0x80;
00035       return offset;
00036     }
00037 
00038     virtual int deserialize(unsigned char *inbuffer)
00039     {
00040       int offset = 0;
00041       uint32_t * val_speed = (uint32_t*) &(this->speed);
00042       offset += 3;
00043       *val_speed = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00044       *val_speed |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00045       *val_speed |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00046       *val_speed |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00047       uint32_t exp_speed = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00048       exp_speed |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00049       if(exp_speed !=0)
00050         *val_speed |= ((exp_speed)-1023+127)<<23;
00051       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->speed = -this->speed;
00052      return offset;
00053     }
00054 
00055     const char * getType(){ return SETSPEED; };
00056     const char * getMD5(){ return "4641bb0523a3557209606d9bd91ce33a"; };
00057 
00058   };
00059 
00060   class SetSpeedResponse : public ros::Msg
00061   {
00062     public:
00063 
00064     virtual int serialize(unsigned char *outbuffer) const
00065     {
00066       int offset = 0;
00067       return offset;
00068     }
00069 
00070     virtual int deserialize(unsigned char *inbuffer)
00071     {
00072       int offset = 0;
00073      return offset;
00074     }
00075 
00076     const char * getType(){ return SETSPEED; };
00077     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00078 
00079   };
00080 
00081   class SetSpeed {
00082     public:
00083     typedef SetSpeedRequest Request;
00084     typedef SetSpeedResponse Response;
00085   };
00086 
00087 }
00088 #endif


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