Plane.h
Go to the documentation of this file.
00001 #ifndef _ROS_shape_msgs_Plane_h
00002 #define _ROS_shape_msgs_Plane_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace shape_msgs
00010 {
00011 
00012   class Plane : public ros::Msg
00013   {
00014     public:
00015       float coef[4];
00016 
00017     virtual int serialize(unsigned char *outbuffer) const
00018     {
00019       int offset = 0;
00020       unsigned char * coef_val = (unsigned char *) this->coef;
00021       for( uint8_t i = 0; i < 4; i++){
00022       int32_t * val_coefi = (int32_t *) &(this->coef[i]);
00023       int32_t exp_coefi = (((*val_coefi)>>23)&255);
00024       if(exp_coefi != 0)
00025         exp_coefi += 1023-127;
00026       int32_t sig_coefi = *val_coefi;
00027       *(outbuffer + offset++) = 0;
00028       *(outbuffer + offset++) = 0;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = (sig_coefi<<5) & 0xff;
00031       *(outbuffer + offset++) = (sig_coefi>>3) & 0xff;
00032       *(outbuffer + offset++) = (sig_coefi>>11) & 0xff;
00033       *(outbuffer + offset++) = ((exp_coefi<<4) & 0xF0) | ((sig_coefi>>19)&0x0F);
00034       *(outbuffer + offset++) = (exp_coefi>>4) & 0x7F;
00035       if(this->coef[i] < 0) *(outbuffer + offset -1) |= 0x80;
00036       }
00037       return offset;
00038     }
00039 
00040     virtual int deserialize(unsigned char *inbuffer)
00041     {
00042       int offset = 0;
00043       uint8_t * coef_val = (uint8_t*) this->coef;
00044       for( uint8_t i = 0; i < 4; i++){
00045       uint32_t * val_coefi = (uint32_t*) &(this->coef[i]);
00046       offset += 3;
00047       *val_coefi = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00048       *val_coefi |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00049       *val_coefi |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00050       *val_coefi |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00051       uint32_t exp_coefi = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00052       exp_coefi |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00053       if(exp_coefi !=0)
00054         *val_coefi |= ((exp_coefi)-1023+127)<<23;
00055       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->coef[i] = -this->coef[i];
00056       }
00057      return offset;
00058     }
00059 
00060     const char * getType(){ return "shape_msgs/Plane"; };
00061     const char * getMD5(){ return "2c1b92ed8f31492f8e73f6a4a44ca796"; };
00062 
00063   };
00064 
00065 }
00066 #endif


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:22