00001 """autogenerated by genpy from iri_perception_msgs/Descriptor.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 geometry_msgs.msg
00008
00009 class Descriptor(genpy.Message):
00010 _md5sum = "6d50cb80b89d1ec47a9b4fa09aadf05a"
00011 _type = "iri_perception_msgs/Descriptor"
00012 _has_header = False
00013 _full_text = """float32[] descriptor
00014 geometry_msgs/Vector3 point3d
00015 int32 u
00016 int32 v
00017 float32 orientation
00018
00019 ================================================================================
00020 MSG: geometry_msgs/Vector3
00021 # This represents a vector in free space.
00022
00023 float64 x
00024 float64 y
00025 float64 z
00026 """
00027 __slots__ = ['descriptor','point3d','u','v','orientation']
00028 _slot_types = ['float32[]','geometry_msgs/Vector3','int32','int32','float32']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 descriptor,point3d,u,v,orientation
00039
00040 :param args: complete set of field values, in .msg order
00041 :param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(Descriptor, self).__init__(*args, **kwds)
00046
00047 if self.descriptor is None:
00048 self.descriptor = []
00049 if self.point3d is None:
00050 self.point3d = geometry_msgs.msg.Vector3()
00051 if self.u is None:
00052 self.u = 0
00053 if self.v is None:
00054 self.v = 0
00055 if self.orientation is None:
00056 self.orientation = 0.
00057 else:
00058 self.descriptor = []
00059 self.point3d = geometry_msgs.msg.Vector3()
00060 self.u = 0
00061 self.v = 0
00062 self.orientation = 0.
00063
00064 def _get_types(self):
00065 """
00066 internal API method
00067 """
00068 return self._slot_types
00069
00070 def serialize(self, buff):
00071 """
00072 serialize message into buffer
00073 :param buff: buffer, ``StringIO``
00074 """
00075 try:
00076 length = len(self.descriptor)
00077 buff.write(_struct_I.pack(length))
00078 pattern = '<%sf'%length
00079 buff.write(struct.pack(pattern, *self.descriptor))
00080 _x = self
00081 buff.write(_struct_3d2if.pack(_x.point3d.x, _x.point3d.y, _x.point3d.z, _x.u, _x.v, _x.orientation))
00082 except struct.error as se: self._check_types(se)
00083 except TypeError as te: self._check_types(te)
00084
00085 def deserialize(self, str):
00086 """
00087 unpack serialized message in str into this message instance
00088 :param str: byte array of serialized message, ``str``
00089 """
00090 try:
00091 if self.point3d is None:
00092 self.point3d = geometry_msgs.msg.Vector3()
00093 end = 0
00094 start = end
00095 end += 4
00096 (length,) = _struct_I.unpack(str[start:end])
00097 pattern = '<%sf'%length
00098 start = end
00099 end += struct.calcsize(pattern)
00100 self.descriptor = struct.unpack(pattern, str[start:end])
00101 _x = self
00102 start = end
00103 end += 36
00104 (_x.point3d.x, _x.point3d.y, _x.point3d.z, _x.u, _x.v, _x.orientation,) = _struct_3d2if.unpack(str[start:end])
00105 return self
00106 except struct.error as e:
00107 raise genpy.DeserializationError(e)
00108
00109
00110 def serialize_numpy(self, buff, numpy):
00111 """
00112 serialize message with numpy array types into buffer
00113 :param buff: buffer, ``StringIO``
00114 :param numpy: numpy python module
00115 """
00116 try:
00117 length = len(self.descriptor)
00118 buff.write(_struct_I.pack(length))
00119 pattern = '<%sf'%length
00120 buff.write(self.descriptor.tostring())
00121 _x = self
00122 buff.write(_struct_3d2if.pack(_x.point3d.x, _x.point3d.y, _x.point3d.z, _x.u, _x.v, _x.orientation))
00123 except struct.error as se: self._check_types(se)
00124 except TypeError as te: self._check_types(te)
00125
00126 def deserialize_numpy(self, str, numpy):
00127 """
00128 unpack serialized message in str into this message instance using numpy for array types
00129 :param str: byte array of serialized message, ``str``
00130 :param numpy: numpy python module
00131 """
00132 try:
00133 if self.point3d is None:
00134 self.point3d = geometry_msgs.msg.Vector3()
00135 end = 0
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 pattern = '<%sf'%length
00140 start = end
00141 end += struct.calcsize(pattern)
00142 self.descriptor = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00143 _x = self
00144 start = end
00145 end += 36
00146 (_x.point3d.x, _x.point3d.y, _x.point3d.z, _x.u, _x.v, _x.orientation,) = _struct_3d2if.unpack(str[start:end])
00147 return self
00148 except struct.error as e:
00149 raise genpy.DeserializationError(e)
00150
00151 _struct_I = genpy.struct_I
00152 _struct_3d2if = struct.Struct("<3d2if")