Irfan Tito Kurniawan / ros_lib
Committer:
irfantitok
Date:
Wed Sep 02 13:51:31 2020 +0000
Revision:
0:8f3710bfd298
Resolved round not found

Who changed what in which revision?

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