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:
Fri Aug 19 09:06:30 2011 +0000
Revision:
0:77afd7560544
Child:
3:1cf99502f396

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 0:77afd7560544 1 #ifndef ros_SERVICE_GetPlan_h
nucho 0:77afd7560544 2 #define ros_SERVICE_GetPlan_h
nucho 0:77afd7560544 3 #include <stdint.h>
nucho 0:77afd7560544 4 #include <string.h>
nucho 0:77afd7560544 5 #include <stdlib.h>
nucho 0:77afd7560544 6 #include "../ros/msg.h"
nucho 0:77afd7560544 7 #include "geometry_msgs/PoseStamped.h"
nucho 0:77afd7560544 8 #include "nav_msgs/Path.h"
nucho 0:77afd7560544 9
nucho 0:77afd7560544 10 namespace nav_msgs
nucho 0:77afd7560544 11 {
nucho 0:77afd7560544 12
nucho 0:77afd7560544 13 static const char GETPLAN[] = "nav_msgs/GetPlan";
nucho 0:77afd7560544 14
nucho 0:77afd7560544 15 class GetPlanRequest : public ros::Msg
nucho 0:77afd7560544 16 {
nucho 0:77afd7560544 17 public:
nucho 0:77afd7560544 18 geometry_msgs::PoseStamped start;
nucho 0:77afd7560544 19 geometry_msgs::PoseStamped goal;
nucho 0:77afd7560544 20 float tolerance;
nucho 0:77afd7560544 21
nucho 0:77afd7560544 22 virtual int serialize(unsigned char *outbuffer)
nucho 0:77afd7560544 23 {
nucho 0:77afd7560544 24 int offset = 0;
nucho 0:77afd7560544 25 offset += this->start.serialize(outbuffer + offset);
nucho 0:77afd7560544 26 offset += this->goal.serialize(outbuffer + offset);
nucho 0:77afd7560544 27 union {
nucho 0:77afd7560544 28 float real;
nucho 0:77afd7560544 29 unsigned long base;
nucho 0:77afd7560544 30 } u_tolerance;
nucho 0:77afd7560544 31 u_tolerance.real = this->tolerance;
nucho 0:77afd7560544 32 *(outbuffer + offset + 0) = (u_tolerance.base >> (8 * 0)) & 0xFF;
nucho 0:77afd7560544 33 *(outbuffer + offset + 1) = (u_tolerance.base >> (8 * 1)) & 0xFF;
nucho 0:77afd7560544 34 *(outbuffer + offset + 2) = (u_tolerance.base >> (8 * 2)) & 0xFF;
nucho 0:77afd7560544 35 *(outbuffer + offset + 3) = (u_tolerance.base >> (8 * 3)) & 0xFF;
nucho 0:77afd7560544 36 offset += sizeof(this->tolerance);
nucho 0:77afd7560544 37 return offset;
nucho 0:77afd7560544 38 }
nucho 0:77afd7560544 39
nucho 0:77afd7560544 40 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 41 {
nucho 0:77afd7560544 42 int offset = 0;
nucho 0:77afd7560544 43 offset += this->start.deserialize(inbuffer + offset);
nucho 0:77afd7560544 44 offset += this->goal.deserialize(inbuffer + offset);
nucho 0:77afd7560544 45 union {
nucho 0:77afd7560544 46 float real;
nucho 0:77afd7560544 47 unsigned long base;
nucho 0:77afd7560544 48 } u_tolerance;
nucho 0:77afd7560544 49 u_tolerance.base = 0;
nucho 0:77afd7560544 50 u_tolerance.base |= ((typeof(u_tolerance.base)) (*(inbuffer + offset + 0))) << (8 * 0);
nucho 0:77afd7560544 51 u_tolerance.base |= ((typeof(u_tolerance.base)) (*(inbuffer + offset + 1))) << (8 * 1);
nucho 0:77afd7560544 52 u_tolerance.base |= ((typeof(u_tolerance.base)) (*(inbuffer + offset + 2))) << (8 * 2);
nucho 0:77afd7560544 53 u_tolerance.base |= ((typeof(u_tolerance.base)) (*(inbuffer + offset + 3))) << (8 * 3);
nucho 0:77afd7560544 54 this->tolerance = u_tolerance.real;
nucho 0:77afd7560544 55 offset += sizeof(this->tolerance);
nucho 0:77afd7560544 56 return offset;
nucho 0:77afd7560544 57 }
nucho 0:77afd7560544 58
nucho 0:77afd7560544 59 const char * getType(){ return GETPLAN; };
nucho 0:77afd7560544 60
nucho 0:77afd7560544 61 };
nucho 0:77afd7560544 62
nucho 0:77afd7560544 63 class GetPlanResponse : public ros::Msg
nucho 0:77afd7560544 64 {
nucho 0:77afd7560544 65 public:
nucho 0:77afd7560544 66 nav_msgs::Path plan;
nucho 0:77afd7560544 67
nucho 0:77afd7560544 68 virtual int serialize(unsigned char *outbuffer)
nucho 0:77afd7560544 69 {
nucho 0:77afd7560544 70 int offset = 0;
nucho 0:77afd7560544 71 offset += this->plan.serialize(outbuffer + offset);
nucho 0:77afd7560544 72 return offset;
nucho 0:77afd7560544 73 }
nucho 0:77afd7560544 74
nucho 0:77afd7560544 75 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 76 {
nucho 0:77afd7560544 77 int offset = 0;
nucho 0:77afd7560544 78 offset += this->plan.deserialize(inbuffer + offset);
nucho 0:77afd7560544 79 return offset;
nucho 0:77afd7560544 80 }
nucho 0:77afd7560544 81
nucho 0:77afd7560544 82 virtual const char * getType(){ return GETPLAN; };
nucho 0:77afd7560544 83
nucho 0:77afd7560544 84 };
nucho 0:77afd7560544 85
nucho 0:77afd7560544 86 }
nucho 0:77afd7560544 87 #endif