root / quad2 / arduino / src / ros_lib / nav_msgs / MapMetaData.h @ c1426757
History | View | Annotate | Download (4.57 KB)
1 | c1426757 | Tom Mullins | #ifndef _ROS_nav_msgs_MapMetaData_h
|
---|---|---|---|
2 | #define _ROS_nav_msgs_MapMetaData_h
|
||
3 | |||
4 | #include <stdint.h> |
||
5 | #include <string.h> |
||
6 | #include <stdlib.h> |
||
7 | #include "ros/msg.h" |
||
8 | #include "ros/time.h" |
||
9 | #include "geometry_msgs/Pose.h" |
||
10 | |||
11 | namespace nav_msgs |
||
12 | { |
||
13 | |||
14 | class MapMetaData : public ros::Msg |
||
15 | { |
||
16 | public:
|
||
17 | ros::Time map_load_time; |
||
18 | float resolution;
|
||
19 | uint32_t width; |
||
20 | uint32_t height; |
||
21 | geometry_msgs::Pose origin; |
||
22 | |||
23 | virtual int serialize(unsigned char *outbuffer) const |
||
24 | { |
||
25 | int offset = 0; |
||
26 | *(outbuffer + offset + 0) = (this->map_load_time.sec >> (8 * 0)) & 0xFF; |
||
27 | *(outbuffer + offset + 1) = (this->map_load_time.sec >> (8 * 1)) & 0xFF; |
||
28 | *(outbuffer + offset + 2) = (this->map_load_time.sec >> (8 * 2)) & 0xFF; |
||
29 | *(outbuffer + offset + 3) = (this->map_load_time.sec >> (8 * 3)) & 0xFF; |
||
30 | offset += sizeof(this->map_load_time.sec);
|
||
31 | *(outbuffer + offset + 0) = (this->map_load_time.nsec >> (8 * 0)) & 0xFF; |
||
32 | *(outbuffer + offset + 1) = (this->map_load_time.nsec >> (8 * 1)) & 0xFF; |
||
33 | *(outbuffer + offset + 2) = (this->map_load_time.nsec >> (8 * 2)) & 0xFF; |
||
34 | *(outbuffer + offset + 3) = (this->map_load_time.nsec >> (8 * 3)) & 0xFF; |
||
35 | offset += sizeof(this->map_load_time.nsec);
|
||
36 | union {
|
||
37 | float real;
|
||
38 | uint32_t base; |
||
39 | } u_resolution; |
||
40 | u_resolution.real = this->resolution; |
||
41 | *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; |
||
42 | *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; |
||
43 | *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; |
||
44 | *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; |
||
45 | offset += sizeof(this->resolution);
|
||
46 | *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; |
||
47 | *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF; |
||
48 | *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF; |
||
49 | *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF; |
||
50 | offset += sizeof(this->width);
|
||
51 | *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF; |
||
52 | *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF; |
||
53 | *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF; |
||
54 | *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF; |
||
55 | offset += sizeof(this->height);
|
||
56 | offset += this->origin.serialize(outbuffer + offset); |
||
57 | return offset;
|
||
58 | } |
||
59 | |||
60 | virtual int deserialize(unsigned char *inbuffer) |
||
61 | { |
||
62 | int offset = 0; |
||
63 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
64 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
65 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
66 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
67 | offset += sizeof(this->map_load_time.sec);
|
||
68 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
69 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
70 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
71 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
72 | offset += sizeof(this->map_load_time.nsec);
|
||
73 | union {
|
||
74 | float real;
|
||
75 | uint32_t base; |
||
76 | } u_resolution; |
||
77 | u_resolution.base = 0;
|
||
78 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
79 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
80 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
81 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
82 | this->resolution = u_resolution.real; |
||
83 | offset += sizeof(this->resolution);
|
||
84 | this->width |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
85 | this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
86 | this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
87 | this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
88 | offset += sizeof(this->width);
|
||
89 | this->height |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
||
90 | this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
||
91 | this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
||
92 | this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
||
93 | offset += sizeof(this->height);
|
||
94 | offset += this->origin.deserialize(inbuffer + offset); |
||
95 | return offset;
|
||
96 | } |
||
97 | |||
98 | const char * getType(){ return "nav_msgs/MapMetaData"; }; |
||
99 | const char * getMD5(){ return "10cfc8a2818024d3248802c00c95f11b"; }; |
||
100 | |||
101 | }; |
||
102 | |||
103 | } |
||
104 | #endif |