This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

Committer:
nucho
Date:
Wed Feb 29 23:00:21 2012 +0000
Revision:
4:684f39d0c346
Parent:
3:1cf99502f396

        

Who changed what in which revision?

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