complete motor

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Thu Jun 27 04:58:29 2019 +0000
Revision:
7:13dd93a0efe8
combine motor with ROS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 7:13dd93a0efe8 1 #ifndef _ROS_std_msgs_Duration_h
Jeonghoon 7:13dd93a0efe8 2 #define _ROS_std_msgs_Duration_h
Jeonghoon 7:13dd93a0efe8 3
Jeonghoon 7:13dd93a0efe8 4 #include <stdint.h>
Jeonghoon 7:13dd93a0efe8 5 #include <string.h>
Jeonghoon 7:13dd93a0efe8 6 #include <stdlib.h>
Jeonghoon 7:13dd93a0efe8 7 #include "ros/msg.h"
Jeonghoon 7:13dd93a0efe8 8 #include "ros/duration.h"
Jeonghoon 7:13dd93a0efe8 9
Jeonghoon 7:13dd93a0efe8 10 namespace std_msgs
Jeonghoon 7:13dd93a0efe8 11 {
Jeonghoon 7:13dd93a0efe8 12
Jeonghoon 7:13dd93a0efe8 13 class Duration : public ros::Msg
Jeonghoon 7:13dd93a0efe8 14 {
Jeonghoon 7:13dd93a0efe8 15 public:
Jeonghoon 7:13dd93a0efe8 16 typedef ros::Duration _data_type;
Jeonghoon 7:13dd93a0efe8 17 _data_type data;
Jeonghoon 7:13dd93a0efe8 18
Jeonghoon 7:13dd93a0efe8 19 Duration():
Jeonghoon 7:13dd93a0efe8 20 data()
Jeonghoon 7:13dd93a0efe8 21 {
Jeonghoon 7:13dd93a0efe8 22 }
Jeonghoon 7:13dd93a0efe8 23
Jeonghoon 7:13dd93a0efe8 24 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 7:13dd93a0efe8 25 {
Jeonghoon 7:13dd93a0efe8 26 int offset = 0;
Jeonghoon 7:13dd93a0efe8 27 *(outbuffer + offset + 0) = (this->data.sec >> (8 * 0)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 28 *(outbuffer + offset + 1) = (this->data.sec >> (8 * 1)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 29 *(outbuffer + offset + 2) = (this->data.sec >> (8 * 2)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 30 *(outbuffer + offset + 3) = (this->data.sec >> (8 * 3)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 31 offset += sizeof(this->data.sec);
Jeonghoon 7:13dd93a0efe8 32 *(outbuffer + offset + 0) = (this->data.nsec >> (8 * 0)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 33 *(outbuffer + offset + 1) = (this->data.nsec >> (8 * 1)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 34 *(outbuffer + offset + 2) = (this->data.nsec >> (8 * 2)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 35 *(outbuffer + offset + 3) = (this->data.nsec >> (8 * 3)) & 0xFF;
Jeonghoon 7:13dd93a0efe8 36 offset += sizeof(this->data.nsec);
Jeonghoon 7:13dd93a0efe8 37 return offset;
Jeonghoon 7:13dd93a0efe8 38 }
Jeonghoon 7:13dd93a0efe8 39
Jeonghoon 7:13dd93a0efe8 40 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 7:13dd93a0efe8 41 {
Jeonghoon 7:13dd93a0efe8 42 int offset = 0;
Jeonghoon 7:13dd93a0efe8 43 this->data.sec = ((uint32_t) (*(inbuffer + offset)));
Jeonghoon 7:13dd93a0efe8 44 this->data.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 7:13dd93a0efe8 45 this->data.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 7:13dd93a0efe8 46 this->data.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 7:13dd93a0efe8 47 offset += sizeof(this->data.sec);
Jeonghoon 7:13dd93a0efe8 48 this->data.nsec = ((uint32_t) (*(inbuffer + offset)));
Jeonghoon 7:13dd93a0efe8 49 this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 7:13dd93a0efe8 50 this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 7:13dd93a0efe8 51 this->data.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 7:13dd93a0efe8 52 offset += sizeof(this->data.nsec);
Jeonghoon 7:13dd93a0efe8 53 return offset;
Jeonghoon 7:13dd93a0efe8 54 }
Jeonghoon 7:13dd93a0efe8 55
Jeonghoon 7:13dd93a0efe8 56 const char * getType(){ return "std_msgs/Duration"; };
Jeonghoon 7:13dd93a0efe8 57 const char * getMD5(){ return "3e286caf4241d664e55f3ad380e2ae46"; };
Jeonghoon 7:13dd93a0efe8 58
Jeonghoon 7:13dd93a0efe8 59 };
Jeonghoon 7:13dd93a0efe8 60
Jeonghoon 7:13dd93a0efe8 61 }
Jeonghoon 7:13dd93a0efe8 62 #endif