![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial. This program contains an example.
Dependencies: rosserial_mbed_lib mbed Servo
nav_msgs/GetPlan.h@3:dff241b66f84, 2011-11-12 (annotated)
- Committer:
- nucho
- Date:
- Sat Nov 12 23:53:04 2011 +0000
- Revision:
- 3:dff241b66f84
- Parent:
- 0:06fc856e99ca
This program supported the revision of 167 of rosserial.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 3:dff241b66f84 | 1 | #ifndef _ROS_SERVICE_GetPlan_h |
nucho | 3:dff241b66f84 | 2 | #define _ROS_SERVICE_GetPlan_h |
nucho | 0:06fc856e99ca | 3 | #include <stdint.h> |
nucho | 0:06fc856e99ca | 4 | #include <string.h> |
nucho | 0:06fc856e99ca | 5 | #include <stdlib.h> |
nucho | 3:dff241b66f84 | 6 | #include "ros/msg.h" |
nucho | 0:06fc856e99ca | 7 | #include "geometry_msgs/PoseStamped.h" |
nucho | 0:06fc856e99ca | 8 | #include "nav_msgs/Path.h" |
nucho | 0:06fc856e99ca | 9 | |
nucho | 0:06fc856e99ca | 10 | namespace nav_msgs |
nucho | 0:06fc856e99ca | 11 | { |
nucho | 0:06fc856e99ca | 12 | |
nucho | 0:06fc856e99ca | 13 | static const char GETPLAN[] = "nav_msgs/GetPlan"; |
nucho | 0:06fc856e99ca | 14 | |
nucho | 0:06fc856e99ca | 15 | class GetPlanRequest : public ros::Msg |
nucho | 0:06fc856e99ca | 16 | { |
nucho | 0:06fc856e99ca | 17 | public: |
nucho | 0:06fc856e99ca | 18 | geometry_msgs::PoseStamped start; |
nucho | 0:06fc856e99ca | 19 | geometry_msgs::PoseStamped goal; |
nucho | 0:06fc856e99ca | 20 | float tolerance; |
nucho | 0:06fc856e99ca | 21 | |
nucho | 3:dff241b66f84 | 22 | virtual int serialize(unsigned char *outbuffer) const |
nucho | 0:06fc856e99ca | 23 | { |
nucho | 0:06fc856e99ca | 24 | int offset = 0; |
nucho | 0:06fc856e99ca | 25 | offset += this->start.serialize(outbuffer + offset); |
nucho | 0:06fc856e99ca | 26 | offset += this->goal.serialize(outbuffer + offset); |
nucho | 0:06fc856e99ca | 27 | union { |
nucho | 0:06fc856e99ca | 28 | float real; |
nucho | 3:dff241b66f84 | 29 | uint32_t base; |
nucho | 0:06fc856e99ca | 30 | } u_tolerance; |
nucho | 0:06fc856e99ca | 31 | u_tolerance.real = this->tolerance; |
nucho | 0:06fc856e99ca | 32 | *(outbuffer + offset + 0) = (u_tolerance.base >> (8 * 0)) & 0xFF; |
nucho | 0:06fc856e99ca | 33 | *(outbuffer + offset + 1) = (u_tolerance.base >> (8 * 1)) & 0xFF; |
nucho | 0:06fc856e99ca | 34 | *(outbuffer + offset + 2) = (u_tolerance.base >> (8 * 2)) & 0xFF; |
nucho | 0:06fc856e99ca | 35 | *(outbuffer + offset + 3) = (u_tolerance.base >> (8 * 3)) & 0xFF; |
nucho | 0:06fc856e99ca | 36 | offset += sizeof(this->tolerance); |
nucho | 0:06fc856e99ca | 37 | return offset; |
nucho | 0:06fc856e99ca | 38 | } |
nucho | 0:06fc856e99ca | 39 | |
nucho | 0:06fc856e99ca | 40 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:06fc856e99ca | 41 | { |
nucho | 0:06fc856e99ca | 42 | int offset = 0; |
nucho | 0:06fc856e99ca | 43 | offset += this->start.deserialize(inbuffer + offset); |
nucho | 0:06fc856e99ca | 44 | offset += this->goal.deserialize(inbuffer + offset); |
nucho | 0:06fc856e99ca | 45 | union { |
nucho | 0:06fc856e99ca | 46 | float real; |
nucho | 3:dff241b66f84 | 47 | uint32_t base; |
nucho | 0:06fc856e99ca | 48 | } u_tolerance; |
nucho | 0:06fc856e99ca | 49 | u_tolerance.base = 0; |
nucho | 3:dff241b66f84 | 50 | u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
nucho | 3:dff241b66f84 | 51 | u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
nucho | 3:dff241b66f84 | 52 | u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
nucho | 3:dff241b66f84 | 53 | u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
nucho | 0:06fc856e99ca | 54 | this->tolerance = u_tolerance.real; |
nucho | 0:06fc856e99ca | 55 | offset += sizeof(this->tolerance); |
nucho | 0:06fc856e99ca | 56 | return offset; |
nucho | 0:06fc856e99ca | 57 | } |
nucho | 0:06fc856e99ca | 58 | |
nucho | 3:dff241b66f84 | 59 | virtual const char * getType(){ return GETPLAN; }; |
nucho | 3:dff241b66f84 | 60 | virtual const char * getMD5(){ return "e25a43e0752bcca599a8c2eef8282df8"; }; |
nucho | 0:06fc856e99ca | 61 | |
nucho | 0:06fc856e99ca | 62 | }; |
nucho | 0:06fc856e99ca | 63 | |
nucho | 0:06fc856e99ca | 64 | class GetPlanResponse : public ros::Msg |
nucho | 0:06fc856e99ca | 65 | { |
nucho | 0:06fc856e99ca | 66 | public: |
nucho | 0:06fc856e99ca | 67 | nav_msgs::Path plan; |
nucho | 0:06fc856e99ca | 68 | |
nucho | 3:dff241b66f84 | 69 | virtual int serialize(unsigned char *outbuffer) const |
nucho | 0:06fc856e99ca | 70 | { |
nucho | 0:06fc856e99ca | 71 | int offset = 0; |
nucho | 0:06fc856e99ca | 72 | offset += this->plan.serialize(outbuffer + offset); |
nucho | 0:06fc856e99ca | 73 | return offset; |
nucho | 0:06fc856e99ca | 74 | } |
nucho | 0:06fc856e99ca | 75 | |
nucho | 0:06fc856e99ca | 76 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:06fc856e99ca | 77 | { |
nucho | 0:06fc856e99ca | 78 | int offset = 0; |
nucho | 0:06fc856e99ca | 79 | offset += this->plan.deserialize(inbuffer + offset); |
nucho | 0:06fc856e99ca | 80 | return offset; |
nucho | 0:06fc856e99ca | 81 | } |
nucho | 0:06fc856e99ca | 82 | |
nucho | 3:dff241b66f84 | 83 | virtual const char * getType(){ return GETPLAN; }; |
nucho | 3:dff241b66f84 | 84 | virtual const char * getMD5(){ return "0002bc113c0259d71f6cf8cbc9430e18"; }; |
nucho | 3:dff241b66f84 | 85 | |
nucho | 3:dff241b66f84 | 86 | }; |
nucho | 0:06fc856e99ca | 87 | |
nucho | 3:dff241b66f84 | 88 | class GetPlan { |
nucho | 3:dff241b66f84 | 89 | public: |
nucho | 3:dff241b66f84 | 90 | typedef GetPlanRequest Request; |
nucho | 3:dff241b66f84 | 91 | typedef GetPlanResponse Response; |
nucho | 0:06fc856e99ca | 92 | }; |
nucho | 0:06fc856e99ca | 93 | |
nucho | 0:06fc856e99ca | 94 | } |
nucho | 0:06fc856e99ca | 95 | #endif |