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


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