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