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_geometry_msgs_Point32_h
nucho 3:1cf99502f396 2 #define _ROS_geometry_msgs_Point32_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
nucho 0:77afd7560544 9 namespace geometry_msgs
nucho 0:77afd7560544 10 {
nucho 0:77afd7560544 11
nucho 0:77afd7560544 12 class Point32 : public ros::Msg
nucho 0:77afd7560544 13 {
nucho 0:77afd7560544 14 public:
nucho 0:77afd7560544 15 float x;
nucho 0:77afd7560544 16 float y;
nucho 0:77afd7560544 17 float z;
nucho 0:77afd7560544 18
nucho 3:1cf99502f396 19 virtual int serialize(unsigned char *outbuffer) const
nucho 0:77afd7560544 20 {
nucho 0:77afd7560544 21 int offset = 0;
nucho 0:77afd7560544 22 union {
nucho 0:77afd7560544 23 float real;
nucho 3:1cf99502f396 24 uint32_t base;
nucho 0:77afd7560544 25 } u_x;
nucho 0:77afd7560544 26 u_x.real = this->x;
nucho 0:77afd7560544 27 *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 28 *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 29 *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 30 *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 31 offset += sizeof(this->x);
nucho 0:77afd7560544 32 union {
nucho 0:77afd7560544 33 float real;
nucho 3:1cf99502f396 34 uint32_t base;
nucho 0:77afd7560544 35 } u_y;
nucho 0:77afd7560544 36 u_y.real = this->y;
nucho 0:77afd7560544 37 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 38 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 39 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 40 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 41 offset += sizeof(this->y);
nucho 0:77afd7560544 42 union {
nucho 0:77afd7560544 43 float real;
nucho 3:1cf99502f396 44 uint32_t base;
nucho 0:77afd7560544 45 } u_z;
nucho 0:77afd7560544 46 u_z.real = this->z;
nucho 0:77afd7560544 47 *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 48 *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 49 *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 50 *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 51 offset += sizeof(this->z);
nucho 0:77afd7560544 52 return offset;
nucho 0:77afd7560544 53 }
nucho 0:77afd7560544 54
nucho 0:77afd7560544 55 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 56 {
nucho 0:77afd7560544 57 int offset = 0;
nucho 0:77afd7560544 58 union {
nucho 0:77afd7560544 59 float real;
nucho 3:1cf99502f396 60 uint32_t base;
nucho 0:77afd7560544 61 } u_x;
nucho 0:77afd7560544 62 u_x.base = 0;
nucho 3:1cf99502f396 63 u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 3:1cf99502f396 64 u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 3:1cf99502f396 65 u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 3:1cf99502f396 66 u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 67 this->x = u_x.real;
nucho 0:77afd7560544 68 offset += sizeof(this->x);
nucho 0:77afd7560544 69 union {
nucho 0:77afd7560544 70 float real;
nucho 3:1cf99502f396 71 uint32_t base;
nucho 0:77afd7560544 72 } u_y;
nucho 0:77afd7560544 73 u_y.base = 0;
nucho 3:1cf99502f396 74 u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 3:1cf99502f396 75 u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 3:1cf99502f396 76 u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 3:1cf99502f396 77 u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 78 this->y = u_y.real;
nucho 0:77afd7560544 79 offset += sizeof(this->y);
nucho 0:77afd7560544 80 union {
nucho 0:77afd7560544 81 float real;
nucho 3:1cf99502f396 82 uint32_t base;
nucho 0:77afd7560544 83 } u_z;
nucho 0:77afd7560544 84 u_z.base = 0;
nucho 3:1cf99502f396 85 u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 3:1cf99502f396 86 u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 3:1cf99502f396 87 u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 3:1cf99502f396 88 u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 89 this->z = u_z.real;
nucho 0:77afd7560544 90 offset += sizeof(this->z);
nucho 0:77afd7560544 91 return offset;
nucho 0:77afd7560544 92 }
nucho 0:77afd7560544 93
nucho 0:77afd7560544 94 virtual const char * getType(){ return "geometry_msgs/Point32"; };
nucho 3:1cf99502f396 95 virtual const char * getMD5(){ return "cc153912f1453b708d221682bc23d9ac"; };
nucho 0:77afd7560544 96
nucho 0:77afd7560544 97 };
nucho 0:77afd7560544 98
nucho 0:77afd7560544 99 }
nucho 0:77afd7560544 100 #endif