FluidPressure.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_FluidPressure_h
00002 #define _ROS_sensor_msgs_FluidPressure_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace sensor_msgs
00011 {
00012 
00013   class FluidPressure : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       float fluid_pressure;
00018       float variance;
00019 
00020     virtual int serialize(unsigned char *outbuffer) const
00021     {
00022       int offset = 0;
00023       offset += this->header.serialize(outbuffer + offset);
00024       int32_t * val_fluid_pressure = (int32_t *) &(this->fluid_pressure);
00025       int32_t exp_fluid_pressure = (((*val_fluid_pressure)>>23)&255);
00026       if(exp_fluid_pressure != 0)
00027         exp_fluid_pressure += 1023-127;
00028       int32_t sig_fluid_pressure = *val_fluid_pressure;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       *(outbuffer + offset++) = (sig_fluid_pressure<<5) & 0xff;
00033       *(outbuffer + offset++) = (sig_fluid_pressure>>3) & 0xff;
00034       *(outbuffer + offset++) = (sig_fluid_pressure>>11) & 0xff;
00035       *(outbuffer + offset++) = ((exp_fluid_pressure<<4) & 0xF0) | ((sig_fluid_pressure>>19)&0x0F);
00036       *(outbuffer + offset++) = (exp_fluid_pressure>>4) & 0x7F;
00037       if(this->fluid_pressure < 0) *(outbuffer + offset -1) |= 0x80;
00038       int32_t * val_variance = (int32_t *) &(this->variance);
00039       int32_t exp_variance = (((*val_variance)>>23)&255);
00040       if(exp_variance != 0)
00041         exp_variance += 1023-127;
00042       int32_t sig_variance = *val_variance;
00043       *(outbuffer + offset++) = 0;
00044       *(outbuffer + offset++) = 0;
00045       *(outbuffer + offset++) = 0;
00046       *(outbuffer + offset++) = (sig_variance<<5) & 0xff;
00047       *(outbuffer + offset++) = (sig_variance>>3) & 0xff;
00048       *(outbuffer + offset++) = (sig_variance>>11) & 0xff;
00049       *(outbuffer + offset++) = ((exp_variance<<4) & 0xF0) | ((sig_variance>>19)&0x0F);
00050       *(outbuffer + offset++) = (exp_variance>>4) & 0x7F;
00051       if(this->variance < 0) *(outbuffer + offset -1) |= 0x80;
00052       return offset;
00053     }
00054 
00055     virtual int deserialize(unsigned char *inbuffer)
00056     {
00057       int offset = 0;
00058       offset += this->header.deserialize(inbuffer + offset);
00059       uint32_t * val_fluid_pressure = (uint32_t*) &(this->fluid_pressure);
00060       offset += 3;
00061       *val_fluid_pressure = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00062       *val_fluid_pressure |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00063       *val_fluid_pressure |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00064       *val_fluid_pressure |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00065       uint32_t exp_fluid_pressure = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00066       exp_fluid_pressure |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00067       if(exp_fluid_pressure !=0)
00068         *val_fluid_pressure |= ((exp_fluid_pressure)-1023+127)<<23;
00069       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->fluid_pressure = -this->fluid_pressure;
00070       uint32_t * val_variance = (uint32_t*) &(this->variance);
00071       offset += 3;
00072       *val_variance = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00073       *val_variance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00074       *val_variance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00075       *val_variance |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00076       uint32_t exp_variance = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00077       exp_variance |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00078       if(exp_variance !=0)
00079         *val_variance |= ((exp_variance)-1023+127)<<23;
00080       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->variance = -this->variance;
00081      return offset;
00082     }
00083 
00084     const char * getType(){ return "sensor_msgs/FluidPressure"; };
00085     const char * getMD5(){ return "804dc5cea1c5306d6a2eb80b9833befe"; };
00086 
00087   };
00088 
00089 }
00090 #endif


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