rosserial for Hydro
Fork of rosserial_mbed_lib by
geometry_msgs/TransformStamped.h@1:ff0ec969dad1, 2011-10-16 (annotated)
- Committer:
- nucho
- Date:
- Sun Oct 16 07:19:36 2011 +0000
- Revision:
- 1:ff0ec969dad1
- Parent:
- 0:77afd7560544
- Child:
- 3:1cf99502f396
This program supported the revision of 143 of rosserial.
And the bug fix of receive of array data.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 1:ff0ec969dad1 | 1 | #ifndef ros_geometry_msgs_TransformStamped_h |
nucho | 1:ff0ec969dad1 | 2 | #define ros_geometry_msgs_TransformStamped_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 | 0:77afd7560544 | 7 | #include "../ros/msg.h" |
nucho | 0:77afd7560544 | 8 | #include "std_msgs/Header.h" |
nucho | 0:77afd7560544 | 9 | #include "geometry_msgs/Transform.h" |
nucho | 0:77afd7560544 | 10 | |
nucho | 0:77afd7560544 | 11 | namespace geometry_msgs |
nucho | 0:77afd7560544 | 12 | { |
nucho | 0:77afd7560544 | 13 | |
nucho | 0:77afd7560544 | 14 | class TransformStamped : public ros::Msg |
nucho | 0:77afd7560544 | 15 | { |
nucho | 0:77afd7560544 | 16 | public: |
nucho | 0:77afd7560544 | 17 | std_msgs::Header header; |
nucho | 0:77afd7560544 | 18 | char * child_frame_id; |
nucho | 0:77afd7560544 | 19 | geometry_msgs::Transform transform; |
nucho | 0:77afd7560544 | 20 | |
nucho | 0:77afd7560544 | 21 | virtual int serialize(unsigned char *outbuffer) |
nucho | 0:77afd7560544 | 22 | { |
nucho | 0:77afd7560544 | 23 | int offset = 0; |
nucho | 0:77afd7560544 | 24 | offset += this->header.serialize(outbuffer + offset); |
nucho | 0:77afd7560544 | 25 | long * length_child_frame_id = (long *)(outbuffer + offset); |
nucho | 0:77afd7560544 | 26 | *length_child_frame_id = strlen( (const char*) this->child_frame_id); |
nucho | 0:77afd7560544 | 27 | offset += 4; |
nucho | 0:77afd7560544 | 28 | memcpy(outbuffer + offset, this->child_frame_id, *length_child_frame_id); |
nucho | 0:77afd7560544 | 29 | offset += *length_child_frame_id; |
nucho | 0:77afd7560544 | 30 | offset += this->transform.serialize(outbuffer + offset); |
nucho | 0:77afd7560544 | 31 | return offset; |
nucho | 0:77afd7560544 | 32 | } |
nucho | 0:77afd7560544 | 33 | |
nucho | 0:77afd7560544 | 34 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:77afd7560544 | 35 | { |
nucho | 0:77afd7560544 | 36 | int offset = 0; |
nucho | 0:77afd7560544 | 37 | offset += this->header.deserialize(inbuffer + offset); |
nucho | 0:77afd7560544 | 38 | uint32_t length_child_frame_id = *(uint32_t *)(inbuffer + offset); |
nucho | 0:77afd7560544 | 39 | offset += 4; |
nucho | 0:77afd7560544 | 40 | for(unsigned int k= offset; k< offset+length_child_frame_id; ++k){ |
nucho | 0:77afd7560544 | 41 | inbuffer[k-1]=inbuffer[k]; |
nucho | 0:77afd7560544 | 42 | } |
nucho | 0:77afd7560544 | 43 | inbuffer[offset+length_child_frame_id-1]=0; |
nucho | 0:77afd7560544 | 44 | this->child_frame_id = (char *)(inbuffer + offset-1); |
nucho | 0:77afd7560544 | 45 | offset += length_child_frame_id; |
nucho | 0:77afd7560544 | 46 | offset += this->transform.deserialize(inbuffer + offset); |
nucho | 0:77afd7560544 | 47 | return offset; |
nucho | 0:77afd7560544 | 48 | } |
nucho | 0:77afd7560544 | 49 | |
nucho | 0:77afd7560544 | 50 | virtual const char * getType(){ return "geometry_msgs/TransformStamped"; }; |
nucho | 0:77afd7560544 | 51 | |
nucho | 0:77afd7560544 | 52 | }; |
nucho | 0:77afd7560544 | 53 | |
nucho | 0:77afd7560544 | 54 | } |
nucho | 0:77afd7560544 | 55 | #endif |