complete motor
Dependencies: BufferedSerial motor_sn7544
std_msgs/Header.h
- Committer:
- Jeonghoon
- Date:
- 2019-11-21
- Revision:
- 13:3ac8d2472417
- Parent:
- 7:13dd93a0efe8
File content as of revision 13:3ac8d2472417:
#ifndef _ROS_std_msgs_Header_h #define _ROS_std_msgs_Header_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" #include "ros/time.h" namespace std_msgs { class Header : public ros::Msg { public: typedef uint32_t _seq_type; _seq_type seq; typedef ros::Time _stamp_type; _stamp_type stamp; typedef const char* _frame_id_type; _frame_id_type frame_id; Header(): seq(0), stamp(), frame_id("") { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; *(outbuffer + offset + 0) = (this->seq >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->seq >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->seq >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->seq >> (8 * 3)) & 0xFF; offset += sizeof(this->seq); *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF; offset += sizeof(this->stamp.sec); *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF; offset += sizeof(this->stamp.nsec); uint32_t length_frame_id = strlen(this->frame_id); varToArr(outbuffer + offset, length_frame_id); offset += 4; memcpy(outbuffer + offset, this->frame_id, length_frame_id); offset += length_frame_id; return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; this->seq = ((uint32_t) (*(inbuffer + offset))); this->seq |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); this->seq |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); this->seq |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->seq); this->stamp.sec = ((uint32_t) (*(inbuffer + offset))); this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->stamp.sec); this->stamp.nsec = ((uint32_t) (*(inbuffer + offset))); this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->stamp.nsec); uint32_t length_frame_id; arrToVar(length_frame_id, (inbuffer + offset)); offset += 4; for(unsigned int k= offset; k< offset+length_frame_id; ++k){ inbuffer[k-1]=inbuffer[k]; } inbuffer[offset+length_frame_id-1]=0; this->frame_id = (char *)(inbuffer + offset-1); offset += length_frame_id; return offset; } const char * getType(){ return "std_msgs/Header"; }; const char * getMD5(){ return "2176decaecbce78abc3b96ef049fabed"; }; }; } #endif