This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.
Dependents: rosserial_mbed robot_S2
geometry_msgs/Polygon.h@4:684f39d0c346, 2012-02-29 (annotated)
- Committer:
- nucho
- Date:
- Wed Feb 29 23:00:21 2012 +0000
- Revision:
- 4:684f39d0c346
- Parent:
- 3:1cf99502f396
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 3:1cf99502f396 | 1 | #ifndef _ROS_geometry_msgs_Polygon_h |
nucho | 3:1cf99502f396 | 2 | #define _ROS_geometry_msgs_Polygon_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 | #include "geometry_msgs/Point32.h" |
nucho | 0:77afd7560544 | 9 | |
nucho | 3:1cf99502f396 | 10 | namespace geometry_msgs |
nucho | 3:1cf99502f396 | 11 | { |
nucho | 0:77afd7560544 | 12 | |
nucho | 3:1cf99502f396 | 13 | class Polygon : public ros::Msg |
nucho | 3:1cf99502f396 | 14 | { |
nucho | 3:1cf99502f396 | 15 | public: |
nucho | 3:1cf99502f396 | 16 | uint8_t points_length; |
nucho | 3:1cf99502f396 | 17 | geometry_msgs::Point32 st_points; |
nucho | 3:1cf99502f396 | 18 | geometry_msgs::Point32 * points; |
nucho | 0:77afd7560544 | 19 | |
nucho | 3:1cf99502f396 | 20 | virtual int serialize(unsigned char *outbuffer) const |
nucho | 3:1cf99502f396 | 21 | { |
nucho | 3:1cf99502f396 | 22 | int offset = 0; |
nucho | 3:1cf99502f396 | 23 | *(outbuffer + offset++) = points_length; |
nucho | 3:1cf99502f396 | 24 | *(outbuffer + offset++) = 0; |
nucho | 3:1cf99502f396 | 25 | *(outbuffer + offset++) = 0; |
nucho | 3:1cf99502f396 | 26 | *(outbuffer + offset++) = 0; |
nucho | 3:1cf99502f396 | 27 | for( uint8_t i = 0; i < points_length; i++){ |
nucho | 3:1cf99502f396 | 28 | offset += this->points[i].serialize(outbuffer + offset); |
nucho | 3:1cf99502f396 | 29 | } |
nucho | 3:1cf99502f396 | 30 | return offset; |
nucho | 0:77afd7560544 | 31 | } |
nucho | 0:77afd7560544 | 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 | uint8_t points_lengthT = *(inbuffer + offset++); |
nucho | 3:1cf99502f396 | 37 | if(points_lengthT > points_length) |
nucho | 3:1cf99502f396 | 38 | this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32)); |
nucho | 3:1cf99502f396 | 39 | offset += 3; |
nucho | 3:1cf99502f396 | 40 | points_length = points_lengthT; |
nucho | 3:1cf99502f396 | 41 | for( uint8_t i = 0; i < points_length; i++){ |
nucho | 3:1cf99502f396 | 42 | offset += this->st_points.deserialize(inbuffer + offset); |
nucho | 3:1cf99502f396 | 43 | memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point32)); |
nucho | 3:1cf99502f396 | 44 | } |
nucho | 3:1cf99502f396 | 45 | return offset; |
nucho | 0:77afd7560544 | 46 | } |
nucho | 0:77afd7560544 | 47 | |
nucho | 3:1cf99502f396 | 48 | virtual const char * getType(){ return "geometry_msgs/Polygon"; }; |
nucho | 3:1cf99502f396 | 49 | virtual const char * getMD5(){ return "cd60a26494a087f577976f0329fa120e"; }; |
nucho | 0:77afd7560544 | 50 | |
nucho | 3:1cf99502f396 | 51 | }; |
nucho | 0:77afd7560544 | 52 | |
nucho | 0:77afd7560544 | 53 | } |
nucho | 0:77afd7560544 | 54 | #endif |