complete motor

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Thu Jul 11 13:30:27 2019 +0000
Revision:
11:2228e8931266
190711; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 11:2228e8931266 1 #ifndef _ROS_geometry_msgs_Point_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_Point_h
Jeonghoon 11:2228e8931266 3
Jeonghoon 11:2228e8931266 4 #include <stdint.h>
Jeonghoon 11:2228e8931266 5 #include <string.h>
Jeonghoon 11:2228e8931266 6 #include <stdlib.h>
Jeonghoon 11:2228e8931266 7 #include "ros/msg.h"
Jeonghoon 11:2228e8931266 8
Jeonghoon 11:2228e8931266 9 namespace geometry_msgs
Jeonghoon 11:2228e8931266 10 {
Jeonghoon 11:2228e8931266 11
Jeonghoon 11:2228e8931266 12 class Point : public ros::Msg
Jeonghoon 11:2228e8931266 13 {
Jeonghoon 11:2228e8931266 14 public:
Jeonghoon 11:2228e8931266 15 typedef double _x_type;
Jeonghoon 11:2228e8931266 16 _x_type x;
Jeonghoon 11:2228e8931266 17 typedef double _y_type;
Jeonghoon 11:2228e8931266 18 _y_type y;
Jeonghoon 11:2228e8931266 19 typedef double _z_type;
Jeonghoon 11:2228e8931266 20 _z_type z;
Jeonghoon 11:2228e8931266 21
Jeonghoon 11:2228e8931266 22 Point():
Jeonghoon 11:2228e8931266 23 x(0),
Jeonghoon 11:2228e8931266 24 y(0),
Jeonghoon 11:2228e8931266 25 z(0)
Jeonghoon 11:2228e8931266 26 {
Jeonghoon 11:2228e8931266 27 }
Jeonghoon 11:2228e8931266 28
Jeonghoon 11:2228e8931266 29 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 11:2228e8931266 30 {
Jeonghoon 11:2228e8931266 31 int offset = 0;
Jeonghoon 11:2228e8931266 32 union {
Jeonghoon 11:2228e8931266 33 double real;
Jeonghoon 11:2228e8931266 34 uint64_t base;
Jeonghoon 11:2228e8931266 35 } u_x;
Jeonghoon 11:2228e8931266 36 u_x.real = this->x;
Jeonghoon 11:2228e8931266 37 *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 38 *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 39 *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 40 *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 41 *(outbuffer + offset + 4) = (u_x.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 42 *(outbuffer + offset + 5) = (u_x.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 43 *(outbuffer + offset + 6) = (u_x.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 44 *(outbuffer + offset + 7) = (u_x.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 45 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 46 union {
Jeonghoon 11:2228e8931266 47 double real;
Jeonghoon 11:2228e8931266 48 uint64_t base;
Jeonghoon 11:2228e8931266 49 } u_y;
Jeonghoon 11:2228e8931266 50 u_y.real = this->y;
Jeonghoon 11:2228e8931266 51 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 52 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 53 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 54 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 55 *(outbuffer + offset + 4) = (u_y.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 56 *(outbuffer + offset + 5) = (u_y.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 57 *(outbuffer + offset + 6) = (u_y.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 58 *(outbuffer + offset + 7) = (u_y.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 59 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 60 union {
Jeonghoon 11:2228e8931266 61 double real;
Jeonghoon 11:2228e8931266 62 uint64_t base;
Jeonghoon 11:2228e8931266 63 } u_z;
Jeonghoon 11:2228e8931266 64 u_z.real = this->z;
Jeonghoon 11:2228e8931266 65 *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 66 *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 67 *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 68 *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 69 *(outbuffer + offset + 4) = (u_z.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 70 *(outbuffer + offset + 5) = (u_z.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 71 *(outbuffer + offset + 6) = (u_z.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 72 *(outbuffer + offset + 7) = (u_z.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 73 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 74 return offset;
Jeonghoon 11:2228e8931266 75 }
Jeonghoon 11:2228e8931266 76
Jeonghoon 11:2228e8931266 77 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 11:2228e8931266 78 {
Jeonghoon 11:2228e8931266 79 int offset = 0;
Jeonghoon 11:2228e8931266 80 union {
Jeonghoon 11:2228e8931266 81 double real;
Jeonghoon 11:2228e8931266 82 uint64_t base;
Jeonghoon 11:2228e8931266 83 } u_x;
Jeonghoon 11:2228e8931266 84 u_x.base = 0;
Jeonghoon 11:2228e8931266 85 u_x.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 86 u_x.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 87 u_x.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 88 u_x.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 89 u_x.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 90 u_x.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 91 u_x.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 92 u_x.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 93 this->x = u_x.real;
Jeonghoon 11:2228e8931266 94 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 95 union {
Jeonghoon 11:2228e8931266 96 double real;
Jeonghoon 11:2228e8931266 97 uint64_t base;
Jeonghoon 11:2228e8931266 98 } u_y;
Jeonghoon 11:2228e8931266 99 u_y.base = 0;
Jeonghoon 11:2228e8931266 100 u_y.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 101 u_y.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 102 u_y.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 103 u_y.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 104 u_y.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 105 u_y.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 106 u_y.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 107 u_y.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 108 this->y = u_y.real;
Jeonghoon 11:2228e8931266 109 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 110 union {
Jeonghoon 11:2228e8931266 111 double real;
Jeonghoon 11:2228e8931266 112 uint64_t base;
Jeonghoon 11:2228e8931266 113 } u_z;
Jeonghoon 11:2228e8931266 114 u_z.base = 0;
Jeonghoon 11:2228e8931266 115 u_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 116 u_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 117 u_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 118 u_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 119 u_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 120 u_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 121 u_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 122 u_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 123 this->z = u_z.real;
Jeonghoon 11:2228e8931266 124 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 125 return offset;
Jeonghoon 11:2228e8931266 126 }
Jeonghoon 11:2228e8931266 127
Jeonghoon 11:2228e8931266 128 const char * getType(){ return "geometry_msgs/Point"; };
Jeonghoon 11:2228e8931266 129 const char * getMD5(){ return "4a842b65f413084dc2b10fb484ea7f17"; };
Jeonghoon 11:2228e8931266 130
Jeonghoon 11:2228e8931266 131 };
Jeonghoon 11:2228e8931266 132
Jeonghoon 11:2228e8931266 133 }
Jeonghoon 11:2228e8931266 134 #endif