Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h
Dependents: WRS2020_mecanum_node
std_msgs/MultiArrayDimension.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_MultiArrayDimension_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_std_msgs_MultiArrayDimension_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 | |
Gary Servin |
0:04ac6be8229a | 9 | namespace std_msgs |
Gary Servin |
0:04ac6be8229a | 10 | { |
Gary Servin |
0:04ac6be8229a | 11 | |
Gary Servin |
0:04ac6be8229a | 12 | class MultiArrayDimension : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 13 | { |
Gary Servin |
0:04ac6be8229a | 14 | public: |
Gary Servin |
0:04ac6be8229a | 15 | typedef const char* _label_type; |
Gary Servin |
0:04ac6be8229a | 16 | _label_type label; |
Gary Servin |
0:04ac6be8229a | 17 | typedef uint32_t _size_type; |
Gary Servin |
0:04ac6be8229a | 18 | _size_type size; |
Gary Servin |
0:04ac6be8229a | 19 | typedef uint32_t _stride_type; |
Gary Servin |
0:04ac6be8229a | 20 | _stride_type stride; |
Gary Servin |
0:04ac6be8229a | 21 | |
Gary Servin |
0:04ac6be8229a | 22 | MultiArrayDimension(): |
Gary Servin |
0:04ac6be8229a | 23 | label(""), |
Gary Servin |
0:04ac6be8229a | 24 | size(0), |
Gary Servin |
0:04ac6be8229a | 25 | stride(0) |
Gary Servin |
0:04ac6be8229a | 26 | { |
Gary Servin |
0:04ac6be8229a | 27 | } |
Gary Servin |
0:04ac6be8229a | 28 | |
Gary Servin |
0:04ac6be8229a | 29 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 30 | { |
Gary Servin |
0:04ac6be8229a | 31 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 32 | uint32_t length_label = strlen(this->label); |
Gary Servin |
0:04ac6be8229a | 33 | varToArr(outbuffer + offset, length_label); |
Gary Servin |
0:04ac6be8229a | 34 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 35 | memcpy(outbuffer + offset, this->label, length_label); |
Gary Servin |
0:04ac6be8229a | 36 | offset += length_label; |
Gary Servin |
0:04ac6be8229a | 37 | *(outbuffer + offset + 0) = (this->size >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 38 | *(outbuffer + offset + 1) = (this->size >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 39 | *(outbuffer + offset + 2) = (this->size >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 40 | *(outbuffer + offset + 3) = (this->size >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 41 | offset += sizeof(this->size); |
Gary Servin |
0:04ac6be8229a | 42 | *(outbuffer + offset + 0) = (this->stride >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 43 | *(outbuffer + offset + 1) = (this->stride >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 44 | *(outbuffer + offset + 2) = (this->stride >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 45 | *(outbuffer + offset + 3) = (this->stride >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 46 | offset += sizeof(this->stride); |
Gary Servin |
0:04ac6be8229a | 47 | return offset; |
Gary Servin |
0:04ac6be8229a | 48 | } |
Gary Servin |
0:04ac6be8229a | 49 | |
Gary Servin |
0:04ac6be8229a | 50 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 51 | { |
Gary Servin |
0:04ac6be8229a | 52 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 53 | uint32_t length_label; |
Gary Servin |
0:04ac6be8229a | 54 | arrToVar(length_label, (inbuffer + offset)); |
Gary Servin |
0:04ac6be8229a | 55 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 56 | for(unsigned int k= offset; k< offset+length_label; ++k){ |
Gary Servin |
0:04ac6be8229a | 57 | inbuffer[k-1]=inbuffer[k]; |
Gary Servin |
0:04ac6be8229a | 58 | } |
Gary Servin |
0:04ac6be8229a | 59 | inbuffer[offset+length_label-1]=0; |
Gary Servin |
0:04ac6be8229a | 60 | this->label = (char *)(inbuffer + offset-1); |
Gary Servin |
0:04ac6be8229a | 61 | offset += length_label; |
Gary Servin |
0:04ac6be8229a | 62 | this->size = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 63 | this->size |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 64 | this->size |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 65 | this->size |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 66 | offset += sizeof(this->size); |
Gary Servin |
0:04ac6be8229a | 67 | this->stride = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 68 | this->stride |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 69 | this->stride |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 70 | this->stride |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 71 | offset += sizeof(this->stride); |
Gary Servin |
0:04ac6be8229a | 72 | return offset; |
Gary Servin |
0:04ac6be8229a | 73 | } |
Gary Servin |
0:04ac6be8229a | 74 | |
Gary Servin |
0:04ac6be8229a | 75 | const char * getType(){ return "std_msgs/MultiArrayDimension"; }; |
Gary Servin |
0:04ac6be8229a | 76 | const char * getMD5(){ return "4cd0c83a8683deae40ecdac60e53bfa8"; }; |
Gary Servin |
0:04ac6be8229a | 77 | |
Gary Servin |
0:04ac6be8229a | 78 | }; |
Gary Servin |
0:04ac6be8229a | 79 | |
Gary Servin |
0:04ac6be8229a | 80 | } |
Gary Servin |
0:04ac6be8229a | 81 | #endif |