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


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