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_std_msgs_Float32_h
nucho 3:1cf99502f396 2 #define _ROS_std_msgs_Float32_h
nucho 3:1cf99502f396 3
nucho 3:1cf99502f396 4 #include <stdint.h>
nucho 3:1cf99502f396 5 #include <string.h>
nucho 3:1cf99502f396 6 #include <stdlib.h>
nucho 3:1cf99502f396 7 #include "ros/msg.h"
nucho 3:1cf99502f396 8
nucho 3:1cf99502f396 9 namespace std_msgs
nucho 3:1cf99502f396 10 {
nucho 3:1cf99502f396 11
nucho 3:1cf99502f396 12 class Float32 : public ros::Msg
nucho 3:1cf99502f396 13 {
nucho 3:1cf99502f396 14 public:
nucho 3:1cf99502f396 15 float data;
nucho 3:1cf99502f396 16
nucho 3:1cf99502f396 17 virtual int serialize(unsigned char *outbuffer) const
nucho 3:1cf99502f396 18 {
nucho 3:1cf99502f396 19 int offset = 0;
nucho 3:1cf99502f396 20 union {
nucho 3:1cf99502f396 21 float real;
nucho 3:1cf99502f396 22 uint32_t base;
nucho 3:1cf99502f396 23 } u_data;
nucho 3:1cf99502f396 24 u_data.real = this->data;
nucho 3:1cf99502f396 25 *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF;
nucho 3:1cf99502f396 26 *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF;
nucho 3:1cf99502f396 27 *(outbuffer + offset + 2) = (u_data.base >> (8 * 2)) & 0xFF;
nucho 3:1cf99502f396 28 *(outbuffer + offset + 3) = (u_data.base >> (8 * 3)) & 0xFF;
nucho 3:1cf99502f396 29 offset += sizeof(this->data);
nucho 3:1cf99502f396 30 return offset;
nucho 3:1cf99502f396 31 }
nucho 3:1cf99502f396 32
nucho 3:1cf99502f396 33 virtual int deserialize(unsigned char *inbuffer)
nucho 3:1cf99502f396 34 {
nucho 3:1cf99502f396 35 int offset = 0;
nucho 3:1cf99502f396 36 union {
nucho 3:1cf99502f396 37 float real;
nucho 3:1cf99502f396 38 uint32_t base;
nucho 3:1cf99502f396 39 } u_data;
nucho 3:1cf99502f396 40 u_data.base = 0;
nucho 3:1cf99502f396 41 u_data.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 3:1cf99502f396 42 u_data.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 3:1cf99502f396 43 u_data.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 3:1cf99502f396 44 u_data.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 3:1cf99502f396 45 this->data = u_data.real;
nucho 3:1cf99502f396 46 offset += sizeof(this->data);
nucho 3:1cf99502f396 47 return offset;
nucho 3:1cf99502f396 48 }
nucho 3:1cf99502f396 49
nucho 3:1cf99502f396 50 virtual const char * getType(){ return "std_msgs/Float32"; };
nucho 3:1cf99502f396 51 virtual const char * getMD5(){ return "73fcbf46b49191e672908e50842a83d4"; };
nucho 3:1cf99502f396 52
nucho 3:1cf99502f396 53 };
nucho 3:1cf99502f396 54
nucho 3:1cf99502f396 55 }
nucho 0:77afd7560544 56 #endif