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_AccelWithCovariance_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_AccelWithCovariance_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 #include "geometry_msgs/Accel.h"
Jeonghoon 11:2228e8931266 9
Jeonghoon 11:2228e8931266 10 namespace geometry_msgs
Jeonghoon 11:2228e8931266 11 {
Jeonghoon 11:2228e8931266 12
Jeonghoon 11:2228e8931266 13 class AccelWithCovariance : public ros::Msg
Jeonghoon 11:2228e8931266 14 {
Jeonghoon 11:2228e8931266 15 public:
Jeonghoon 11:2228e8931266 16 typedef geometry_msgs::Accel _accel_type;
Jeonghoon 11:2228e8931266 17 _accel_type accel;
Jeonghoon 11:2228e8931266 18 double covariance[36];
Jeonghoon 11:2228e8931266 19
Jeonghoon 11:2228e8931266 20 AccelWithCovariance():
Jeonghoon 11:2228e8931266 21 accel(),
Jeonghoon 11:2228e8931266 22 covariance()
Jeonghoon 11:2228e8931266 23 {
Jeonghoon 11:2228e8931266 24 }
Jeonghoon 11:2228e8931266 25
Jeonghoon 11:2228e8931266 26 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 11:2228e8931266 27 {
Jeonghoon 11:2228e8931266 28 int offset = 0;
Jeonghoon 11:2228e8931266 29 offset += this->accel.serialize(outbuffer + offset);
Jeonghoon 11:2228e8931266 30 for( uint32_t i = 0; i < 36; i++){
Jeonghoon 11:2228e8931266 31 union {
Jeonghoon 11:2228e8931266 32 double real;
Jeonghoon 11:2228e8931266 33 uint64_t base;
Jeonghoon 11:2228e8931266 34 } u_covariancei;
Jeonghoon 11:2228e8931266 35 u_covariancei.real = this->covariance[i];
Jeonghoon 11:2228e8931266 36 *(outbuffer + offset + 0) = (u_covariancei.base >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 37 *(outbuffer + offset + 1) = (u_covariancei.base >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 38 *(outbuffer + offset + 2) = (u_covariancei.base >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 39 *(outbuffer + offset + 3) = (u_covariancei.base >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 40 *(outbuffer + offset + 4) = (u_covariancei.base >> (8 * 4)) & 0xFF;
Jeonghoon 11:2228e8931266 41 *(outbuffer + offset + 5) = (u_covariancei.base >> (8 * 5)) & 0xFF;
Jeonghoon 11:2228e8931266 42 *(outbuffer + offset + 6) = (u_covariancei.base >> (8 * 6)) & 0xFF;
Jeonghoon 11:2228e8931266 43 *(outbuffer + offset + 7) = (u_covariancei.base >> (8 * 7)) & 0xFF;
Jeonghoon 11:2228e8931266 44 offset += sizeof(this->covariance[i]);
Jeonghoon 11:2228e8931266 45 }
Jeonghoon 11:2228e8931266 46 return offset;
Jeonghoon 11:2228e8931266 47 }
Jeonghoon 11:2228e8931266 48
Jeonghoon 11:2228e8931266 49 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 11:2228e8931266 50 {
Jeonghoon 11:2228e8931266 51 int offset = 0;
Jeonghoon 11:2228e8931266 52 offset += this->accel.deserialize(inbuffer + offset);
Jeonghoon 11:2228e8931266 53 for( uint32_t i = 0; i < 36; i++){
Jeonghoon 11:2228e8931266 54 union {
Jeonghoon 11:2228e8931266 55 double real;
Jeonghoon 11:2228e8931266 56 uint64_t base;
Jeonghoon 11:2228e8931266 57 } u_covariancei;
Jeonghoon 11:2228e8931266 58 u_covariancei.base = 0;
Jeonghoon 11:2228e8931266 59 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 11:2228e8931266 60 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 61 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 62 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 63 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 11:2228e8931266 64 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 11:2228e8931266 65 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 11:2228e8931266 66 u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 11:2228e8931266 67 this->covariance[i] = u_covariancei.real;
Jeonghoon 11:2228e8931266 68 offset += sizeof(this->covariance[i]);
Jeonghoon 11:2228e8931266 69 }
Jeonghoon 11:2228e8931266 70 return offset;
Jeonghoon 11:2228e8931266 71 }
Jeonghoon 11:2228e8931266 72
Jeonghoon 11:2228e8931266 73 const char * getType(){ return "geometry_msgs/AccelWithCovariance"; };
Jeonghoon 11:2228e8931266 74 const char * getMD5(){ return "ad5a718d699c6be72a02b8d6a139f334"; };
Jeonghoon 11:2228e8931266 75
Jeonghoon 11:2228e8931266 76 };
Jeonghoon 11:2228e8931266 77
Jeonghoon 11:2228e8931266 78 }
Jeonghoon 11:2228e8931266 79 #endif