Go to the documentation of this file.00001 #ifndef _ROS_sensor_msgs_Range_h
00002 #define _ROS_sensor_msgs_Range_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 Range : public ros::Msg
00014 {
00015 public:
00016 std_msgs::Header header;
00017 uint8_t radiation_type;
00018 float field_of_view;
00019 float min_range;
00020 float max_range;
00021 float range;
00022 enum { ULTRASOUND = 0 };
00023 enum { INFRARED = 1 };
00024
00025 virtual int serialize(unsigned char *outbuffer) const
00026 {
00027 int offset = 0;
00028 offset += this->header.serialize(outbuffer + offset);
00029 *(outbuffer + offset + 0) = (this->radiation_type >> (8 * 0)) & 0xFF;
00030 offset += sizeof(this->radiation_type);
00031 union {
00032 float real;
00033 uint32_t base;
00034 } u_field_of_view;
00035 u_field_of_view.real = this->field_of_view;
00036 *(outbuffer + offset + 0) = (u_field_of_view.base >> (8 * 0)) & 0xFF;
00037 *(outbuffer + offset + 1) = (u_field_of_view.base >> (8 * 1)) & 0xFF;
00038 *(outbuffer + offset + 2) = (u_field_of_view.base >> (8 * 2)) & 0xFF;
00039 *(outbuffer + offset + 3) = (u_field_of_view.base >> (8 * 3)) & 0xFF;
00040 offset += sizeof(this->field_of_view);
00041 union {
00042 float real;
00043 uint32_t base;
00044 } u_min_range;
00045 u_min_range.real = this->min_range;
00046 *(outbuffer + offset + 0) = (u_min_range.base >> (8 * 0)) & 0xFF;
00047 *(outbuffer + offset + 1) = (u_min_range.base >> (8 * 1)) & 0xFF;
00048 *(outbuffer + offset + 2) = (u_min_range.base >> (8 * 2)) & 0xFF;
00049 *(outbuffer + offset + 3) = (u_min_range.base >> (8 * 3)) & 0xFF;
00050 offset += sizeof(this->min_range);
00051 union {
00052 float real;
00053 uint32_t base;
00054 } u_max_range;
00055 u_max_range.real = this->max_range;
00056 *(outbuffer + offset + 0) = (u_max_range.base >> (8 * 0)) & 0xFF;
00057 *(outbuffer + offset + 1) = (u_max_range.base >> (8 * 1)) & 0xFF;
00058 *(outbuffer + offset + 2) = (u_max_range.base >> (8 * 2)) & 0xFF;
00059 *(outbuffer + offset + 3) = (u_max_range.base >> (8 * 3)) & 0xFF;
00060 offset += sizeof(this->max_range);
00061 union {
00062 float real;
00063 uint32_t base;
00064 } u_range;
00065 u_range.real = this->range;
00066 *(outbuffer + offset + 0) = (u_range.base >> (8 * 0)) & 0xFF;
00067 *(outbuffer + offset + 1) = (u_range.base >> (8 * 1)) & 0xFF;
00068 *(outbuffer + offset + 2) = (u_range.base >> (8 * 2)) & 0xFF;
00069 *(outbuffer + offset + 3) = (u_range.base >> (8 * 3)) & 0xFF;
00070 offset += sizeof(this->range);
00071 return offset;
00072 }
00073
00074 virtual int deserialize(unsigned char *inbuffer)
00075 {
00076 int offset = 0;
00077 offset += this->header.deserialize(inbuffer + offset);
00078 this->radiation_type = ((uint8_t) (*(inbuffer + offset)));
00079 offset += sizeof(this->radiation_type);
00080 union {
00081 float real;
00082 uint32_t base;
00083 } u_field_of_view;
00084 u_field_of_view.base = 0;
00085 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00086 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00087 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00088 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00089 this->field_of_view = u_field_of_view.real;
00090 offset += sizeof(this->field_of_view);
00091 union {
00092 float real;
00093 uint32_t base;
00094 } u_min_range;
00095 u_min_range.base = 0;
00096 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00097 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00098 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00099 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00100 this->min_range = u_min_range.real;
00101 offset += sizeof(this->min_range);
00102 union {
00103 float real;
00104 uint32_t base;
00105 } u_max_range;
00106 u_max_range.base = 0;
00107 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00108 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00109 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00110 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00111 this->max_range = u_max_range.real;
00112 offset += sizeof(this->max_range);
00113 union {
00114 float real;
00115 uint32_t base;
00116 } u_range;
00117 u_range.base = 0;
00118 u_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00119 u_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00120 u_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00121 u_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00122 this->range = u_range.real;
00123 offset += sizeof(this->range);
00124 return offset;
00125 }
00126
00127 const char * getType(){ return "sensor_msgs/Range"; };
00128 const char * getMD5(){ return "c005c34273dc426c67a020a87bc24148"; };
00129
00130 };
00131
00132 }
00133 #endif