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_Point32_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_Point32_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 Point32 : public ros::Msg
Jeonghoon 11:2228e8931266 13 {
Jeonghoon 11:2228e8931266 14 public:
Jeonghoon 11:2228e8931266 15 typedef float _x_type;
Jeonghoon 11:2228e8931266 16 _x_type x;
Jeonghoon 11:2228e8931266 17 typedef float _y_type;
Jeonghoon 11:2228e8931266 18 _y_type y;
Jeonghoon 11:2228e8931266 19 typedef float _z_type;
Jeonghoon 11:2228e8931266 20 _z_type z;
Jeonghoon 11:2228e8931266 21
Jeonghoon 11:2228e8931266 22 Point32():
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 float real;
Jeonghoon 11:2228e8931266 34 uint32_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 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 42 union {
Jeonghoon 11:2228e8931266 43 float real;
Jeonghoon 11:2228e8931266 44 uint32_t base;
Jeonghoon 11:2228e8931266 45 } u_y;
Jeonghoon 11:2228e8931266 46 u_y.real = this->y;
Jeonghoon 11:2228e8931266 47 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 48 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 49 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 50 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 51 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 52 union {
Jeonghoon 11:2228e8931266 53 float real;
Jeonghoon 11:2228e8931266 54 uint32_t base;
Jeonghoon 11:2228e8931266 55 } u_z;
Jeonghoon 11:2228e8931266 56 u_z.real = this->z;
Jeonghoon 11:2228e8931266 57 *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 58 *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 59 *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 60 *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 61 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 62 return offset;
Jeonghoon 11:2228e8931266 63 }
Jeonghoon 11:2228e8931266 64
Jeonghoon 11:2228e8931266 65 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 11:2228e8931266 66 {
Jeonghoon 11:2228e8931266 67 int offset = 0;
Jeonghoon 11:2228e8931266 68 union {
Jeonghoon 11:2228e8931266 69 float real;
Jeonghoon 11:2228e8931266 70 uint32_t base;
Jeonghoon 11:2228e8931266 71 } u_x;
Jeonghoon 11:2228e8931266 72 u_x.base = 0;
Jeonghoon 11:2228e8931266 73 u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 74 u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 75 u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 76 u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 77 this->x = u_x.real;
Jeonghoon 11:2228e8931266 78 offset += sizeof(this->x);
Jeonghoon 11:2228e8931266 79 union {
Jeonghoon 11:2228e8931266 80 float real;
Jeonghoon 11:2228e8931266 81 uint32_t base;
Jeonghoon 11:2228e8931266 82 } u_y;
Jeonghoon 11:2228e8931266 83 u_y.base = 0;
Jeonghoon 11:2228e8931266 84 u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 85 u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 86 u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 87 u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 88 this->y = u_y.real;
Jeonghoon 11:2228e8931266 89 offset += sizeof(this->y);
Jeonghoon 11:2228e8931266 90 union {
Jeonghoon 11:2228e8931266 91 float real;
Jeonghoon 11:2228e8931266 92 uint32_t base;
Jeonghoon 11:2228e8931266 93 } u_z;
Jeonghoon 11:2228e8931266 94 u_z.base = 0;
Jeonghoon 11:2228e8931266 95 u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 96 u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 97 u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 98 u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 99 this->z = u_z.real;
Jeonghoon 11:2228e8931266 100 offset += sizeof(this->z);
Jeonghoon 11:2228e8931266 101 return offset;
Jeonghoon 11:2228e8931266 102 }
Jeonghoon 11:2228e8931266 103
Jeonghoon 11:2228e8931266 104 const char * getType(){ return "geometry_msgs/Point32"; };
Jeonghoon 11:2228e8931266 105 const char * getMD5(){ return "cc153912f1453b708d221682bc23d9ac"; };
Jeonghoon 11:2228e8931266 106
Jeonghoon 11:2228e8931266 107 };
Jeonghoon 11:2228e8931266 108
Jeonghoon 11:2228e8931266 109 }
Jeonghoon 11:2228e8931266 110 #endif