capstone_finish
Dependencies: BufferedSerial motor_sn7544
std_msgs/Float64.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_std_msgs_Float64_h |
Jeonghoon | 3:2a3664dc6634 | 2 | #define _ROS_std_msgs_Float64_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 std_msgs |
Jeonghoon | 3:2a3664dc6634 | 10 | { |
Jeonghoon | 3:2a3664dc6634 | 11 | |
Jeonghoon | 3:2a3664dc6634 | 12 | class Float64 : public ros::Msg |
Jeonghoon | 3:2a3664dc6634 | 13 | { |
Jeonghoon | 3:2a3664dc6634 | 14 | public: |
Jeonghoon | 3:2a3664dc6634 | 15 | typedef double _data_type; |
Jeonghoon | 3:2a3664dc6634 | 16 | _data_type data; |
Jeonghoon | 3:2a3664dc6634 | 17 | |
Jeonghoon | 3:2a3664dc6634 | 18 | Float64(): |
Jeonghoon | 3:2a3664dc6634 | 19 | data(0) |
Jeonghoon | 3:2a3664dc6634 | 20 | { |
Jeonghoon | 3:2a3664dc6634 | 21 | } |
Jeonghoon | 3:2a3664dc6634 | 22 | |
Jeonghoon | 3:2a3664dc6634 | 23 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 3:2a3664dc6634 | 24 | { |
Jeonghoon | 3:2a3664dc6634 | 25 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 26 | union { |
Jeonghoon | 3:2a3664dc6634 | 27 | double real; |
Jeonghoon | 3:2a3664dc6634 | 28 | uint64_t base; |
Jeonghoon | 3:2a3664dc6634 | 29 | } u_data; |
Jeonghoon | 3:2a3664dc6634 | 30 | u_data.real = this->data; |
Jeonghoon | 3:2a3664dc6634 | 31 | *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 32 | *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 33 | *(outbuffer + offset + 2) = (u_data.base >> (8 * 2)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 34 | *(outbuffer + offset + 3) = (u_data.base >> (8 * 3)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 35 | *(outbuffer + offset + 4) = (u_data.base >> (8 * 4)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 36 | *(outbuffer + offset + 5) = (u_data.base >> (8 * 5)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 37 | *(outbuffer + offset + 6) = (u_data.base >> (8 * 6)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 38 | *(outbuffer + offset + 7) = (u_data.base >> (8 * 7)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 39 | offset += sizeof(this->data); |
Jeonghoon | 3:2a3664dc6634 | 40 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 41 | } |
Jeonghoon | 3:2a3664dc6634 | 42 | |
Jeonghoon | 3:2a3664dc6634 | 43 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 3:2a3664dc6634 | 44 | { |
Jeonghoon | 3:2a3664dc6634 | 45 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 46 | union { |
Jeonghoon | 3:2a3664dc6634 | 47 | double real; |
Jeonghoon | 3:2a3664dc6634 | 48 | uint64_t base; |
Jeonghoon | 3:2a3664dc6634 | 49 | } u_data; |
Jeonghoon | 3:2a3664dc6634 | 50 | u_data.base = 0; |
Jeonghoon | 3:2a3664dc6634 | 51 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Jeonghoon | 3:2a3664dc6634 | 52 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Jeonghoon | 3:2a3664dc6634 | 53 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Jeonghoon | 3:2a3664dc6634 | 54 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Jeonghoon | 3:2a3664dc6634 | 55 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
Jeonghoon | 3:2a3664dc6634 | 56 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
Jeonghoon | 3:2a3664dc6634 | 57 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
Jeonghoon | 3:2a3664dc6634 | 58 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
Jeonghoon | 3:2a3664dc6634 | 59 | this->data = u_data.real; |
Jeonghoon | 3:2a3664dc6634 | 60 | offset += sizeof(this->data); |
Jeonghoon | 3:2a3664dc6634 | 61 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 62 | } |
Jeonghoon | 3:2a3664dc6634 | 63 | |
Jeonghoon | 3:2a3664dc6634 | 64 | const char * getType(){ return "std_msgs/Float64"; }; |
Jeonghoon | 3:2a3664dc6634 | 65 | const char * getMD5(){ return "fdb28210bfa9d7c91146260178d9a584"; }; |
Jeonghoon | 3:2a3664dc6634 | 66 | |
Jeonghoon | 3:2a3664dc6634 | 67 | }; |
Jeonghoon | 3:2a3664dc6634 | 68 | |
Jeonghoon | 3:2a3664dc6634 | 69 | } |
Jeonghoon | 3:2a3664dc6634 | 70 | #endif |