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