00001 """autogenerated by genpy from vrep_common/VisionSensorDepthBuff.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class VisionSensorDepthBuff(genpy.Message):
00010 _md5sum = "fe6c62e891cf9e2aef9b4742b6ae660f"
00011 _type = "vrep_common/VisionSensorDepthBuff"
00012 _has_header = False
00013 _full_text = """std_msgs/Int32 x
00014 std_msgs/Int32 y
00015 std_msgs/Float32MultiArray data
00016 ================================================================================
00017 MSG: std_msgs/Int32
00018 int32 data
00019 ================================================================================
00020 MSG: std_msgs/Float32MultiArray
00021 # Please look at the MultiArrayLayout message definition for
00022 # documentation on all multiarrays.
00023
00024 MultiArrayLayout layout # specification of data layout
00025 float32[] data # array of data
00026
00027
00028 ================================================================================
00029 MSG: std_msgs/MultiArrayLayout
00030 # The multiarray declares a generic multi-dimensional array of a
00031 # particular data type. Dimensions are ordered from outer most
00032 # to inner most.
00033
00034 MultiArrayDimension[] dim # Array of dimension properties
00035 uint32 data_offset # padding bytes at front of data
00036
00037 # Accessors should ALWAYS be written in terms of dimension stride
00038 # and specified outer-most dimension first.
00039 #
00040 # multiarray(i,j,k) = data[data_offset + dim_stride[1]*i + dim_stride[2]*j + k]
00041 #
00042 # A standard, 3-channel 640x480 image with interleaved color channels
00043 # would be specified as:
00044 #
00045 # dim[0].label = "height"
00046 # dim[0].size = 480
00047 # dim[0].stride = 3*640*480 = 921600 (note dim[0] stride is just size of image)
00048 # dim[1].label = "width"
00049 # dim[1].size = 640
00050 # dim[1].stride = 3*640 = 1920
00051 # dim[2].label = "channel"
00052 # dim[2].size = 3
00053 # dim[2].stride = 3
00054 #
00055 # multiarray(i,j,k) refers to the ith row, jth column, and kth channel.
00056 ================================================================================
00057 MSG: std_msgs/MultiArrayDimension
00058 string label # label of given dimension
00059 uint32 size # size of given dimension (in type units)
00060 uint32 stride # stride of given dimension
00061 """
00062 __slots__ = ['x','y','data']
00063 _slot_types = ['std_msgs/Int32','std_msgs/Int32','std_msgs/Float32MultiArray']
00064
00065 def __init__(self, *args, **kwds):
00066 """
00067 Constructor. Any message fields that are implicitly/explicitly
00068 set to None will be assigned a default value. The recommend
00069 use is keyword arguments as this is more robust to future message
00070 changes. You cannot mix in-order arguments and keyword arguments.
00071
00072 The available fields are:
00073 x,y,data
00074
00075 :param args: complete set of field values, in .msg order
00076 :param kwds: use keyword arguments corresponding to message field names
00077 to set specific fields.
00078 """
00079 if args or kwds:
00080 super(VisionSensorDepthBuff, self).__init__(*args, **kwds)
00081
00082 if self.x is None:
00083 self.x = std_msgs.msg.Int32()
00084 if self.y is None:
00085 self.y = std_msgs.msg.Int32()
00086 if self.data is None:
00087 self.data = std_msgs.msg.Float32MultiArray()
00088 else:
00089 self.x = std_msgs.msg.Int32()
00090 self.y = std_msgs.msg.Int32()
00091 self.data = std_msgs.msg.Float32MultiArray()
00092
00093 def _get_types(self):
00094 """
00095 internal API method
00096 """
00097 return self._slot_types
00098
00099 def serialize(self, buff):
00100 """
00101 serialize message into buffer
00102 :param buff: buffer, ``StringIO``
00103 """
00104 try:
00105 _x = self
00106 buff.write(_struct_2i.pack(_x.x.data, _x.y.data))
00107 length = len(self.data.layout.dim)
00108 buff.write(_struct_I.pack(length))
00109 for val1 in self.data.layout.dim:
00110 _x = val1.label
00111 length = len(_x)
00112 if python3 or type(_x) == unicode:
00113 _x = _x.encode('utf-8')
00114 length = len(_x)
00115 buff.write(struct.pack('<I%ss'%length, length, _x))
00116 _x = val1
00117 buff.write(_struct_2I.pack(_x.size, _x.stride))
00118 buff.write(_struct_I.pack(self.data.layout.data_offset))
00119 length = len(self.data.data)
00120 buff.write(_struct_I.pack(length))
00121 pattern = '<%sf'%length
00122 buff.write(struct.pack(pattern, *self.data.data))
00123 except struct.error as se: self._check_types(se)
00124 except TypeError as te: self._check_types(te)
00125
00126 def deserialize(self, str):
00127 """
00128 unpack serialized message in str into this message instance
00129 :param str: byte array of serialized message, ``str``
00130 """
00131 try:
00132 if self.x is None:
00133 self.x = std_msgs.msg.Int32()
00134 if self.y is None:
00135 self.y = std_msgs.msg.Int32()
00136 if self.data is None:
00137 self.data = std_msgs.msg.Float32MultiArray()
00138 end = 0
00139 _x = self
00140 start = end
00141 end += 8
00142 (_x.x.data, _x.y.data,) = _struct_2i.unpack(str[start:end])
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 self.data.layout.dim = []
00147 for i in range(0, length):
00148 val1 = std_msgs.msg.MultiArrayDimension()
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 val1.label = str[start:end].decode('utf-8')
00156 else:
00157 val1.label = str[start:end]
00158 _x = val1
00159 start = end
00160 end += 8
00161 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00162 self.data.layout.dim.append(val1)
00163 start = end
00164 end += 4
00165 (self.data.layout.data_offset,) = _struct_I.unpack(str[start:end])
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 pattern = '<%sf'%length
00170 start = end
00171 end += struct.calcsize(pattern)
00172 self.data.data = struct.unpack(pattern, str[start:end])
00173 return self
00174 except struct.error as e:
00175 raise genpy.DeserializationError(e)
00176
00177
00178 def serialize_numpy(self, buff, numpy):
00179 """
00180 serialize message with numpy array types into buffer
00181 :param buff: buffer, ``StringIO``
00182 :param numpy: numpy python module
00183 """
00184 try:
00185 _x = self
00186 buff.write(_struct_2i.pack(_x.x.data, _x.y.data))
00187 length = len(self.data.layout.dim)
00188 buff.write(_struct_I.pack(length))
00189 for val1 in self.data.layout.dim:
00190 _x = val1.label
00191 length = len(_x)
00192 if python3 or type(_x) == unicode:
00193 _x = _x.encode('utf-8')
00194 length = len(_x)
00195 buff.write(struct.pack('<I%ss'%length, length, _x))
00196 _x = val1
00197 buff.write(_struct_2I.pack(_x.size, _x.stride))
00198 buff.write(_struct_I.pack(self.data.layout.data_offset))
00199 length = len(self.data.data)
00200 buff.write(_struct_I.pack(length))
00201 pattern = '<%sf'%length
00202 buff.write(self.data.data.tostring())
00203 except struct.error as se: self._check_types(se)
00204 except TypeError as te: self._check_types(te)
00205
00206 def deserialize_numpy(self, str, numpy):
00207 """
00208 unpack serialized message in str into this message instance using numpy for array types
00209 :param str: byte array of serialized message, ``str``
00210 :param numpy: numpy python module
00211 """
00212 try:
00213 if self.x is None:
00214 self.x = std_msgs.msg.Int32()
00215 if self.y is None:
00216 self.y = std_msgs.msg.Int32()
00217 if self.data is None:
00218 self.data = std_msgs.msg.Float32MultiArray()
00219 end = 0
00220 _x = self
00221 start = end
00222 end += 8
00223 (_x.x.data, _x.y.data,) = _struct_2i.unpack(str[start:end])
00224 start = end
00225 end += 4
00226 (length,) = _struct_I.unpack(str[start:end])
00227 self.data.layout.dim = []
00228 for i in range(0, length):
00229 val1 = std_msgs.msg.MultiArrayDimension()
00230 start = end
00231 end += 4
00232 (length,) = _struct_I.unpack(str[start:end])
00233 start = end
00234 end += length
00235 if python3:
00236 val1.label = str[start:end].decode('utf-8')
00237 else:
00238 val1.label = str[start:end]
00239 _x = val1
00240 start = end
00241 end += 8
00242 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00243 self.data.layout.dim.append(val1)
00244 start = end
00245 end += 4
00246 (self.data.layout.data_offset,) = _struct_I.unpack(str[start:end])
00247 start = end
00248 end += 4
00249 (length,) = _struct_I.unpack(str[start:end])
00250 pattern = '<%sf'%length
00251 start = end
00252 end += struct.calcsize(pattern)
00253 self.data.data = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00254 return self
00255 except struct.error as e:
00256 raise genpy.DeserializationError(e)
00257
00258 _struct_I = genpy.struct_I
00259 _struct_2i = struct.Struct("<2i")
00260 _struct_2I = struct.Struct("<2I")