Go to the documentation of this file.00001 #ifndef _ROS_sensor_msgs_Temperature_h
00002 #define _ROS_sensor_msgs_Temperature_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 Temperature : public ros::Msg
00014 {
00015 public:
00016 std_msgs::Header header;
00017 float temperature;
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_temperature = (int32_t *) &(this->temperature);
00025 int32_t exp_temperature = (((*val_temperature)>>23)&255);
00026 if(exp_temperature != 0)
00027 exp_temperature += 1023-127;
00028 int32_t sig_temperature = *val_temperature;
00029 *(outbuffer + offset++) = 0;
00030 *(outbuffer + offset++) = 0;
00031 *(outbuffer + offset++) = 0;
00032 *(outbuffer + offset++) = (sig_temperature<<5) & 0xff;
00033 *(outbuffer + offset++) = (sig_temperature>>3) & 0xff;
00034 *(outbuffer + offset++) = (sig_temperature>>11) & 0xff;
00035 *(outbuffer + offset++) = ((exp_temperature<<4) & 0xF0) | ((sig_temperature>>19)&0x0F);
00036 *(outbuffer + offset++) = (exp_temperature>>4) & 0x7F;
00037 if(this->temperature < 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_temperature = (uint32_t*) &(this->temperature);
00060 offset += 3;
00061 *val_temperature = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00062 *val_temperature |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00063 *val_temperature |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00064 *val_temperature |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00065 uint32_t exp_temperature = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00066 exp_temperature |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00067 if(exp_temperature !=0)
00068 *val_temperature |= ((exp_temperature)-1023+127)<<23;
00069 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->temperature = -this->temperature;
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/Temperature"; };
00085 const char * getMD5(){ return "ff71b307acdbe7c871a5a6d7ed359100"; };
00086
00087 };
00088
00089 }
00090 #endif