ROS Serial library for Mbed platforms for ROS Melodic Morenia. Check http://wiki.ros.org/rosserial_mbed/ for more information.
stereo_msgs/DisparityImage.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_stereo_msgs_DisparityImage_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_stereo_msgs_DisparityImage_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/Image.h" |
Gary Servin |
0:04ac6be8229a | 10 | #include "sensor_msgs/RegionOfInterest.h" |
Gary Servin |
0:04ac6be8229a | 11 | |
Gary Servin |
0:04ac6be8229a | 12 | namespace stereo_msgs |
Gary Servin |
0:04ac6be8229a | 13 | { |
Gary Servin |
0:04ac6be8229a | 14 | |
Gary Servin |
0:04ac6be8229a | 15 | class DisparityImage : 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::Image _image_type; |
Gary Servin |
0:04ac6be8229a | 21 | _image_type image; |
Gary Servin |
0:04ac6be8229a | 22 | typedef float _f_type; |
Gary Servin |
0:04ac6be8229a | 23 | _f_type f; |
Gary Servin |
0:04ac6be8229a | 24 | typedef float _T_type; |
Gary Servin |
0:04ac6be8229a | 25 | _T_type T; |
Gary Servin |
0:04ac6be8229a | 26 | typedef sensor_msgs::RegionOfInterest _valid_window_type; |
Gary Servin |
0:04ac6be8229a | 27 | _valid_window_type valid_window; |
Gary Servin |
0:04ac6be8229a | 28 | typedef float _min_disparity_type; |
Gary Servin |
0:04ac6be8229a | 29 | _min_disparity_type min_disparity; |
Gary Servin |
0:04ac6be8229a | 30 | typedef float _max_disparity_type; |
Gary Servin |
0:04ac6be8229a | 31 | _max_disparity_type max_disparity; |
Gary Servin |
0:04ac6be8229a | 32 | typedef float _delta_d_type; |
Gary Servin |
0:04ac6be8229a | 33 | _delta_d_type delta_d; |
Gary Servin |
0:04ac6be8229a | 34 | |
Gary Servin |
0:04ac6be8229a | 35 | DisparityImage(): |
Gary Servin |
0:04ac6be8229a | 36 | header(), |
Gary Servin |
0:04ac6be8229a | 37 | image(), |
Gary Servin |
0:04ac6be8229a | 38 | f(0), |
Gary Servin |
0:04ac6be8229a | 39 | T(0), |
Gary Servin |
0:04ac6be8229a | 40 | valid_window(), |
Gary Servin |
0:04ac6be8229a | 41 | min_disparity(0), |
Gary Servin |
0:04ac6be8229a | 42 | max_disparity(0), |
Gary Servin |
0:04ac6be8229a | 43 | delta_d(0) |
Gary Servin |
0:04ac6be8229a | 44 | { |
Gary Servin |
0:04ac6be8229a | 45 | } |
Gary Servin |
0:04ac6be8229a | 46 | |
Gary Servin |
0:04ac6be8229a | 47 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 48 | { |
Gary Servin |
0:04ac6be8229a | 49 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 50 | offset += this->header.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 51 | offset += this->image.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 52 | union { |
Gary Servin |
0:04ac6be8229a | 53 | float real; |
Gary Servin |
0:04ac6be8229a | 54 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 55 | } u_f; |
Gary Servin |
0:04ac6be8229a | 56 | u_f.real = this->f; |
Gary Servin |
0:04ac6be8229a | 57 | *(outbuffer + offset + 0) = (u_f.base >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 58 | *(outbuffer + offset + 1) = (u_f.base >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 59 | *(outbuffer + offset + 2) = (u_f.base >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 60 | *(outbuffer + offset + 3) = (u_f.base >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 61 | offset += sizeof(this->f); |
Gary Servin |
0:04ac6be8229a | 62 | union { |
Gary Servin |
0:04ac6be8229a | 63 | float real; |
Gary Servin |
0:04ac6be8229a | 64 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 65 | } u_T; |
Gary Servin |
0:04ac6be8229a | 66 | u_T.real = this->T; |
Gary Servin |
0:04ac6be8229a | 67 | *(outbuffer + offset + 0) = (u_T.base >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 68 | *(outbuffer + offset + 1) = (u_T.base >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 69 | *(outbuffer + offset + 2) = (u_T.base >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 70 | *(outbuffer + offset + 3) = (u_T.base >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 71 | offset += sizeof(this->T); |
Gary Servin |
0:04ac6be8229a | 72 | offset += this->valid_window.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 73 | union { |
Gary Servin |
0:04ac6be8229a | 74 | float real; |
Gary Servin |
0:04ac6be8229a | 75 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 76 | } u_min_disparity; |
Gary Servin |
0:04ac6be8229a | 77 | u_min_disparity.real = this->min_disparity; |
Gary Servin |
0:04ac6be8229a | 78 | *(outbuffer + offset + 0) = (u_min_disparity.base >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 79 | *(outbuffer + offset + 1) = (u_min_disparity.base >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 80 | *(outbuffer + offset + 2) = (u_min_disparity.base >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 81 | *(outbuffer + offset + 3) = (u_min_disparity.base >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 82 | offset += sizeof(this->min_disparity); |
Gary Servin |
0:04ac6be8229a | 83 | union { |
Gary Servin |
0:04ac6be8229a | 84 | float real; |
Gary Servin |
0:04ac6be8229a | 85 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 86 | } u_max_disparity; |
Gary Servin |
0:04ac6be8229a | 87 | u_max_disparity.real = this->max_disparity; |
Gary Servin |
0:04ac6be8229a | 88 | *(outbuffer + offset + 0) = (u_max_disparity.base >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 89 | *(outbuffer + offset + 1) = (u_max_disparity.base >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 90 | *(outbuffer + offset + 2) = (u_max_disparity.base >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 91 | *(outbuffer + offset + 3) = (u_max_disparity.base >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 92 | offset += sizeof(this->max_disparity); |
Gary Servin |
0:04ac6be8229a | 93 | union { |
Gary Servin |
0:04ac6be8229a | 94 | float real; |
Gary Servin |
0:04ac6be8229a | 95 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 96 | } u_delta_d; |
Gary Servin |
0:04ac6be8229a | 97 | u_delta_d.real = this->delta_d; |
Gary Servin |
0:04ac6be8229a | 98 | *(outbuffer + offset + 0) = (u_delta_d.base >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 99 | *(outbuffer + offset + 1) = (u_delta_d.base >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 100 | *(outbuffer + offset + 2) = (u_delta_d.base >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 101 | *(outbuffer + offset + 3) = (u_delta_d.base >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 102 | offset += sizeof(this->delta_d); |
Gary Servin |
0:04ac6be8229a | 103 | return offset; |
Gary Servin |
0:04ac6be8229a | 104 | } |
Gary Servin |
0:04ac6be8229a | 105 | |
Gary Servin |
0:04ac6be8229a | 106 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 107 | { |
Gary Servin |
0:04ac6be8229a | 108 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 109 | offset += this->header.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 110 | offset += this->image.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 111 | union { |
Gary Servin |
0:04ac6be8229a | 112 | float real; |
Gary Servin |
0:04ac6be8229a | 113 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 114 | } u_f; |
Gary Servin |
0:04ac6be8229a | 115 | u_f.base = 0; |
Gary Servin |
0:04ac6be8229a | 116 | u_f.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Gary Servin |
0:04ac6be8229a | 117 | u_f.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 118 | u_f.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 119 | u_f.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 120 | this->f = u_f.real; |
Gary Servin |
0:04ac6be8229a | 121 | offset += sizeof(this->f); |
Gary Servin |
0:04ac6be8229a | 122 | union { |
Gary Servin |
0:04ac6be8229a | 123 | float real; |
Gary Servin |
0:04ac6be8229a | 124 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 125 | } u_T; |
Gary Servin |
0:04ac6be8229a | 126 | u_T.base = 0; |
Gary Servin |
0:04ac6be8229a | 127 | u_T.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Gary Servin |
0:04ac6be8229a | 128 | u_T.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 129 | u_T.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 130 | u_T.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 131 | this->T = u_T.real; |
Gary Servin |
0:04ac6be8229a | 132 | offset += sizeof(this->T); |
Gary Servin |
0:04ac6be8229a | 133 | offset += this->valid_window.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 134 | union { |
Gary Servin |
0:04ac6be8229a | 135 | float real; |
Gary Servin |
0:04ac6be8229a | 136 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 137 | } u_min_disparity; |
Gary Servin |
0:04ac6be8229a | 138 | u_min_disparity.base = 0; |
Gary Servin |
0:04ac6be8229a | 139 | u_min_disparity.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Gary Servin |
0:04ac6be8229a | 140 | u_min_disparity.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 141 | u_min_disparity.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 142 | u_min_disparity.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 143 | this->min_disparity = u_min_disparity.real; |
Gary Servin |
0:04ac6be8229a | 144 | offset += sizeof(this->min_disparity); |
Gary Servin |
0:04ac6be8229a | 145 | union { |
Gary Servin |
0:04ac6be8229a | 146 | float real; |
Gary Servin |
0:04ac6be8229a | 147 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 148 | } u_max_disparity; |
Gary Servin |
0:04ac6be8229a | 149 | u_max_disparity.base = 0; |
Gary Servin |
0:04ac6be8229a | 150 | u_max_disparity.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Gary Servin |
0:04ac6be8229a | 151 | u_max_disparity.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 152 | u_max_disparity.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 153 | u_max_disparity.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 154 | this->max_disparity = u_max_disparity.real; |
Gary Servin |
0:04ac6be8229a | 155 | offset += sizeof(this->max_disparity); |
Gary Servin |
0:04ac6be8229a | 156 | union { |
Gary Servin |
0:04ac6be8229a | 157 | float real; |
Gary Servin |
0:04ac6be8229a | 158 | uint32_t base; |
Gary Servin |
0:04ac6be8229a | 159 | } u_delta_d; |
Gary Servin |
0:04ac6be8229a | 160 | u_delta_d.base = 0; |
Gary Servin |
0:04ac6be8229a | 161 | u_delta_d.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Gary Servin |
0:04ac6be8229a | 162 | u_delta_d.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 163 | u_delta_d.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 164 | u_delta_d.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 165 | this->delta_d = u_delta_d.real; |
Gary Servin |
0:04ac6be8229a | 166 | offset += sizeof(this->delta_d); |
Gary Servin |
0:04ac6be8229a | 167 | return offset; |
Gary Servin |
0:04ac6be8229a | 168 | } |
Gary Servin |
0:04ac6be8229a | 169 | |
Gary Servin |
0:04ac6be8229a | 170 | const char * getType(){ return "stereo_msgs/DisparityImage"; }; |
Gary Servin |
0:04ac6be8229a | 171 | const char * getMD5(){ return "04a177815f75271039fa21f16acad8c9"; }; |
Gary Servin |
0:04ac6be8229a | 172 | |
Gary Servin |
0:04ac6be8229a | 173 | }; |
Gary Servin |
0:04ac6be8229a | 174 | |
Gary Servin |
0:04ac6be8229a | 175 | } |
Gary Servin |
0:04ac6be8229a | 176 | #endif |