
test
ros_lib_melodic/nav_msgs/GridCells.h@2:b7fdc74e5c5d, 2020-07-07 (annotated)
- Committer:
- ommpy
- Date:
- Tue Jul 07 15:19:06 2020 +0530
- Revision:
- 2:b7fdc74e5c5d
new board files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ommpy | 2:b7fdc74e5c5d | 1 | #ifndef _ROS_nav_msgs_GridCells_h |
ommpy | 2:b7fdc74e5c5d | 2 | #define _ROS_nav_msgs_GridCells_h |
ommpy | 2:b7fdc74e5c5d | 3 | |
ommpy | 2:b7fdc74e5c5d | 4 | #include <stdint.h> |
ommpy | 2:b7fdc74e5c5d | 5 | #include <string.h> |
ommpy | 2:b7fdc74e5c5d | 6 | #include <stdlib.h> |
ommpy | 2:b7fdc74e5c5d | 7 | #include "ros/msg.h" |
ommpy | 2:b7fdc74e5c5d | 8 | #include "std_msgs/Header.h" |
ommpy | 2:b7fdc74e5c5d | 9 | #include "geometry_msgs/Point.h" |
ommpy | 2:b7fdc74e5c5d | 10 | |
ommpy | 2:b7fdc74e5c5d | 11 | namespace nav_msgs |
ommpy | 2:b7fdc74e5c5d | 12 | { |
ommpy | 2:b7fdc74e5c5d | 13 | |
ommpy | 2:b7fdc74e5c5d | 14 | class GridCells : public ros::Msg |
ommpy | 2:b7fdc74e5c5d | 15 | { |
ommpy | 2:b7fdc74e5c5d | 16 | public: |
ommpy | 2:b7fdc74e5c5d | 17 | typedef std_msgs::Header _header_type; |
ommpy | 2:b7fdc74e5c5d | 18 | _header_type header; |
ommpy | 2:b7fdc74e5c5d | 19 | typedef float _cell_width_type; |
ommpy | 2:b7fdc74e5c5d | 20 | _cell_width_type cell_width; |
ommpy | 2:b7fdc74e5c5d | 21 | typedef float _cell_height_type; |
ommpy | 2:b7fdc74e5c5d | 22 | _cell_height_type cell_height; |
ommpy | 2:b7fdc74e5c5d | 23 | uint32_t cells_length; |
ommpy | 2:b7fdc74e5c5d | 24 | typedef geometry_msgs::Point _cells_type; |
ommpy | 2:b7fdc74e5c5d | 25 | _cells_type st_cells; |
ommpy | 2:b7fdc74e5c5d | 26 | _cells_type * cells; |
ommpy | 2:b7fdc74e5c5d | 27 | |
ommpy | 2:b7fdc74e5c5d | 28 | GridCells(): |
ommpy | 2:b7fdc74e5c5d | 29 | header(), |
ommpy | 2:b7fdc74e5c5d | 30 | cell_width(0), |
ommpy | 2:b7fdc74e5c5d | 31 | cell_height(0), |
ommpy | 2:b7fdc74e5c5d | 32 | cells_length(0), cells(NULL) |
ommpy | 2:b7fdc74e5c5d | 33 | { |
ommpy | 2:b7fdc74e5c5d | 34 | } |
ommpy | 2:b7fdc74e5c5d | 35 | |
ommpy | 2:b7fdc74e5c5d | 36 | virtual int serialize(unsigned char *outbuffer) const |
ommpy | 2:b7fdc74e5c5d | 37 | { |
ommpy | 2:b7fdc74e5c5d | 38 | int offset = 0; |
ommpy | 2:b7fdc74e5c5d | 39 | offset += this->header.serialize(outbuffer + offset); |
ommpy | 2:b7fdc74e5c5d | 40 | union { |
ommpy | 2:b7fdc74e5c5d | 41 | float real; |
ommpy | 2:b7fdc74e5c5d | 42 | uint32_t base; |
ommpy | 2:b7fdc74e5c5d | 43 | } u_cell_width; |
ommpy | 2:b7fdc74e5c5d | 44 | u_cell_width.real = this->cell_width; |
ommpy | 2:b7fdc74e5c5d | 45 | *(outbuffer + offset + 0) = (u_cell_width.base >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 46 | *(outbuffer + offset + 1) = (u_cell_width.base >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 47 | *(outbuffer + offset + 2) = (u_cell_width.base >> (8 * 2)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 48 | *(outbuffer + offset + 3) = (u_cell_width.base >> (8 * 3)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 49 | offset += sizeof(this->cell_width); |
ommpy | 2:b7fdc74e5c5d | 50 | union { |
ommpy | 2:b7fdc74e5c5d | 51 | float real; |
ommpy | 2:b7fdc74e5c5d | 52 | uint32_t base; |
ommpy | 2:b7fdc74e5c5d | 53 | } u_cell_height; |
ommpy | 2:b7fdc74e5c5d | 54 | u_cell_height.real = this->cell_height; |
ommpy | 2:b7fdc74e5c5d | 55 | *(outbuffer + offset + 0) = (u_cell_height.base >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 56 | *(outbuffer + offset + 1) = (u_cell_height.base >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 57 | *(outbuffer + offset + 2) = (u_cell_height.base >> (8 * 2)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 58 | *(outbuffer + offset + 3) = (u_cell_height.base >> (8 * 3)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 59 | offset += sizeof(this->cell_height); |
ommpy | 2:b7fdc74e5c5d | 60 | *(outbuffer + offset + 0) = (this->cells_length >> (8 * 0)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 61 | *(outbuffer + offset + 1) = (this->cells_length >> (8 * 1)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 62 | *(outbuffer + offset + 2) = (this->cells_length >> (8 * 2)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 63 | *(outbuffer + offset + 3) = (this->cells_length >> (8 * 3)) & 0xFF; |
ommpy | 2:b7fdc74e5c5d | 64 | offset += sizeof(this->cells_length); |
ommpy | 2:b7fdc74e5c5d | 65 | for( uint32_t i = 0; i < cells_length; i++){ |
ommpy | 2:b7fdc74e5c5d | 66 | offset += this->cells[i].serialize(outbuffer + offset); |
ommpy | 2:b7fdc74e5c5d | 67 | } |
ommpy | 2:b7fdc74e5c5d | 68 | return offset; |
ommpy | 2:b7fdc74e5c5d | 69 | } |
ommpy | 2:b7fdc74e5c5d | 70 | |
ommpy | 2:b7fdc74e5c5d | 71 | virtual int deserialize(unsigned char *inbuffer) |
ommpy | 2:b7fdc74e5c5d | 72 | { |
ommpy | 2:b7fdc74e5c5d | 73 | int offset = 0; |
ommpy | 2:b7fdc74e5c5d | 74 | offset += this->header.deserialize(inbuffer + offset); |
ommpy | 2:b7fdc74e5c5d | 75 | union { |
ommpy | 2:b7fdc74e5c5d | 76 | float real; |
ommpy | 2:b7fdc74e5c5d | 77 | uint32_t base; |
ommpy | 2:b7fdc74e5c5d | 78 | } u_cell_width; |
ommpy | 2:b7fdc74e5c5d | 79 | u_cell_width.base = 0; |
ommpy | 2:b7fdc74e5c5d | 80 | u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
ommpy | 2:b7fdc74e5c5d | 81 | u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 82 | u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
ommpy | 2:b7fdc74e5c5d | 83 | u_cell_width.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
ommpy | 2:b7fdc74e5c5d | 84 | this->cell_width = u_cell_width.real; |
ommpy | 2:b7fdc74e5c5d | 85 | offset += sizeof(this->cell_width); |
ommpy | 2:b7fdc74e5c5d | 86 | union { |
ommpy | 2:b7fdc74e5c5d | 87 | float real; |
ommpy | 2:b7fdc74e5c5d | 88 | uint32_t base; |
ommpy | 2:b7fdc74e5c5d | 89 | } u_cell_height; |
ommpy | 2:b7fdc74e5c5d | 90 | u_cell_height.base = 0; |
ommpy | 2:b7fdc74e5c5d | 91 | u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
ommpy | 2:b7fdc74e5c5d | 92 | u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 93 | u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
ommpy | 2:b7fdc74e5c5d | 94 | u_cell_height.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
ommpy | 2:b7fdc74e5c5d | 95 | this->cell_height = u_cell_height.real; |
ommpy | 2:b7fdc74e5c5d | 96 | offset += sizeof(this->cell_height); |
ommpy | 2:b7fdc74e5c5d | 97 | uint32_t cells_lengthT = ((uint32_t) (*(inbuffer + offset))); |
ommpy | 2:b7fdc74e5c5d | 98 | cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
ommpy | 2:b7fdc74e5c5d | 99 | cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
ommpy | 2:b7fdc74e5c5d | 100 | cells_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
ommpy | 2:b7fdc74e5c5d | 101 | offset += sizeof(this->cells_length); |
ommpy | 2:b7fdc74e5c5d | 102 | if(cells_lengthT > cells_length) |
ommpy | 2:b7fdc74e5c5d | 103 | this->cells = (geometry_msgs::Point*)realloc(this->cells, cells_lengthT * sizeof(geometry_msgs::Point)); |
ommpy | 2:b7fdc74e5c5d | 104 | cells_length = cells_lengthT; |
ommpy | 2:b7fdc74e5c5d | 105 | for( uint32_t i = 0; i < cells_length; i++){ |
ommpy | 2:b7fdc74e5c5d | 106 | offset += this->st_cells.deserialize(inbuffer + offset); |
ommpy | 2:b7fdc74e5c5d | 107 | memcpy( &(this->cells[i]), &(this->st_cells), sizeof(geometry_msgs::Point)); |
ommpy | 2:b7fdc74e5c5d | 108 | } |
ommpy | 2:b7fdc74e5c5d | 109 | return offset; |
ommpy | 2:b7fdc74e5c5d | 110 | } |
ommpy | 2:b7fdc74e5c5d | 111 | |
ommpy | 2:b7fdc74e5c5d | 112 | const char * getType(){ return "nav_msgs/GridCells"; }; |
ommpy | 2:b7fdc74e5c5d | 113 | const char * getMD5(){ return "b9e4f5df6d28e272ebde00a3994830f5"; }; |
ommpy | 2:b7fdc74e5c5d | 114 | |
ommpy | 2:b7fdc74e5c5d | 115 | }; |
ommpy | 2:b7fdc74e5c5d | 116 | |
ommpy | 2:b7fdc74e5c5d | 117 | } |
ommpy | 2:b7fdc74e5c5d | 118 | #endif |