Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h
Dependents: WRS2020_mecanum_node
std_msgs/Header.h@2:5d429be7d0aa, 2020-11-02 (annotated)
- Committer:
- sgrsn
- Date:
- Mon Nov 02 09:00:01 2020 +0000
- Revision:
- 2:5d429be7d0aa
- Parent:
- 0:04ac6be8229a
Change INPUT_SIZE and OUTPUT_SIZE on node_handle.h to pub sub
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gary Servin |
0:04ac6be8229a | 1 | #ifndef _ROS_std_msgs_Header_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_std_msgs_Header_h |
Gary Servin |
0:04ac6be8229a | 3 | |
Gary Servin |
0:04ac6be8229a | 4 | #include <stdint.h> |
Gary Servin |
0:04ac6be8229a | 5 | #include <string.h> |
Gary Servin |
0:04ac6be8229a | 6 | #include <stdlib.h> |
Gary Servin |
0:04ac6be8229a | 7 | #include "ros/msg.h" |
Gary Servin |
0:04ac6be8229a | 8 | #include "ros/time.h" |
Gary Servin |
0:04ac6be8229a | 9 | |
Gary Servin |
0:04ac6be8229a | 10 | namespace std_msgs |
Gary Servin |
0:04ac6be8229a | 11 | { |
Gary Servin |
0:04ac6be8229a | 12 | |
Gary Servin |
0:04ac6be8229a | 13 | class Header : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 14 | { |
Gary Servin |
0:04ac6be8229a | 15 | public: |
Gary Servin |
0:04ac6be8229a | 16 | typedef uint32_t _seq_type; |
Gary Servin |
0:04ac6be8229a | 17 | _seq_type seq; |
Gary Servin |
0:04ac6be8229a | 18 | typedef ros::Time _stamp_type; |
Gary Servin |
0:04ac6be8229a | 19 | _stamp_type stamp; |
Gary Servin |
0:04ac6be8229a | 20 | typedef const char* _frame_id_type; |
Gary Servin |
0:04ac6be8229a | 21 | _frame_id_type frame_id; |
Gary Servin |
0:04ac6be8229a | 22 | |
Gary Servin |
0:04ac6be8229a | 23 | Header(): |
Gary Servin |
0:04ac6be8229a | 24 | seq(0), |
Gary Servin |
0:04ac6be8229a | 25 | stamp(), |
Gary Servin |
0:04ac6be8229a | 26 | frame_id("") |
Gary Servin |
0:04ac6be8229a | 27 | { |
Gary Servin |
0:04ac6be8229a | 28 | } |
Gary Servin |
0:04ac6be8229a | 29 | |
Gary Servin |
0:04ac6be8229a | 30 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 31 | { |
Gary Servin |
0:04ac6be8229a | 32 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 33 | *(outbuffer + offset + 0) = (this->seq >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 34 | *(outbuffer + offset + 1) = (this->seq >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 35 | *(outbuffer + offset + 2) = (this->seq >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 36 | *(outbuffer + offset + 3) = (this->seq >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 37 | offset += sizeof(this->seq); |
Gary Servin |
0:04ac6be8229a | 38 | *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 39 | *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 40 | *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 41 | *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 42 | offset += sizeof(this->stamp.sec); |
Gary Servin |
0:04ac6be8229a | 43 | *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 44 | *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 45 | *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 46 | *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 47 | offset += sizeof(this->stamp.nsec); |
Gary Servin |
0:04ac6be8229a | 48 | uint32_t length_frame_id = strlen(this->frame_id); |
Gary Servin |
0:04ac6be8229a | 49 | varToArr(outbuffer + offset, length_frame_id); |
Gary Servin |
0:04ac6be8229a | 50 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 51 | memcpy(outbuffer + offset, this->frame_id, length_frame_id); |
Gary Servin |
0:04ac6be8229a | 52 | offset += length_frame_id; |
Gary Servin |
0:04ac6be8229a | 53 | return offset; |
Gary Servin |
0:04ac6be8229a | 54 | } |
Gary Servin |
0:04ac6be8229a | 55 | |
Gary Servin |
0:04ac6be8229a | 56 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 57 | { |
Gary Servin |
0:04ac6be8229a | 58 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 59 | this->seq = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 60 | this->seq |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 61 | this->seq |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 62 | this->seq |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 63 | offset += sizeof(this->seq); |
Gary Servin |
0:04ac6be8229a | 64 | this->stamp.sec = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 65 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 66 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 67 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 68 | offset += sizeof(this->stamp.sec); |
Gary Servin |
0:04ac6be8229a | 69 | this->stamp.nsec = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 70 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 71 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 72 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 73 | offset += sizeof(this->stamp.nsec); |
Gary Servin |
0:04ac6be8229a | 74 | uint32_t length_frame_id; |
Gary Servin |
0:04ac6be8229a | 75 | arrToVar(length_frame_id, (inbuffer + offset)); |
Gary Servin |
0:04ac6be8229a | 76 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 77 | for(unsigned int k= offset; k< offset+length_frame_id; ++k){ |
Gary Servin |
0:04ac6be8229a | 78 | inbuffer[k-1]=inbuffer[k]; |
Gary Servin |
0:04ac6be8229a | 79 | } |
Gary Servin |
0:04ac6be8229a | 80 | inbuffer[offset+length_frame_id-1]=0; |
Gary Servin |
0:04ac6be8229a | 81 | this->frame_id = (char *)(inbuffer + offset-1); |
Gary Servin |
0:04ac6be8229a | 82 | offset += length_frame_id; |
Gary Servin |
0:04ac6be8229a | 83 | return offset; |
Gary Servin |
0:04ac6be8229a | 84 | } |
Gary Servin |
0:04ac6be8229a | 85 | |
Gary Servin |
0:04ac6be8229a | 86 | const char * getType(){ return "std_msgs/Header"; }; |
Gary Servin |
0:04ac6be8229a | 87 | const char * getMD5(){ return "2176decaecbce78abc3b96ef049fabed"; }; |
Gary Servin |
0:04ac6be8229a | 88 | |
Gary Servin |
0:04ac6be8229a | 89 | }; |
Gary Servin |
0:04ac6be8229a | 90 | |
Gary Servin |
0:04ac6be8229a | 91 | } |
Gary Servin |
0:04ac6be8229a | 92 | #endif |