It has only one change from original one. I added robotfeedback message on it.
Dependents: RobotFeedback mobileRobotITU
Fork of ros_lib_indigo by
std_msgs/Header.h@0:fd24f7ca9688, 2016-03-31 (annotated)
- Committer:
- garyservin
- Date:
- Thu Mar 31 14:22:59 2016 +0000
- Revision:
- 0:fd24f7ca9688
Initial commit, generated based on a clean indigo-desktop-full
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_std_msgs_Header_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_std_msgs_Header_h |
garyservin | 0:fd24f7ca9688 | 3 | |
garyservin | 0:fd24f7ca9688 | 4 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 7 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 8 | #include "ros/time.h" |
garyservin | 0:fd24f7ca9688 | 9 | |
garyservin | 0:fd24f7ca9688 | 10 | namespace std_msgs |
garyservin | 0:fd24f7ca9688 | 11 | { |
garyservin | 0:fd24f7ca9688 | 12 | |
garyservin | 0:fd24f7ca9688 | 13 | class Header : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 14 | { |
garyservin | 0:fd24f7ca9688 | 15 | public: |
garyservin | 0:fd24f7ca9688 | 16 | uint32_t seq; |
garyservin | 0:fd24f7ca9688 | 17 | ros::Time stamp; |
garyservin | 0:fd24f7ca9688 | 18 | const char* frame_id; |
garyservin | 0:fd24f7ca9688 | 19 | |
garyservin | 0:fd24f7ca9688 | 20 | Header(): |
garyservin | 0:fd24f7ca9688 | 21 | seq(0), |
garyservin | 0:fd24f7ca9688 | 22 | stamp(), |
garyservin | 0:fd24f7ca9688 | 23 | frame_id("") |
garyservin | 0:fd24f7ca9688 | 24 | { |
garyservin | 0:fd24f7ca9688 | 25 | } |
garyservin | 0:fd24f7ca9688 | 26 | |
garyservin | 0:fd24f7ca9688 | 27 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 28 | { |
garyservin | 0:fd24f7ca9688 | 29 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 30 | *(outbuffer + offset + 0) = (this->seq >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 31 | *(outbuffer + offset + 1) = (this->seq >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 32 | *(outbuffer + offset + 2) = (this->seq >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 33 | *(outbuffer + offset + 3) = (this->seq >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 34 | offset += sizeof(this->seq); |
garyservin | 0:fd24f7ca9688 | 35 | *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 36 | *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 37 | *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 38 | *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 39 | offset += sizeof(this->stamp.sec); |
garyservin | 0:fd24f7ca9688 | 40 | *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 41 | *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 42 | *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 43 | *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 44 | offset += sizeof(this->stamp.nsec); |
garyservin | 0:fd24f7ca9688 | 45 | uint32_t length_frame_id = strlen(this->frame_id); |
garyservin | 0:fd24f7ca9688 | 46 | memcpy(outbuffer + offset, &length_frame_id, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 47 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 48 | memcpy(outbuffer + offset, this->frame_id, length_frame_id); |
garyservin | 0:fd24f7ca9688 | 49 | offset += length_frame_id; |
garyservin | 0:fd24f7ca9688 | 50 | return offset; |
garyservin | 0:fd24f7ca9688 | 51 | } |
garyservin | 0:fd24f7ca9688 | 52 | |
garyservin | 0:fd24f7ca9688 | 53 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 54 | { |
garyservin | 0:fd24f7ca9688 | 55 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 56 | this->seq = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 57 | this->seq |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 58 | this->seq |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 59 | this->seq |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 60 | offset += sizeof(this->seq); |
garyservin | 0:fd24f7ca9688 | 61 | this->stamp.sec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 62 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 63 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 64 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 65 | offset += sizeof(this->stamp.sec); |
garyservin | 0:fd24f7ca9688 | 66 | this->stamp.nsec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 67 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 68 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 69 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 70 | offset += sizeof(this->stamp.nsec); |
garyservin | 0:fd24f7ca9688 | 71 | uint32_t length_frame_id; |
garyservin | 0:fd24f7ca9688 | 72 | memcpy(&length_frame_id, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 73 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 74 | for(unsigned int k= offset; k< offset+length_frame_id; ++k){ |
garyservin | 0:fd24f7ca9688 | 75 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 76 | } |
garyservin | 0:fd24f7ca9688 | 77 | inbuffer[offset+length_frame_id-1]=0; |
garyservin | 0:fd24f7ca9688 | 78 | this->frame_id = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 79 | offset += length_frame_id; |
garyservin | 0:fd24f7ca9688 | 80 | return offset; |
garyservin | 0:fd24f7ca9688 | 81 | } |
garyservin | 0:fd24f7ca9688 | 82 | |
garyservin | 0:fd24f7ca9688 | 83 | const char * getType(){ return "std_msgs/Header"; }; |
garyservin | 0:fd24f7ca9688 | 84 | const char * getMD5(){ return "2176decaecbce78abc3b96ef049fabed"; }; |
garyservin | 0:fd24f7ca9688 | 85 | |
garyservin | 0:fd24f7ca9688 | 86 | }; |
garyservin | 0:fd24f7ca9688 | 87 | |
garyservin | 0:fd24f7ca9688 | 88 | } |
garyservin | 0:fd24f7ca9688 | 89 | #endif |