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_PoseArray_h
Jeonghoon 11:2228e8931266 2 #define _ROS_geometry_msgs_PoseArray_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 "std_msgs/Header.h"
Jeonghoon 11:2228e8931266 9 #include "geometry_msgs/Pose.h"
Jeonghoon 11:2228e8931266 10
Jeonghoon 11:2228e8931266 11 namespace geometry_msgs
Jeonghoon 11:2228e8931266 12 {
Jeonghoon 11:2228e8931266 13
Jeonghoon 11:2228e8931266 14 class PoseArray : public ros::Msg
Jeonghoon 11:2228e8931266 15 {
Jeonghoon 11:2228e8931266 16 public:
Jeonghoon 11:2228e8931266 17 typedef std_msgs::Header _header_type;
Jeonghoon 11:2228e8931266 18 _header_type header;
Jeonghoon 11:2228e8931266 19 uint32_t poses_length;
Jeonghoon 11:2228e8931266 20 typedef geometry_msgs::Pose _poses_type;
Jeonghoon 11:2228e8931266 21 _poses_type st_poses;
Jeonghoon 11:2228e8931266 22 _poses_type * poses;
Jeonghoon 11:2228e8931266 23
Jeonghoon 11:2228e8931266 24 PoseArray():
Jeonghoon 11:2228e8931266 25 header(),
Jeonghoon 11:2228e8931266 26 poses_length(0), poses(NULL)
Jeonghoon 11:2228e8931266 27 {
Jeonghoon 11:2228e8931266 28 }
Jeonghoon 11:2228e8931266 29
Jeonghoon 11:2228e8931266 30 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 11:2228e8931266 31 {
Jeonghoon 11:2228e8931266 32 int offset = 0;
Jeonghoon 11:2228e8931266 33 offset += this->header.serialize(outbuffer + offset);
Jeonghoon 11:2228e8931266 34 *(outbuffer + offset + 0) = (this->poses_length >> (8 * 0)) & 0xFF;
Jeonghoon 11:2228e8931266 35 *(outbuffer + offset + 1) = (this->poses_length >> (8 * 1)) & 0xFF;
Jeonghoon 11:2228e8931266 36 *(outbuffer + offset + 2) = (this->poses_length >> (8 * 2)) & 0xFF;
Jeonghoon 11:2228e8931266 37 *(outbuffer + offset + 3) = (this->poses_length >> (8 * 3)) & 0xFF;
Jeonghoon 11:2228e8931266 38 offset += sizeof(this->poses_length);
Jeonghoon 11:2228e8931266 39 for( uint32_t i = 0; i < poses_length; i++){
Jeonghoon 11:2228e8931266 40 offset += this->poses[i].serialize(outbuffer + offset);
Jeonghoon 11:2228e8931266 41 }
Jeonghoon 11:2228e8931266 42 return offset;
Jeonghoon 11:2228e8931266 43 }
Jeonghoon 11:2228e8931266 44
Jeonghoon 11:2228e8931266 45 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 11:2228e8931266 46 {
Jeonghoon 11:2228e8931266 47 int offset = 0;
Jeonghoon 11:2228e8931266 48 offset += this->header.deserialize(inbuffer + offset);
Jeonghoon 11:2228e8931266 49 uint32_t poses_lengthT = ((uint32_t) (*(inbuffer + offset)));
Jeonghoon 11:2228e8931266 50 poses_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 11:2228e8931266 51 poses_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 11:2228e8931266 52 poses_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 11:2228e8931266 53 offset += sizeof(this->poses_length);
Jeonghoon 11:2228e8931266 54 if(poses_lengthT > poses_length)
Jeonghoon 11:2228e8931266 55 this->poses = (geometry_msgs::Pose*)realloc(this->poses, poses_lengthT * sizeof(geometry_msgs::Pose));
Jeonghoon 11:2228e8931266 56 poses_length = poses_lengthT;
Jeonghoon 11:2228e8931266 57 for( uint32_t i = 0; i < poses_length; i++){
Jeonghoon 11:2228e8931266 58 offset += this->st_poses.deserialize(inbuffer + offset);
Jeonghoon 11:2228e8931266 59 memcpy( &(this->poses[i]), &(this->st_poses), sizeof(geometry_msgs::Pose));
Jeonghoon 11:2228e8931266 60 }
Jeonghoon 11:2228e8931266 61 return offset;
Jeonghoon 11:2228e8931266 62 }
Jeonghoon 11:2228e8931266 63
Jeonghoon 11:2228e8931266 64 const char * getType(){ return "geometry_msgs/PoseArray"; };
Jeonghoon 11:2228e8931266 65 const char * getMD5(){ return "916c28c5764443f268b296bb671b9d97"; };
Jeonghoon 11:2228e8931266 66
Jeonghoon 11:2228e8931266 67 };
Jeonghoon 11:2228e8931266 68
Jeonghoon 11:2228e8931266 69 }
Jeonghoon 11:2228e8931266 70 #endif