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_PoseWithCovariance_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_PoseWithCovariance_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/Pose.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 PoseWithCovariance : public ros::Msg
Jeonghoon 11:2228e8931266 14 {
Jeonghoon 11:2228e8931266 15 public:
Jeonghoon 11:2228e8931266 16 typedef geometry_msgs::Pose _pose_type;
Jeonghoon 11:2228e8931266 17 _pose_type pose;
Jeonghoon 11:2228e8931266 18 double covariance[36];
Jeonghoon 11:2228e8931266 19
Jeonghoon 11:2228e8931266 20 PoseWithCovariance():
Jeonghoon 11:2228e8931266 21 pose(),
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->pose.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->pose.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/PoseWithCovariance"; };
Jeonghoon 11:2228e8931266 74 const char * getMD5(){ return "c23e848cf1b7533a8d7c259073a97e6f"; };
Jeonghoon 11:2228e8931266 75
Jeonghoon 11:2228e8931266 76 };
Jeonghoon 11:2228e8931266 77
Jeonghoon 11:2228e8931266 78 }
Jeonghoon 11:2228e8931266 79 #endif