Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / sensor_msgs / Range.h @ c1426757

History | View | Annotate | Download (4.89 KB)

1
#ifndef _ROS_sensor_msgs_Range_h
2
#define _ROS_sensor_msgs_Range_h
3

    
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
#include "std_msgs/Header.h"
9

    
10
namespace sensor_msgs
11
{
12

    
13
  class Range : public ros::Msg
14
  {
15
    public:
16
      std_msgs::Header header;
17
      uint8_t radiation_type;
18
      float field_of_view;
19
      float min_range;
20
      float max_range;
21
      float range;
22
      enum { ULTRASOUND = 0 };
23
      enum { INFRARED = 1 };
24

    
25
    virtual int serialize(unsigned char *outbuffer) const
26
    {
27
      int offset = 0;
28
      offset += this->header.serialize(outbuffer + offset);
29
      *(outbuffer + offset + 0) = (this->radiation_type >> (8 * 0)) & 0xFF;
30
      offset += sizeof(this->radiation_type);
31
      union {
32
        float real;
33
        uint32_t base;
34
      } u_field_of_view;
35
      u_field_of_view.real = this->field_of_view;
36
      *(outbuffer + offset + 0) = (u_field_of_view.base >> (8 * 0)) & 0xFF;
37
      *(outbuffer + offset + 1) = (u_field_of_view.base >> (8 * 1)) & 0xFF;
38
      *(outbuffer + offset + 2) = (u_field_of_view.base >> (8 * 2)) & 0xFF;
39
      *(outbuffer + offset + 3) = (u_field_of_view.base >> (8 * 3)) & 0xFF;
40
      offset += sizeof(this->field_of_view);
41
      union {
42
        float real;
43
        uint32_t base;
44
      } u_min_range;
45
      u_min_range.real = this->min_range;
46
      *(outbuffer + offset + 0) = (u_min_range.base >> (8 * 0)) & 0xFF;
47
      *(outbuffer + offset + 1) = (u_min_range.base >> (8 * 1)) & 0xFF;
48
      *(outbuffer + offset + 2) = (u_min_range.base >> (8 * 2)) & 0xFF;
49
      *(outbuffer + offset + 3) = (u_min_range.base >> (8 * 3)) & 0xFF;
50
      offset += sizeof(this->min_range);
51
      union {
52
        float real;
53
        uint32_t base;
54
      } u_max_range;
55
      u_max_range.real = this->max_range;
56
      *(outbuffer + offset + 0) = (u_max_range.base >> (8 * 0)) & 0xFF;
57
      *(outbuffer + offset + 1) = (u_max_range.base >> (8 * 1)) & 0xFF;
58
      *(outbuffer + offset + 2) = (u_max_range.base >> (8 * 2)) & 0xFF;
59
      *(outbuffer + offset + 3) = (u_max_range.base >> (8 * 3)) & 0xFF;
60
      offset += sizeof(this->max_range);
61
      union {
62
        float real;
63
        uint32_t base;
64
      } u_range;
65
      u_range.real = this->range;
66
      *(outbuffer + offset + 0) = (u_range.base >> (8 * 0)) & 0xFF;
67
      *(outbuffer + offset + 1) = (u_range.base >> (8 * 1)) & 0xFF;
68
      *(outbuffer + offset + 2) = (u_range.base >> (8 * 2)) & 0xFF;
69
      *(outbuffer + offset + 3) = (u_range.base >> (8 * 3)) & 0xFF;
70
      offset += sizeof(this->range);
71
      return offset;
72
    }
73

    
74
    virtual int deserialize(unsigned char *inbuffer)
75
    {
76
      int offset = 0;
77
      offset += this->header.deserialize(inbuffer + offset);
78
      this->radiation_type |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
79
      offset += sizeof(this->radiation_type);
80
      union {
81
        float real;
82
        uint32_t base;
83
      } u_field_of_view;
84
      u_field_of_view.base = 0;
85
      u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
86
      u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
87
      u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
88
      u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
89
      this->field_of_view = u_field_of_view.real;
90
      offset += sizeof(this->field_of_view);
91
      union {
92
        float real;
93
        uint32_t base;
94
      } u_min_range;
95
      u_min_range.base = 0;
96
      u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
97
      u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
98
      u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
99
      u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
100
      this->min_range = u_min_range.real;
101
      offset += sizeof(this->min_range);
102
      union {
103
        float real;
104
        uint32_t base;
105
      } u_max_range;
106
      u_max_range.base = 0;
107
      u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
108
      u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
109
      u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
110
      u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
111
      this->max_range = u_max_range.real;
112
      offset += sizeof(this->max_range);
113
      union {
114
        float real;
115
        uint32_t base;
116
      } u_range;
117
      u_range.base = 0;
118
      u_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
119
      u_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
120
      u_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
121
      u_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
122
      this->range = u_range.real;
123
      offset += sizeof(this->range);
124
     return offset;
125
    }
126

    
127
    const char * getType(){ return "sensor_msgs/Range"; };
128
    const char * getMD5(){ return "c005c34273dc426c67a020a87bc24148"; };
129

    
130
  };
131

    
132
}
133
#endif