rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
nav_msgs/MapMetaData.h@0:30537dec6e0b, 2015-02-15 (annotated)
- Committer:
- akashvibhute
- Date:
- Sun Feb 15 10:53:43 2015 +0000
- Revision:
- 0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_nav_msgs_MapMetaData_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_nav_msgs_MapMetaData_h |
akashvibhute | 0:30537dec6e0b | 3 | |
akashvibhute | 0:30537dec6e0b | 4 | #include <stdint.h> |
akashvibhute | 0:30537dec6e0b | 5 | #include <string.h> |
akashvibhute | 0:30537dec6e0b | 6 | #include <stdlib.h> |
akashvibhute | 0:30537dec6e0b | 7 | #include "ros/msg.h" |
akashvibhute | 0:30537dec6e0b | 8 | #include "ros/time.h" |
akashvibhute | 0:30537dec6e0b | 9 | #include "geometry_msgs/Pose.h" |
akashvibhute | 0:30537dec6e0b | 10 | |
akashvibhute | 0:30537dec6e0b | 11 | namespace nav_msgs |
akashvibhute | 0:30537dec6e0b | 12 | { |
akashvibhute | 0:30537dec6e0b | 13 | |
akashvibhute | 0:30537dec6e0b | 14 | class MapMetaData : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 15 | { |
akashvibhute | 0:30537dec6e0b | 16 | public: |
akashvibhute | 0:30537dec6e0b | 17 | ros::Time map_load_time; |
akashvibhute | 0:30537dec6e0b | 18 | float resolution; |
akashvibhute | 0:30537dec6e0b | 19 | uint32_t width; |
akashvibhute | 0:30537dec6e0b | 20 | uint32_t height; |
akashvibhute | 0:30537dec6e0b | 21 | geometry_msgs::Pose origin; |
akashvibhute | 0:30537dec6e0b | 22 | |
akashvibhute | 0:30537dec6e0b | 23 | MapMetaData(): |
akashvibhute | 0:30537dec6e0b | 24 | map_load_time(), |
akashvibhute | 0:30537dec6e0b | 25 | resolution(0), |
akashvibhute | 0:30537dec6e0b | 26 | width(0), |
akashvibhute | 0:30537dec6e0b | 27 | height(0), |
akashvibhute | 0:30537dec6e0b | 28 | origin() |
akashvibhute | 0:30537dec6e0b | 29 | { |
akashvibhute | 0:30537dec6e0b | 30 | } |
akashvibhute | 0:30537dec6e0b | 31 | |
akashvibhute | 0:30537dec6e0b | 32 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 33 | { |
akashvibhute | 0:30537dec6e0b | 34 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 35 | *(outbuffer + offset + 0) = (this->map_load_time.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 36 | *(outbuffer + offset + 1) = (this->map_load_time.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 37 | *(outbuffer + offset + 2) = (this->map_load_time.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 38 | *(outbuffer + offset + 3) = (this->map_load_time.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 39 | offset += sizeof(this->map_load_time.sec); |
akashvibhute | 0:30537dec6e0b | 40 | *(outbuffer + offset + 0) = (this->map_load_time.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 41 | *(outbuffer + offset + 1) = (this->map_load_time.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 42 | *(outbuffer + offset + 2) = (this->map_load_time.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 43 | *(outbuffer + offset + 3) = (this->map_load_time.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 44 | offset += sizeof(this->map_load_time.nsec); |
akashvibhute | 0:30537dec6e0b | 45 | union { |
akashvibhute | 0:30537dec6e0b | 46 | float real; |
akashvibhute | 0:30537dec6e0b | 47 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 48 | } u_resolution; |
akashvibhute | 0:30537dec6e0b | 49 | u_resolution.real = this->resolution; |
akashvibhute | 0:30537dec6e0b | 50 | *(outbuffer + offset + 0) = (u_resolution.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 51 | *(outbuffer + offset + 1) = (u_resolution.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 52 | *(outbuffer + offset + 2) = (u_resolution.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 53 | *(outbuffer + offset + 3) = (u_resolution.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 54 | offset += sizeof(this->resolution); |
akashvibhute | 0:30537dec6e0b | 55 | *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 56 | *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 57 | *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 58 | *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 59 | offset += sizeof(this->width); |
akashvibhute | 0:30537dec6e0b | 60 | *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 61 | *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 62 | *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 63 | *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 64 | offset += sizeof(this->height); |
akashvibhute | 0:30537dec6e0b | 65 | offset += this->origin.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 66 | return offset; |
akashvibhute | 0:30537dec6e0b | 67 | } |
akashvibhute | 0:30537dec6e0b | 68 | |
akashvibhute | 0:30537dec6e0b | 69 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 70 | { |
akashvibhute | 0:30537dec6e0b | 71 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 72 | this->map_load_time.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 73 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 74 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 75 | this->map_load_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 76 | offset += sizeof(this->map_load_time.sec); |
akashvibhute | 0:30537dec6e0b | 77 | this->map_load_time.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 78 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 79 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 80 | this->map_load_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 81 | offset += sizeof(this->map_load_time.nsec); |
akashvibhute | 0:30537dec6e0b | 82 | union { |
akashvibhute | 0:30537dec6e0b | 83 | float real; |
akashvibhute | 0:30537dec6e0b | 84 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 85 | } u_resolution; |
akashvibhute | 0:30537dec6e0b | 86 | u_resolution.base = 0; |
akashvibhute | 0:30537dec6e0b | 87 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 88 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 89 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 90 | u_resolution.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 91 | this->resolution = u_resolution.real; |
akashvibhute | 0:30537dec6e0b | 92 | offset += sizeof(this->resolution); |
akashvibhute | 0:30537dec6e0b | 93 | this->width = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 94 | this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 95 | this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 96 | this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 97 | offset += sizeof(this->width); |
akashvibhute | 0:30537dec6e0b | 98 | this->height = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 99 | this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 100 | this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 101 | this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 102 | offset += sizeof(this->height); |
akashvibhute | 0:30537dec6e0b | 103 | offset += this->origin.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 104 | return offset; |
akashvibhute | 0:30537dec6e0b | 105 | } |
akashvibhute | 0:30537dec6e0b | 106 | |
akashvibhute | 0:30537dec6e0b | 107 | const char * getType(){ return "nav_msgs/MapMetaData"; }; |
akashvibhute | 0:30537dec6e0b | 108 | const char * getMD5(){ return "10cfc8a2818024d3248802c00c95f11b"; }; |
akashvibhute | 0:30537dec6e0b | 109 | |
akashvibhute | 0:30537dec6e0b | 110 | }; |
akashvibhute | 0:30537dec6e0b | 111 | |
akashvibhute | 0:30537dec6e0b | 112 | } |
akashvibhute | 0:30537dec6e0b | 113 | #endif |