Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h

Dependencies:   BufferedSerial

Dependents:   WRS2020_mecanum_node

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Polygon.h Source File

Polygon.h

00001 #ifndef _ROS_geometry_msgs_Polygon_h
00002 #define _ROS_geometry_msgs_Polygon_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "geometry_msgs/Point32.h"
00009 
00010 namespace geometry_msgs
00011 {
00012 
00013   class Polygon : public ros::Msg
00014   {
00015     public:
00016       uint32_t points_length;
00017       typedef geometry_msgs::Point32 _points_type;
00018       _points_type st_points;
00019       _points_type * points;
00020 
00021     Polygon():
00022       points_length(0), points(NULL)
00023     {
00024     }
00025 
00026     virtual int serialize(unsigned char *outbuffer) const
00027     {
00028       int offset = 0;
00029       *(outbuffer + offset + 0) = (this->points_length >> (8 * 0)) & 0xFF;
00030       *(outbuffer + offset + 1) = (this->points_length >> (8 * 1)) & 0xFF;
00031       *(outbuffer + offset + 2) = (this->points_length >> (8 * 2)) & 0xFF;
00032       *(outbuffer + offset + 3) = (this->points_length >> (8 * 3)) & 0xFF;
00033       offset += sizeof(this->points_length);
00034       for( uint32_t i = 0; i < points_length; i++){
00035       offset += this->points[i].serialize(outbuffer + offset);
00036       }
00037       return offset;
00038     }
00039 
00040     virtual int deserialize(unsigned char *inbuffer)
00041     {
00042       int offset = 0;
00043       uint32_t points_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00044       points_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00045       points_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00046       points_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00047       offset += sizeof(this->points_length);
00048       if(points_lengthT > points_length)
00049         this->points = (geometry_msgs::Point32*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point32));
00050       points_length = points_lengthT;
00051       for( uint32_t i = 0; i < points_length; i++){
00052       offset += this->st_points.deserialize(inbuffer + offset);
00053         memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point32));
00054       }
00055      return offset;
00056     }
00057 
00058     const char * getType(){ return "geometry_msgs/Polygon"; };
00059     const char * getMD5(){ return "cd60a26494a087f577976f0329fa120e"; };
00060 
00061   };
00062 
00063 }
00064 #endif