Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_SetTorqueLimit_h
00002 #define _ROS_SERVICE_SetTorqueLimit_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 SETTORQUELIMIT[] = "dynamixel_controllers/SetTorqueLimit";
00012
00013 class SetTorqueLimitRequest : public ros::Msg
00014 {
00015 public:
00016 float torque_limit;
00017
00018 virtual int serialize(unsigned char *outbuffer) const
00019 {
00020 int offset = 0;
00021 int32_t * val_torque_limit = (int32_t *) &(this->torque_limit);
00022 int32_t exp_torque_limit = (((*val_torque_limit)>>23)&255);
00023 if(exp_torque_limit != 0)
00024 exp_torque_limit += 1023-127;
00025 int32_t sig_torque_limit = *val_torque_limit;
00026 *(outbuffer + offset++) = 0;
00027 *(outbuffer + offset++) = 0;
00028 *(outbuffer + offset++) = 0;
00029 *(outbuffer + offset++) = (sig_torque_limit<<5) & 0xff;
00030 *(outbuffer + offset++) = (sig_torque_limit>>3) & 0xff;
00031 *(outbuffer + offset++) = (sig_torque_limit>>11) & 0xff;
00032 *(outbuffer + offset++) = ((exp_torque_limit<<4) & 0xF0) | ((sig_torque_limit>>19)&0x0F);
00033 *(outbuffer + offset++) = (exp_torque_limit>>4) & 0x7F;
00034 if(this->torque_limit < 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_torque_limit = (uint32_t*) &(this->torque_limit);
00042 offset += 3;
00043 *val_torque_limit = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00044 *val_torque_limit |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00045 *val_torque_limit |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00046 *val_torque_limit |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00047 uint32_t exp_torque_limit = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00048 exp_torque_limit |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00049 if(exp_torque_limit !=0)
00050 *val_torque_limit |= ((exp_torque_limit)-1023+127)<<23;
00051 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->torque_limit = -this->torque_limit;
00052 return offset;
00053 }
00054
00055 const char * getType(){ return SETTORQUELIMIT; };
00056 const char * getMD5(){ return "7ac67170532bb79d95db2a425915bbd6"; };
00057
00058 };
00059
00060 class SetTorqueLimitResponse : 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 SETTORQUELIMIT; };
00077 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00078
00079 };
00080
00081 class SetTorqueLimit {
00082 public:
00083 typedef SetTorqueLimitRequest Request;
00084 typedef SetTorqueLimitResponse Response;
00085 };
00086
00087 }
00088 #endif