complete motor

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Thu Nov 21 11:39:20 2019 +0000
Revision:
13:3ac8d2472417
Parent:
11:2228e8931266
complete motor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 11:2228e8931266 1 #ifndef _ROS_geometry_msgs_Quaternion_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_Quaternion_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 Quaternion : 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 typedef double _w_type;
Jeonghoon 11:2228e8931266 22 _w_type w;
Jeonghoon 11:2228e8931266 23
Jeonghoon 11:2228e8931266 24 Quaternion():
Jeonghoon 11:2228e8931266 25 x(0),
Jeonghoon 11:2228e8931266 26 y(0),
Jeonghoon 11:2228e8931266 27 z(0),
Jeonghoon 11:2228e8931266 28 w(0)
Jeonghoon 11:2228e8931266 29 {
Jeonghoon 11:2228e8931266 30 }
Jeonghoon 11:2228e8931266 31
Jeonghoon 11:2228e8931266 32 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 11:2228e8931266 33 {
Jeonghoon 11:2228e8931266 34 int offset = 0;
Jeonghoon 11:2228e8931266 35 union {
Jeonghoon 11:2228e8931266 36 double real;
Jeonghoon 11:2228e8931266 37 uint64_t base;
Jeonghoon 11:2228e8931266 38 } u_x;
Jeonghoon 11:2228e8931266 39 u_x.real = this->x;
Jeonghoon 11:2228e8931266 40 *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 41 *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 42 *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 43 *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 44 *(outbuffer + offset + 4) = (u_x.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 45 *(outbuffer + offset + 5) = (u_x.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 46 *(outbuffer + offset + 6) = (u_x.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 47 *(outbuffer + offset + 7) = (u_x.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 48 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 49 union {
Jeonghoon 11:2228e8931266 50 double real;
Jeonghoon 11:2228e8931266 51 uint64_t base;
Jeonghoon 11:2228e8931266 52 } u_y;
Jeonghoon 11:2228e8931266 53 u_y.real = this->y;
Jeonghoon 11:2228e8931266 54 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 55 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 56 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 57 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 58 *(outbuffer + offset + 4) = (u_y.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 59 *(outbuffer + offset + 5) = (u_y.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 60 *(outbuffer + offset + 6) = (u_y.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 61 *(outbuffer + offset + 7) = (u_y.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 62 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 63 union {
Jeonghoon 11:2228e8931266 64 double real;
Jeonghoon 11:2228e8931266 65 uint64_t base;
Jeonghoon 11:2228e8931266 66 } u_z;
Jeonghoon 11:2228e8931266 67 u_z.real = this->z;
Jeonghoon 11:2228e8931266 68 *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 69 *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 70 *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 71 *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 72 *(outbuffer + offset + 4) = (u_z.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 73 *(outbuffer + offset + 5) = (u_z.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 74 *(outbuffer + offset + 6) = (u_z.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 75 *(outbuffer + offset + 7) = (u_z.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 76 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 77 union {
Jeonghoon 11:2228e8931266 78 double real;
Jeonghoon 11:2228e8931266 79 uint64_t base;
Jeonghoon 11:2228e8931266 80 } u_w;
Jeonghoon 11:2228e8931266 81 u_w.real = this->w;
Jeonghoon 11:2228e8931266 82 *(outbuffer + offset + 0) = (u_w.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 83 *(outbuffer + offset + 1) = (u_w.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 84 *(outbuffer + offset + 2) = (u_w.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 85 *(outbuffer + offset + 3) = (u_w.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 86 *(outbuffer + offset + 4) = (u_w.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 87 *(outbuffer + offset + 5) = (u_w.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 88 *(outbuffer + offset + 6) = (u_w.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 89 *(outbuffer + offset + 7) = (u_w.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 90 offset += sizeof(this->w);
Jeonghoon 11:2228e8931266 91 return offset;
Jeonghoon 11:2228e8931266 92 }
Jeonghoon 11:2228e8931266 93
Jeonghoon 11:2228e8931266 94 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 11:2228e8931266 95 {
Jeonghoon 11:2228e8931266 96 int offset = 0;
Jeonghoon 11:2228e8931266 97 union {
Jeonghoon 11:2228e8931266 98 double real;
Jeonghoon 11:2228e8931266 99 uint64_t base;
Jeonghoon 11:2228e8931266 100 } u_x;
Jeonghoon 11:2228e8931266 101 u_x.base = 0;
Jeonghoon 11:2228e8931266 102 u_x.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 103 u_x.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 104 u_x.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 105 u_x.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 106 u_x.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 107 u_x.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 108 u_x.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 109 u_x.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 110 this->x = u_x.real;
Jeonghoon 11:2228e8931266 111 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 112 union {
Jeonghoon 11:2228e8931266 113 double real;
Jeonghoon 11:2228e8931266 114 uint64_t base;
Jeonghoon 11:2228e8931266 115 } u_y;
Jeonghoon 11:2228e8931266 116 u_y.base = 0;
Jeonghoon 11:2228e8931266 117 u_y.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 118 u_y.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 119 u_y.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 120 u_y.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 121 u_y.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 122 u_y.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 123 u_y.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 124 u_y.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 125 this->y = u_y.real;
Jeonghoon 11:2228e8931266 126 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 127 union {
Jeonghoon 11:2228e8931266 128 double real;
Jeonghoon 11:2228e8931266 129 uint64_t base;
Jeonghoon 11:2228e8931266 130 } u_z;
Jeonghoon 11:2228e8931266 131 u_z.base = 0;
Jeonghoon 11:2228e8931266 132 u_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 133 u_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 134 u_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 135 u_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 136 u_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 137 u_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 138 u_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 139 u_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 140 this->z = u_z.real;
Jeonghoon 11:2228e8931266 141 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 142 union {
Jeonghoon 11:2228e8931266 143 double real;
Jeonghoon 11:2228e8931266 144 uint64_t base;
Jeonghoon 11:2228e8931266 145 } u_w;
Jeonghoon 11:2228e8931266 146 u_w.base = 0;
Jeonghoon 11:2228e8931266 147 u_w.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 148 u_w.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 149 u_w.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 150 u_w.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 151 u_w.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 152 u_w.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 153 u_w.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 154 u_w.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 155 this->w = u_w.real;
Jeonghoon 11:2228e8931266 156 offset += sizeof(this->w);
Jeonghoon 11:2228e8931266 157 return offset;
Jeonghoon 11:2228e8931266 158 }
Jeonghoon 11:2228e8931266 159
Jeonghoon 11:2228e8931266 160 const char * getType(){ return "geometry_msgs/Quaternion"; };
Jeonghoon 11:2228e8931266 161 const char * getMD5(){ return "a779879fadf0160734f906b8c19c7004"; };
Jeonghoon 11:2228e8931266 162
Jeonghoon 11:2228e8931266 163 };
Jeonghoon 11:2228e8931266 164
Jeonghoon 11:2228e8931266 165 }
Jeonghoon 11:2228e8931266 166 #endif