hairo

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