capstone_finish
Dependencies: BufferedSerial motor_sn7544
sensor_msgs/PointField.h@3:2a3664dc6634, 2019-08-13 (annotated)
- Committer:
- Jeonghoon
- Date:
- Tue Aug 13 05:53:22 2019 +0000
- Revision:
- 3:2a3664dc6634
with ROS;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 3:2a3664dc6634 | 1 | #ifndef _ROS_sensor_msgs_PointField_h |
Jeonghoon | 3:2a3664dc6634 | 2 | #define _ROS_sensor_msgs_PointField_h |
Jeonghoon | 3:2a3664dc6634 | 3 | |
Jeonghoon | 3:2a3664dc6634 | 4 | #include <stdint.h> |
Jeonghoon | 3:2a3664dc6634 | 5 | #include <string.h> |
Jeonghoon | 3:2a3664dc6634 | 6 | #include <stdlib.h> |
Jeonghoon | 3:2a3664dc6634 | 7 | #include "ros/msg.h" |
Jeonghoon | 3:2a3664dc6634 | 8 | |
Jeonghoon | 3:2a3664dc6634 | 9 | namespace sensor_msgs |
Jeonghoon | 3:2a3664dc6634 | 10 | { |
Jeonghoon | 3:2a3664dc6634 | 11 | |
Jeonghoon | 3:2a3664dc6634 | 12 | class PointField : public ros::Msg |
Jeonghoon | 3:2a3664dc6634 | 13 | { |
Jeonghoon | 3:2a3664dc6634 | 14 | public: |
Jeonghoon | 3:2a3664dc6634 | 15 | typedef const char* _name_type; |
Jeonghoon | 3:2a3664dc6634 | 16 | _name_type name; |
Jeonghoon | 3:2a3664dc6634 | 17 | typedef uint32_t _offset_type; |
Jeonghoon | 3:2a3664dc6634 | 18 | _offset_type offset; |
Jeonghoon | 3:2a3664dc6634 | 19 | typedef uint8_t _datatype_type; |
Jeonghoon | 3:2a3664dc6634 | 20 | _datatype_type datatype; |
Jeonghoon | 3:2a3664dc6634 | 21 | typedef uint32_t _count_type; |
Jeonghoon | 3:2a3664dc6634 | 22 | _count_type count; |
Jeonghoon | 3:2a3664dc6634 | 23 | enum { INT8 = 1 }; |
Jeonghoon | 3:2a3664dc6634 | 24 | enum { UINT8 = 2 }; |
Jeonghoon | 3:2a3664dc6634 | 25 | enum { INT16 = 3 }; |
Jeonghoon | 3:2a3664dc6634 | 26 | enum { UINT16 = 4 }; |
Jeonghoon | 3:2a3664dc6634 | 27 | enum { INT32 = 5 }; |
Jeonghoon | 3:2a3664dc6634 | 28 | enum { UINT32 = 6 }; |
Jeonghoon | 3:2a3664dc6634 | 29 | enum { FLOAT32 = 7 }; |
Jeonghoon | 3:2a3664dc6634 | 30 | enum { FLOAT64 = 8 }; |
Jeonghoon | 3:2a3664dc6634 | 31 | |
Jeonghoon | 3:2a3664dc6634 | 32 | PointField(): |
Jeonghoon | 3:2a3664dc6634 | 33 | name(""), |
Jeonghoon | 3:2a3664dc6634 | 34 | offset(0), |
Jeonghoon | 3:2a3664dc6634 | 35 | datatype(0), |
Jeonghoon | 3:2a3664dc6634 | 36 | count(0) |
Jeonghoon | 3:2a3664dc6634 | 37 | { |
Jeonghoon | 3:2a3664dc6634 | 38 | } |
Jeonghoon | 3:2a3664dc6634 | 39 | |
Jeonghoon | 3:2a3664dc6634 | 40 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 3:2a3664dc6634 | 41 | { |
Jeonghoon | 3:2a3664dc6634 | 42 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 43 | uint32_t length_name = strlen(this->name); |
Jeonghoon | 3:2a3664dc6634 | 44 | varToArr(outbuffer + offset, length_name); |
Jeonghoon | 3:2a3664dc6634 | 45 | offset += 4; |
Jeonghoon | 3:2a3664dc6634 | 46 | memcpy(outbuffer + offset, this->name, length_name); |
Jeonghoon | 3:2a3664dc6634 | 47 | offset += length_name; |
Jeonghoon | 3:2a3664dc6634 | 48 | *(outbuffer + offset + 0) = (this->offset >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 49 | *(outbuffer + offset + 1) = (this->offset >> (8 * 1)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 50 | *(outbuffer + offset + 2) = (this->offset >> (8 * 2)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 51 | *(outbuffer + offset + 3) = (this->offset >> (8 * 3)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 52 | offset += sizeof(this->offset); |
Jeonghoon | 3:2a3664dc6634 | 53 | *(outbuffer + offset + 0) = (this->datatype >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 54 | offset += sizeof(this->datatype); |
Jeonghoon | 3:2a3664dc6634 | 55 | *(outbuffer + offset + 0) = (this->count >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 56 | *(outbuffer + offset + 1) = (this->count >> (8 * 1)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 57 | *(outbuffer + offset + 2) = (this->count >> (8 * 2)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 58 | *(outbuffer + offset + 3) = (this->count >> (8 * 3)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 59 | offset += sizeof(this->count); |
Jeonghoon | 3:2a3664dc6634 | 60 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 61 | } |
Jeonghoon | 3:2a3664dc6634 | 62 | |
Jeonghoon | 3:2a3664dc6634 | 63 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 3:2a3664dc6634 | 64 | { |
Jeonghoon | 3:2a3664dc6634 | 65 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 66 | uint32_t length_name; |
Jeonghoon | 3:2a3664dc6634 | 67 | arrToVar(length_name, (inbuffer + offset)); |
Jeonghoon | 3:2a3664dc6634 | 68 | offset += 4; |
Jeonghoon | 3:2a3664dc6634 | 69 | for(unsigned int k= offset; k< offset+length_name; ++k){ |
Jeonghoon | 3:2a3664dc6634 | 70 | inbuffer[k-1]=inbuffer[k]; |
Jeonghoon | 3:2a3664dc6634 | 71 | } |
Jeonghoon | 3:2a3664dc6634 | 72 | inbuffer[offset+length_name-1]=0; |
Jeonghoon | 3:2a3664dc6634 | 73 | this->name = (char *)(inbuffer + offset-1); |
Jeonghoon | 3:2a3664dc6634 | 74 | offset += length_name; |
Jeonghoon | 3:2a3664dc6634 | 75 | this->offset = ((uint32_t) (*(inbuffer + offset))); |
Jeonghoon | 3:2a3664dc6634 | 76 | this->offset |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Jeonghoon | 3:2a3664dc6634 | 77 | this->offset |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Jeonghoon | 3:2a3664dc6634 | 78 | this->offset |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Jeonghoon | 3:2a3664dc6634 | 79 | offset += sizeof(this->offset); |
Jeonghoon | 3:2a3664dc6634 | 80 | this->datatype = ((uint8_t) (*(inbuffer + offset))); |
Jeonghoon | 3:2a3664dc6634 | 81 | offset += sizeof(this->datatype); |
Jeonghoon | 3:2a3664dc6634 | 82 | this->count = ((uint32_t) (*(inbuffer + offset))); |
Jeonghoon | 3:2a3664dc6634 | 83 | this->count |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Jeonghoon | 3:2a3664dc6634 | 84 | this->count |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Jeonghoon | 3:2a3664dc6634 | 85 | this->count |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Jeonghoon | 3:2a3664dc6634 | 86 | offset += sizeof(this->count); |
Jeonghoon | 3:2a3664dc6634 | 87 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 88 | } |
Jeonghoon | 3:2a3664dc6634 | 89 | |
Jeonghoon | 3:2a3664dc6634 | 90 | const char * getType(){ return "sensor_msgs/PointField"; }; |
Jeonghoon | 3:2a3664dc6634 | 91 | const char * getMD5(){ return "268eacb2962780ceac86cbd17e328150"; }; |
Jeonghoon | 3:2a3664dc6634 | 92 | |
Jeonghoon | 3:2a3664dc6634 | 93 | }; |
Jeonghoon | 3:2a3664dc6634 | 94 | |
Jeonghoon | 3:2a3664dc6634 | 95 | } |
Jeonghoon | 3:2a3664dc6634 | 96 | #endif |