complete motor
Dependencies: BufferedSerial motor_sn7544
std_msgs/Int64.h@13:3ac8d2472417, 2019-11-21 (annotated)
- Committer:
- Jeonghoon
- Date:
- Thu Nov 21 11:39:20 2019 +0000
- Revision:
- 13:3ac8d2472417
- Parent:
- 7:13dd93a0efe8
complete motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 7:13dd93a0efe8 | 1 | #ifndef _ROS_std_msgs_Int64_h |
Jeonghoon | 7:13dd93a0efe8 | 2 | #define _ROS_std_msgs_Int64_h |
Jeonghoon | 7:13dd93a0efe8 | 3 | |
Jeonghoon | 7:13dd93a0efe8 | 4 | #include <stdint.h> |
Jeonghoon | 7:13dd93a0efe8 | 5 | #include <string.h> |
Jeonghoon | 7:13dd93a0efe8 | 6 | #include <stdlib.h> |
Jeonghoon | 7:13dd93a0efe8 | 7 | #include "ros/msg.h" |
Jeonghoon | 7:13dd93a0efe8 | 8 | |
Jeonghoon | 7:13dd93a0efe8 | 9 | namespace std_msgs |
Jeonghoon | 7:13dd93a0efe8 | 10 | { |
Jeonghoon | 7:13dd93a0efe8 | 11 | |
Jeonghoon | 7:13dd93a0efe8 | 12 | class Int64 : public ros::Msg |
Jeonghoon | 7:13dd93a0efe8 | 13 | { |
Jeonghoon | 7:13dd93a0efe8 | 14 | public: |
Jeonghoon | 7:13dd93a0efe8 | 15 | typedef int64_t _data_type; |
Jeonghoon | 7:13dd93a0efe8 | 16 | _data_type data; |
Jeonghoon | 7:13dd93a0efe8 | 17 | |
Jeonghoon | 7:13dd93a0efe8 | 18 | Int64(): |
Jeonghoon | 7:13dd93a0efe8 | 19 | data(0) |
Jeonghoon | 7:13dd93a0efe8 | 20 | { |
Jeonghoon | 7:13dd93a0efe8 | 21 | } |
Jeonghoon | 7:13dd93a0efe8 | 22 | |
Jeonghoon | 7:13dd93a0efe8 | 23 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 7:13dd93a0efe8 | 24 | { |
Jeonghoon | 7:13dd93a0efe8 | 25 | int offset = 0; |
Jeonghoon | 7:13dd93a0efe8 | 26 | union { |
Jeonghoon | 7:13dd93a0efe8 | 27 | int64_t real; |
Jeonghoon | 7:13dd93a0efe8 | 28 | uint64_t base; |
Jeonghoon | 7:13dd93a0efe8 | 29 | } u_data; |
Jeonghoon | 7:13dd93a0efe8 | 30 | u_data.real = this->data; |
Jeonghoon | 7:13dd93a0efe8 | 31 | *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 32 | *(outbuffer + offset + 1) = (u_data.base >> (8 * 1)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 33 | *(outbuffer + offset + 2) = (u_data.base >> (8 * 2)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 34 | *(outbuffer + offset + 3) = (u_data.base >> (8 * 3)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 35 | *(outbuffer + offset + 4) = (u_data.base >> (8 * 4)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 36 | *(outbuffer + offset + 5) = (u_data.base >> (8 * 5)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 37 | *(outbuffer + offset + 6) = (u_data.base >> (8 * 6)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 38 | *(outbuffer + offset + 7) = (u_data.base >> (8 * 7)) & 0xFF; |
Jeonghoon | 7:13dd93a0efe8 | 39 | offset += sizeof(this->data); |
Jeonghoon | 7:13dd93a0efe8 | 40 | return offset; |
Jeonghoon | 7:13dd93a0efe8 | 41 | } |
Jeonghoon | 7:13dd93a0efe8 | 42 | |
Jeonghoon | 7:13dd93a0efe8 | 43 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 7:13dd93a0efe8 | 44 | { |
Jeonghoon | 7:13dd93a0efe8 | 45 | int offset = 0; |
Jeonghoon | 7:13dd93a0efe8 | 46 | union { |
Jeonghoon | 7:13dd93a0efe8 | 47 | int64_t real; |
Jeonghoon | 7:13dd93a0efe8 | 48 | uint64_t base; |
Jeonghoon | 7:13dd93a0efe8 | 49 | } u_data; |
Jeonghoon | 7:13dd93a0efe8 | 50 | u_data.base = 0; |
Jeonghoon | 7:13dd93a0efe8 | 51 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Jeonghoon | 7:13dd93a0efe8 | 52 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Jeonghoon | 7:13dd93a0efe8 | 53 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Jeonghoon | 7:13dd93a0efe8 | 54 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Jeonghoon | 7:13dd93a0efe8 | 55 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
Jeonghoon | 7:13dd93a0efe8 | 56 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
Jeonghoon | 7:13dd93a0efe8 | 57 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
Jeonghoon | 7:13dd93a0efe8 | 58 | u_data.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
Jeonghoon | 7:13dd93a0efe8 | 59 | this->data = u_data.real; |
Jeonghoon | 7:13dd93a0efe8 | 60 | offset += sizeof(this->data); |
Jeonghoon | 7:13dd93a0efe8 | 61 | return offset; |
Jeonghoon | 7:13dd93a0efe8 | 62 | } |
Jeonghoon | 7:13dd93a0efe8 | 63 | |
Jeonghoon | 7:13dd93a0efe8 | 64 | const char * getType(){ return "std_msgs/Int64"; }; |
Jeonghoon | 7:13dd93a0efe8 | 65 | const char * getMD5(){ return "34add168574510e6e17f5d23ecc077ef"; }; |
Jeonghoon | 7:13dd93a0efe8 | 66 | |
Jeonghoon | 7:13dd93a0efe8 | 67 | }; |
Jeonghoon | 7:13dd93a0efe8 | 68 | |
Jeonghoon | 7:13dd93a0efe8 | 69 | } |
Jeonghoon | 7:13dd93a0efe8 | 70 | #endif |