ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.

Dependencies:   BufferedSerial

Committer:
garyservin
Date:
Sat Dec 31 00:48:34 2016 +0000
Revision:
0:9e9b7db60fd5
Initial commit, generated based on a clean kinetic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_pcl_msgs_PolygonMesh_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_pcl_msgs_PolygonMesh_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "std_msgs/Header.h"
garyservin 0:9e9b7db60fd5 9 #include "sensor_msgs/PointCloud2.h"
garyservin 0:9e9b7db60fd5 10 #include "pcl_msgs/Vertices.h"
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 namespace pcl_msgs
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14
garyservin 0:9e9b7db60fd5 15 class PolygonMesh : public ros::Msg
garyservin 0:9e9b7db60fd5 16 {
garyservin 0:9e9b7db60fd5 17 public:
garyservin 0:9e9b7db60fd5 18 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 19 _header_type header;
garyservin 0:9e9b7db60fd5 20 typedef sensor_msgs::PointCloud2 _cloud_type;
garyservin 0:9e9b7db60fd5 21 _cloud_type cloud;
garyservin 0:9e9b7db60fd5 22 uint32_t polygons_length;
garyservin 0:9e9b7db60fd5 23 typedef pcl_msgs::Vertices _polygons_type;
garyservin 0:9e9b7db60fd5 24 _polygons_type st_polygons;
garyservin 0:9e9b7db60fd5 25 _polygons_type * polygons;
garyservin 0:9e9b7db60fd5 26
garyservin 0:9e9b7db60fd5 27 PolygonMesh():
garyservin 0:9e9b7db60fd5 28 header(),
garyservin 0:9e9b7db60fd5 29 cloud(),
garyservin 0:9e9b7db60fd5 30 polygons_length(0), polygons(NULL)
garyservin 0:9e9b7db60fd5 31 {
garyservin 0:9e9b7db60fd5 32 }
garyservin 0:9e9b7db60fd5 33
garyservin 0:9e9b7db60fd5 34 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 35 {
garyservin 0:9e9b7db60fd5 36 int offset = 0;
garyservin 0:9e9b7db60fd5 37 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 38 offset += this->cloud.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 39 *(outbuffer + offset + 0) = (this->polygons_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 40 *(outbuffer + offset + 1) = (this->polygons_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 41 *(outbuffer + offset + 2) = (this->polygons_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 42 *(outbuffer + offset + 3) = (this->polygons_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 43 offset += sizeof(this->polygons_length);
garyservin 0:9e9b7db60fd5 44 for( uint32_t i = 0; i < polygons_length; i++){
garyservin 0:9e9b7db60fd5 45 offset += this->polygons[i].serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 46 }
garyservin 0:9e9b7db60fd5 47 return offset;
garyservin 0:9e9b7db60fd5 48 }
garyservin 0:9e9b7db60fd5 49
garyservin 0:9e9b7db60fd5 50 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 51 {
garyservin 0:9e9b7db60fd5 52 int offset = 0;
garyservin 0:9e9b7db60fd5 53 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 54 offset += this->cloud.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 55 uint32_t polygons_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 56 polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 57 polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 58 polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 59 offset += sizeof(this->polygons_length);
garyservin 0:9e9b7db60fd5 60 if(polygons_lengthT > polygons_length)
garyservin 0:9e9b7db60fd5 61 this->polygons = (pcl_msgs::Vertices*)realloc(this->polygons, polygons_lengthT * sizeof(pcl_msgs::Vertices));
garyservin 0:9e9b7db60fd5 62 polygons_length = polygons_lengthT;
garyservin 0:9e9b7db60fd5 63 for( uint32_t i = 0; i < polygons_length; i++){
garyservin 0:9e9b7db60fd5 64 offset += this->st_polygons.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 65 memcpy( &(this->polygons[i]), &(this->st_polygons), sizeof(pcl_msgs::Vertices));
garyservin 0:9e9b7db60fd5 66 }
garyservin 0:9e9b7db60fd5 67 return offset;
garyservin 0:9e9b7db60fd5 68 }
garyservin 0:9e9b7db60fd5 69
garyservin 0:9e9b7db60fd5 70 const char * getType(){ return "pcl_msgs/PolygonMesh"; };
garyservin 0:9e9b7db60fd5 71 const char * getMD5(){ return "45a5fc6ad2cde8489600a790acc9a38a"; };
garyservin 0:9e9b7db60fd5 72
garyservin 0:9e9b7db60fd5 73 };
garyservin 0:9e9b7db60fd5 74
garyservin 0:9e9b7db60fd5 75 }
garyservin 0:9e9b7db60fd5 76 #endif