Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h
Dependents: WRS2020_mecanum_node
turtlesim/Color.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_turtlesim_Color_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_turtlesim_Color_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 turtlesim |
Gary Servin |
0:04ac6be8229a | 10 | { |
Gary Servin |
0:04ac6be8229a | 11 | |
Gary Servin |
0:04ac6be8229a | 12 | class Color : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 13 | { |
Gary Servin |
0:04ac6be8229a | 14 | public: |
Gary Servin |
0:04ac6be8229a | 15 | typedef uint8_t _r_type; |
Gary Servin |
0:04ac6be8229a | 16 | _r_type r; |
Gary Servin |
0:04ac6be8229a | 17 | typedef uint8_t _g_type; |
Gary Servin |
0:04ac6be8229a | 18 | _g_type g; |
Gary Servin |
0:04ac6be8229a | 19 | typedef uint8_t _b_type; |
Gary Servin |
0:04ac6be8229a | 20 | _b_type b; |
Gary Servin |
0:04ac6be8229a | 21 | |
Gary Servin |
0:04ac6be8229a | 22 | Color(): |
Gary Servin |
0:04ac6be8229a | 23 | r(0), |
Gary Servin |
0:04ac6be8229a | 24 | g(0), |
Gary Servin |
0:04ac6be8229a | 25 | b(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 | *(outbuffer + offset + 0) = (this->r >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 33 | offset += sizeof(this->r); |
Gary Servin |
0:04ac6be8229a | 34 | *(outbuffer + offset + 0) = (this->g >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 35 | offset += sizeof(this->g); |
Gary Servin |
0:04ac6be8229a | 36 | *(outbuffer + offset + 0) = (this->b >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 37 | offset += sizeof(this->b); |
Gary Servin |
0:04ac6be8229a | 38 | return offset; |
Gary Servin |
0:04ac6be8229a | 39 | } |
Gary Servin |
0:04ac6be8229a | 40 | |
Gary Servin |
0:04ac6be8229a | 41 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 42 | { |
Gary Servin |
0:04ac6be8229a | 43 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 44 | this->r = ((uint8_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 45 | offset += sizeof(this->r); |
Gary Servin |
0:04ac6be8229a | 46 | this->g = ((uint8_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 47 | offset += sizeof(this->g); |
Gary Servin |
0:04ac6be8229a | 48 | this->b = ((uint8_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 49 | offset += sizeof(this->b); |
Gary Servin |
0:04ac6be8229a | 50 | return offset; |
Gary Servin |
0:04ac6be8229a | 51 | } |
Gary Servin |
0:04ac6be8229a | 52 | |
Gary Servin |
0:04ac6be8229a | 53 | const char * getType(){ return "turtlesim/Color"; }; |
Gary Servin |
0:04ac6be8229a | 54 | const char * getMD5(){ return "353891e354491c51aabe32df673fb446"; }; |
Gary Servin |
0:04ac6be8229a | 55 | |
Gary Servin |
0:04ac6be8229a | 56 | }; |
Gary Servin |
0:04ac6be8229a | 57 | |
Gary Servin |
0:04ac6be8229a | 58 | } |
Gary Servin |
0:04ac6be8229a | 59 | #endif |