Project

General

Profile

Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / geometry_msgs / Point32.h @ c1426757

History | View | Annotate | Download (3.02 KB)

1 c1426757 Tom Mullins
#ifndef _ROS_geometry_msgs_Point32_h
2
#define _ROS_geometry_msgs_Point32_h
3
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
9
namespace geometry_msgs
10
{
11
12
  class Point32 : public ros::Msg
13
  {
14
    public:
15
      float x;
16
      float y;
17
      float z;
18
19
    virtual int serialize(unsigned char *outbuffer) const
20
    {
21
      int offset = 0;
22
      union {
23
        float real;
24
        uint32_t base;
25
      } u_x;
26
      u_x.real = this->x;
27
      *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
28
      *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
29
      *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
30
      *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
31
      offset += sizeof(this->x);
32
      union {
33
        float real;
34
        uint32_t base;
35
      } u_y;
36
      u_y.real = this->y;
37
      *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
38
      *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
39
      *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
40
      *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
41
      offset += sizeof(this->y);
42
      union {
43
        float real;
44
        uint32_t base;
45
      } u_z;
46
      u_z.real = this->z;
47
      *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
48
      *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
49
      *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
50
      *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
51
      offset += sizeof(this->z);
52
      return offset;
53
    }
54
55
    virtual int deserialize(unsigned char *inbuffer)
56
    {
57
      int offset = 0;
58
      union {
59
        float real;
60
        uint32_t base;
61
      } u_x;
62
      u_x.base = 0;
63
      u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
64
      u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
65
      u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
66
      u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
67
      this->x = u_x.real;
68
      offset += sizeof(this->x);
69
      union {
70
        float real;
71
        uint32_t base;
72
      } u_y;
73
      u_y.base = 0;
74
      u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
75
      u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
76
      u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
77
      u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
78
      this->y = u_y.real;
79
      offset += sizeof(this->y);
80
      union {
81
        float real;
82
        uint32_t base;
83
      } u_z;
84
      u_z.base = 0;
85
      u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
86
      u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
87
      u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
88
      u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
89
      this->z = u_z.real;
90
      offset += sizeof(this->z);
91
     return offset;
92
    }
93
94
    const char * getType(){ return "geometry_msgs/Point32"; };
95
    const char * getMD5(){ return "cc153912f1453b708d221682bc23d9ac"; };
96
97
  };
98
99
}
100
#endif