ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/nav_msgs/MapMetaData.h@0:020db18a476d, 2019-10-30 (annotated)
- Committer:
- scarter1
- Date:
- Wed Oct 30 14:59:49 2019 +0000
- Revision:
- 0:020db18a476d
melodic library;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_nav_msgs_MapMetaData_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_nav_msgs_MapMetaData_h |
scarter1 | 0:020db18a476d | 3 | |
scarter1 | 0:020db18a476d | 4 | #include <stdint.h> |
scarter1 | 0:020db18a476d | 5 | #include <string.h> |
scarter1 | 0:020db18a476d | 6 | #include <stdlib.h> |
scarter1 | 0:020db18a476d | 7 | #include "ros/msg.h" |
scarter1 | 0:020db18a476d | 8 | #include "ros/time.h" |
scarter1 | 0:020db18a476d | 9 | #include "geometry_msgs/Pose.h" |
scarter1 | 0:020db18a476d | 10 | |
scarter1 | 0:020db18a476d | 11 | namespace nav_msgs |
scarter1 | 0:020db18a476d | 12 | { |
scarter1 | 0:020db18a476d | 13 | |
scarter1 | 0:020db18a476d | 14 | class MapMetaData : public ros::Msg |
scarter1 | 0:020db18a476d | 15 | { |
scarter1 | 0:020db18a476d | 16 | public: |
scarter1 | 0:020db18a476d | 17 | typedef ros::Time _map_load_time_type; |
scarter1 | 0:020db18a476d | 18 | _map_load_time_type map_load_time; |
scarter1 | 0:020db18a476d | 19 | typedef float _resolution_type; |
scarter1 | 0:020db18a476d | 20 | _resolution_type resolution; |
scarter1 | 0:020db18a476d | 21 | typedef uint32_t _width_type; |
scarter1 | 0:020db18a476d | 22 | _width_type width; |
scarter1 | 0:020db18a476d | 23 | typedef uint32_t _height_type; |
scarter1 | 0:020db18a476d | 24 | _height_type height; |
scarter1 | 0:020db18a476d | 25 | typedef geometry_msgs::Pose _origin_type; |
scarter1 | 0:020db18a476d | 26 | _origin_type origin; |
scarter1 | 0:020db18a476d | 27 | |
scarter1 | 0:020db18a476d | 28 | MapMetaData(): |
scarter1 | 0:020db18a476d | 29 | map_load_time(), |
scarter1 | 0:020db18a476d | 30 | resolution(0), |
scarter1 | 0:020db18a476d | 31 | width(0), |
scarter1 | 0:020db18a476d | 32 | height(0), |
scarter1 | 0:020db18a476d | 33 | origin() |
scarter1 | 0:020db18a476d | 34 | { |
scarter1 | 0:020db18a476d | 35 | } |
scarter1 | 0:020db18a476d | 36 | |
scarter1 | 0:020db18a476d | 37 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 38 | { |
scarter1 | 0:020db18a476d | 39 | int offset = 0; |
scarter1 | 0:020db18a476d | 40 | *(outbuffer + offset + 0) = (this->map_load_time.sec >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 41 | *(outbuffer + offset + 1) = (this->map_load_time.sec >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 42 | *(outbuffer + offset + 2) = (this->map_load_time.sec >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 43 | *(outbuffer + offset + 3) = (this->map_load_time.sec >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 44 | offset += sizeof(this->map_load_time.sec); |
scarter1 | 0:020db18a476d | 45 | *(outbuffer + offset + 0) = (this->map_load_time.nsec >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 46 | *(outbuffer + offset + 1) = (this->map_load_time.nsec >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 47 | *(outbuffer + offset + 2) = (this->map_load_time.nsec >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 48 | *(outbuffer + offset + 3) = (this->map_load_time.nsec >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 49 | offset += sizeof(this->map_load_time.nsec); |
scarter1 | 0:020db18a476d | 50 | union { |
scarter1 | 0:020db18a476d | 51 | float real; |
scarter1 | 0:020db18a476d | 52 | uint32_t base; |
scarter1 | 0:020db18a476d | 53 | } u_resolution; |
scarter1 | 0:020db18a476d | 54 | u_resolution.real = this->resolution; |
scarter1 | 0:020db18a476d | 55 | *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 56 | *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 57 | *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 58 | *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 59 | offset += sizeof(this->resolution); |
scarter1 | 0:020db18a476d | 60 | *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 61 | *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 62 | *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 63 | *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 64 | offset += sizeof(this->width); |
scarter1 | 0:020db18a476d | 65 | *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 66 | *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 67 | *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 68 | *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 69 | offset += sizeof(this->height); |
scarter1 | 0:020db18a476d | 70 | offset += this->origin.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 71 | return offset; |
scarter1 | 0:020db18a476d | 72 | } |
scarter1 | 0:020db18a476d | 73 | |
scarter1 | 0:020db18a476d | 74 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 75 | { |
scarter1 | 0:020db18a476d | 76 | int offset = 0; |
scarter1 | 0:020db18a476d | 77 | this->map_load_time.sec = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 78 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 79 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 80 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 81 | offset += sizeof(this->map_load_time.sec); |
scarter1 | 0:020db18a476d | 82 | this->map_load_time.nsec = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 83 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 84 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 85 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 86 | offset += sizeof(this->map_load_time.nsec); |
scarter1 | 0:020db18a476d | 87 | union { |
scarter1 | 0:020db18a476d | 88 | float real; |
scarter1 | 0:020db18a476d | 89 | uint32_t base; |
scarter1 | 0:020db18a476d | 90 | } u_resolution; |
scarter1 | 0:020db18a476d | 91 | u_resolution.base = 0; |
scarter1 | 0:020db18a476d | 92 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 93 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 94 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 95 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 96 | this->resolution = u_resolution.real; |
scarter1 | 0:020db18a476d | 97 | offset += sizeof(this->resolution); |
scarter1 | 0:020db18a476d | 98 | this->width = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 99 | this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 100 | this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 101 | this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 102 | offset += sizeof(this->width); |
scarter1 | 0:020db18a476d | 103 | this->height = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 104 | this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 105 | this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 106 | this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 107 | offset += sizeof(this->height); |
scarter1 | 0:020db18a476d | 108 | offset += this->origin.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 109 | return offset; |
scarter1 | 0:020db18a476d | 110 | } |
scarter1 | 0:020db18a476d | 111 | |
scarter1 | 0:020db18a476d | 112 | const char * getType(){ return "nav_msgs/MapMetaData"; }; |
scarter1 | 0:020db18a476d | 113 | const char * getMD5(){ return "10cfc8a2818024d3248802c00c95f11b"; }; |
scarter1 | 0:020db18a476d | 114 | |
scarter1 | 0:020db18a476d | 115 | }; |
scarter1 | 0:020db18a476d | 116 | |
scarter1 | 0:020db18a476d | 117 | } |
scarter1 | 0:020db18a476d | 118 | #endif |