SingleJointPositionGoal.h
Go to the documentation of this file.
00001 #ifndef _ROS_control_msgs_SingleJointPositionGoal_h
00002 #define _ROS_control_msgs_SingleJointPositionGoal_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/duration.h"
00009 
00010 namespace control_msgs
00011 {
00012 
00013   class SingleJointPositionGoal : public ros::Msg
00014   {
00015     public:
00016       float position;
00017       ros::Duration min_duration;
00018       float max_velocity;
00019 
00020     virtual int serialize(unsigned char *outbuffer) const
00021     {
00022       int offset = 0;
00023       int32_t * val_position = (int32_t *) &(this->position);
00024       int32_t exp_position = (((*val_position)>>23)&255);
00025       if(exp_position != 0)
00026         exp_position += 1023-127;
00027       int32_t sig_position = *val_position;
00028       *(outbuffer + offset++) = 0;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = (sig_position<<5) & 0xff;
00032       *(outbuffer + offset++) = (sig_position>>3) & 0xff;
00033       *(outbuffer + offset++) = (sig_position>>11) & 0xff;
00034       *(outbuffer + offset++) = ((exp_position<<4) & 0xF0) | ((sig_position>>19)&0x0F);
00035       *(outbuffer + offset++) = (exp_position>>4) & 0x7F;
00036       if(this->position < 0) *(outbuffer + offset -1) |= 0x80;
00037       *(outbuffer + offset + 0) = (this->min_duration.sec >> (8 * 0)) & 0xFF;
00038       *(outbuffer + offset + 1) = (this->min_duration.sec >> (8 * 1)) & 0xFF;
00039       *(outbuffer + offset + 2) = (this->min_duration.sec >> (8 * 2)) & 0xFF;
00040       *(outbuffer + offset + 3) = (this->min_duration.sec >> (8 * 3)) & 0xFF;
00041       offset += sizeof(this->min_duration.sec);
00042       *(outbuffer + offset + 0) = (this->min_duration.nsec >> (8 * 0)) & 0xFF;
00043       *(outbuffer + offset + 1) = (this->min_duration.nsec >> (8 * 1)) & 0xFF;
00044       *(outbuffer + offset + 2) = (this->min_duration.nsec >> (8 * 2)) & 0xFF;
00045       *(outbuffer + offset + 3) = (this->min_duration.nsec >> (8 * 3)) & 0xFF;
00046       offset += sizeof(this->min_duration.nsec);
00047       int32_t * val_max_velocity = (int32_t *) &(this->max_velocity);
00048       int32_t exp_max_velocity = (((*val_max_velocity)>>23)&255);
00049       if(exp_max_velocity != 0)
00050         exp_max_velocity += 1023-127;
00051       int32_t sig_max_velocity = *val_max_velocity;
00052       *(outbuffer + offset++) = 0;
00053       *(outbuffer + offset++) = 0;
00054       *(outbuffer + offset++) = 0;
00055       *(outbuffer + offset++) = (sig_max_velocity<<5) & 0xff;
00056       *(outbuffer + offset++) = (sig_max_velocity>>3) & 0xff;
00057       *(outbuffer + offset++) = (sig_max_velocity>>11) & 0xff;
00058       *(outbuffer + offset++) = ((exp_max_velocity<<4) & 0xF0) | ((sig_max_velocity>>19)&0x0F);
00059       *(outbuffer + offset++) = (exp_max_velocity>>4) & 0x7F;
00060       if(this->max_velocity < 0) *(outbuffer + offset -1) |= 0x80;
00061       return offset;
00062     }
00063 
00064     virtual int deserialize(unsigned char *inbuffer)
00065     {
00066       int offset = 0;
00067       uint32_t * val_position = (uint32_t*) &(this->position);
00068       offset += 3;
00069       *val_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00070       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00071       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00072       *val_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00073       uint32_t exp_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00074       exp_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00075       if(exp_position !=0)
00076         *val_position |= ((exp_position)-1023+127)<<23;
00077       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->position = -this->position;
00078       this->min_duration.sec =  ((uint32_t) (*(inbuffer + offset)));
00079       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00080       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00081       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00082       offset += sizeof(this->min_duration.sec);
00083       this->min_duration.nsec =  ((uint32_t) (*(inbuffer + offset)));
00084       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00085       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00086       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00087       offset += sizeof(this->min_duration.nsec);
00088       uint32_t * val_max_velocity = (uint32_t*) &(this->max_velocity);
00089       offset += 3;
00090       *val_max_velocity = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00091       *val_max_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00092       *val_max_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00093       *val_max_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00094       uint32_t exp_max_velocity = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00095       exp_max_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00096       if(exp_max_velocity !=0)
00097         *val_max_velocity |= ((exp_max_velocity)-1023+127)<<23;
00098       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->max_velocity = -this->max_velocity;
00099      return offset;
00100     }
00101 
00102     const char * getType(){ return "control_msgs/SingleJointPositionGoal"; };
00103     const char * getMD5(){ return "fbaaa562a23a013fd5053e5f72cbb35c"; };
00104 
00105   };
00106 
00107 }
00108 #endif


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