ROS Serial library for Mbed platforms for ROS Melodic Morenia. Check http://wiki.ros.org/rosserial_mbed/ for more information.
pcl_msgs/PolygonMesh.h@2:fa426560b283, 2021-05-27 (annotated)
- Committer:
- krogedal
- Date:
- Thu May 27 19:25:46 2021 +0000
- Revision:
- 2:fa426560b283
- Parent:
- 0:04ac6be8229a
no change
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gary Servin |
0:04ac6be8229a | 1 | #ifndef _ROS_pcl_msgs_PolygonMesh_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_pcl_msgs_PolygonMesh_h |
Gary Servin |
0:04ac6be8229a | 3 | |
Gary Servin |
0:04ac6be8229a | 4 | #include <stdint.h> |
Gary Servin |
0:04ac6be8229a | 5 | #include <string.h> |
Gary Servin |
0:04ac6be8229a | 6 | #include <stdlib.h> |
Gary Servin |
0:04ac6be8229a | 7 | #include "ros/msg.h" |
Gary Servin |
0:04ac6be8229a | 8 | #include "std_msgs/Header.h" |
Gary Servin |
0:04ac6be8229a | 9 | #include "sensor_msgs/PointCloud2.h" |
Gary Servin |
0:04ac6be8229a | 10 | #include "pcl_msgs/Vertices.h" |
Gary Servin |
0:04ac6be8229a | 11 | |
Gary Servin |
0:04ac6be8229a | 12 | namespace pcl_msgs |
Gary Servin |
0:04ac6be8229a | 13 | { |
Gary Servin |
0:04ac6be8229a | 14 | |
Gary Servin |
0:04ac6be8229a | 15 | class PolygonMesh : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 16 | { |
Gary Servin |
0:04ac6be8229a | 17 | public: |
Gary Servin |
0:04ac6be8229a | 18 | typedef std_msgs::Header _header_type; |
Gary Servin |
0:04ac6be8229a | 19 | _header_type header; |
Gary Servin |
0:04ac6be8229a | 20 | typedef sensor_msgs::PointCloud2 _cloud_type; |
Gary Servin |
0:04ac6be8229a | 21 | _cloud_type cloud; |
Gary Servin |
0:04ac6be8229a | 22 | uint32_t polygons_length; |
Gary Servin |
0:04ac6be8229a | 23 | typedef pcl_msgs::Vertices _polygons_type; |
Gary Servin |
0:04ac6be8229a | 24 | _polygons_type st_polygons; |
Gary Servin |
0:04ac6be8229a | 25 | _polygons_type * polygons; |
Gary Servin |
0:04ac6be8229a | 26 | |
Gary Servin |
0:04ac6be8229a | 27 | PolygonMesh(): |
Gary Servin |
0:04ac6be8229a | 28 | header(), |
Gary Servin |
0:04ac6be8229a | 29 | cloud(), |
Gary Servin |
0:04ac6be8229a | 30 | polygons_length(0), polygons(NULL) |
Gary Servin |
0:04ac6be8229a | 31 | { |
Gary Servin |
0:04ac6be8229a | 32 | } |
Gary Servin |
0:04ac6be8229a | 33 | |
Gary Servin |
0:04ac6be8229a | 34 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 35 | { |
Gary Servin |
0:04ac6be8229a | 36 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 37 | offset += this->header.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 38 | offset += this->cloud.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 39 | *(outbuffer + offset + 0) = (this->polygons_length >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 40 | *(outbuffer + offset + 1) = (this->polygons_length >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 41 | *(outbuffer + offset + 2) = (this->polygons_length >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 42 | *(outbuffer + offset + 3) = (this->polygons_length >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 43 | offset += sizeof(this->polygons_length); |
Gary Servin |
0:04ac6be8229a | 44 | for( uint32_t i = 0; i < polygons_length; i++){ |
Gary Servin |
0:04ac6be8229a | 45 | offset += this->polygons[i].serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 46 | } |
Gary Servin |
0:04ac6be8229a | 47 | return offset; |
Gary Servin |
0:04ac6be8229a | 48 | } |
Gary Servin |
0:04ac6be8229a | 49 | |
Gary Servin |
0:04ac6be8229a | 50 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 51 | { |
Gary Servin |
0:04ac6be8229a | 52 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 53 | offset += this->header.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 54 | offset += this->cloud.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 55 | uint32_t polygons_lengthT = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 56 | polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 57 | polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 58 | polygons_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 59 | offset += sizeof(this->polygons_length); |
Gary Servin |
0:04ac6be8229a | 60 | if(polygons_lengthT > polygons_length) |
Gary Servin |
0:04ac6be8229a | 61 | this->polygons = (pcl_msgs::Vertices*)realloc(this->polygons, polygons_lengthT * sizeof(pcl_msgs::Vertices)); |
Gary Servin |
0:04ac6be8229a | 62 | polygons_length = polygons_lengthT; |
Gary Servin |
0:04ac6be8229a | 63 | for( uint32_t i = 0; i < polygons_length; i++){ |
Gary Servin |
0:04ac6be8229a | 64 | offset += this->st_polygons.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 65 | memcpy( &(this->polygons[i]), &(this->st_polygons), sizeof(pcl_msgs::Vertices)); |
Gary Servin |
0:04ac6be8229a | 66 | } |
Gary Servin |
0:04ac6be8229a | 67 | return offset; |
Gary Servin |
0:04ac6be8229a | 68 | } |
Gary Servin |
0:04ac6be8229a | 69 | |
Gary Servin |
0:04ac6be8229a | 70 | const char * getType(){ return "pcl_msgs/PolygonMesh"; }; |
Gary Servin |
0:04ac6be8229a | 71 | const char * getMD5(){ return "45a5fc6ad2cde8489600a790acc9a38a"; }; |
Gary Servin |
0:04ac6be8229a | 72 | |
Gary Servin |
0:04ac6be8229a | 73 | }; |
Gary Servin |
0:04ac6be8229a | 74 | |
Gary Servin |
0:04ac6be8229a | 75 | } |
Gary Servin |
0:04ac6be8229a | 76 | #endif |