00001 """autogenerated by genpy from posedetection_msgs/Feature1D.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 posedetection_msgs.msg
00008 import std_msgs.msg
00009
00010 class Feature1D(genpy.Message):
00011 _md5sum = "4568f21f2dd0840ca2d658d4d1710f33"
00012 _type = "posedetection_msgs/Feature1D"
00013 _has_header = True
00014 _full_text = """Header header
00015 Curve1D[] lines # N, 0-indexed
00016 float32[] descriptors # N*descriptor_dim
00017 float32[] confidences # optional
00018 int32 descriptor_dim
00019
00020 ================================================================================
00021 MSG: std_msgs/Header
00022 # Standard metadata for higher-level stamped data types.
00023 # This is generally used to communicate timestamped data
00024 # in a particular coordinate frame.
00025 #
00026 # sequence ID: consecutively increasing ID
00027 uint32 seq
00028 #Two-integer timestamp that is expressed as:
00029 # * stamp.secs: seconds (stamp_secs) since epoch
00030 # * stamp.nsecs: nanoseconds since stamp_secs
00031 # time-handling sugar is provided by the client library
00032 time stamp
00033 #Frame this data is associated with
00034 # 0: no frame
00035 # 1: global frame
00036 string frame_id
00037
00038 ================================================================================
00039 MSG: posedetection_msgs/Curve1D
00040 float32[] pts # 2xN points in the image
00041
00042 """
00043 __slots__ = ['header','lines','descriptors','confidences','descriptor_dim']
00044 _slot_types = ['std_msgs/Header','posedetection_msgs/Curve1D[]','float32[]','float32[]','int32']
00045
00046 def __init__(self, *args, **kwds):
00047 """
00048 Constructor. Any message fields that are implicitly/explicitly
00049 set to None will be assigned a default value. The recommend
00050 use is keyword arguments as this is more robust to future message
00051 changes. You cannot mix in-order arguments and keyword arguments.
00052
00053 The available fields are:
00054 header,lines,descriptors,confidences,descriptor_dim
00055
00056 :param args: complete set of field values, in .msg order
00057 :param kwds: use keyword arguments corresponding to message field names
00058 to set specific fields.
00059 """
00060 if args or kwds:
00061 super(Feature1D, self).__init__(*args, **kwds)
00062
00063 if self.header is None:
00064 self.header = std_msgs.msg.Header()
00065 if self.lines is None:
00066 self.lines = []
00067 if self.descriptors is None:
00068 self.descriptors = []
00069 if self.confidences is None:
00070 self.confidences = []
00071 if self.descriptor_dim is None:
00072 self.descriptor_dim = 0
00073 else:
00074 self.header = std_msgs.msg.Header()
00075 self.lines = []
00076 self.descriptors = []
00077 self.confidences = []
00078 self.descriptor_dim = 0
00079
00080 def _get_types(self):
00081 """
00082 internal API method
00083 """
00084 return self._slot_types
00085
00086 def serialize(self, buff):
00087 """
00088 serialize message into buffer
00089 :param buff: buffer, ``StringIO``
00090 """
00091 try:
00092 _x = self
00093 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00094 _x = self.header.frame_id
00095 length = len(_x)
00096 if python3 or type(_x) == unicode:
00097 _x = _x.encode('utf-8')
00098 length = len(_x)
00099 buff.write(struct.pack('<I%ss'%length, length, _x))
00100 length = len(self.lines)
00101 buff.write(_struct_I.pack(length))
00102 for val1 in self.lines:
00103 length = len(val1.pts)
00104 buff.write(_struct_I.pack(length))
00105 pattern = '<%sf'%length
00106 buff.write(struct.pack(pattern, *val1.pts))
00107 length = len(self.descriptors)
00108 buff.write(_struct_I.pack(length))
00109 pattern = '<%sf'%length
00110 buff.write(struct.pack(pattern, *self.descriptors))
00111 length = len(self.confidences)
00112 buff.write(_struct_I.pack(length))
00113 pattern = '<%sf'%length
00114 buff.write(struct.pack(pattern, *self.confidences))
00115 buff.write(_struct_i.pack(self.descriptor_dim))
00116 except struct.error as se: self._check_types(se)
00117 except TypeError as te: self._check_types(te)
00118
00119 def deserialize(self, str):
00120 """
00121 unpack serialized message in str into this message instance
00122 :param str: byte array of serialized message, ``str``
00123 """
00124 try:
00125 if self.header is None:
00126 self.header = std_msgs.msg.Header()
00127 if self.lines is None:
00128 self.lines = None
00129 end = 0
00130 _x = self
00131 start = end
00132 end += 12
00133 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 start = end
00138 end += length
00139 if python3:
00140 self.header.frame_id = str[start:end].decode('utf-8')
00141 else:
00142 self.header.frame_id = str[start:end]
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 self.lines = []
00147 for i in range(0, length):
00148 val1 = posedetection_msgs.msg.Curve1D()
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 pattern = '<%sf'%length
00153 start = end
00154 end += struct.calcsize(pattern)
00155 val1.pts = struct.unpack(pattern, str[start:end])
00156 self.lines.append(val1)
00157 start = end
00158 end += 4
00159 (length,) = _struct_I.unpack(str[start:end])
00160 pattern = '<%sf'%length
00161 start = end
00162 end += struct.calcsize(pattern)
00163 self.descriptors = struct.unpack(pattern, str[start:end])
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 pattern = '<%sf'%length
00168 start = end
00169 end += struct.calcsize(pattern)
00170 self.confidences = struct.unpack(pattern, str[start:end])
00171 start = end
00172 end += 4
00173 (self.descriptor_dim,) = _struct_i.unpack(str[start:end])
00174 return self
00175 except struct.error as e:
00176 raise genpy.DeserializationError(e)
00177
00178
00179 def serialize_numpy(self, buff, numpy):
00180 """
00181 serialize message with numpy array types into buffer
00182 :param buff: buffer, ``StringIO``
00183 :param numpy: numpy python module
00184 """
00185 try:
00186 _x = self
00187 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00188 _x = self.header.frame_id
00189 length = len(_x)
00190 if python3 or type(_x) == unicode:
00191 _x = _x.encode('utf-8')
00192 length = len(_x)
00193 buff.write(struct.pack('<I%ss'%length, length, _x))
00194 length = len(self.lines)
00195 buff.write(_struct_I.pack(length))
00196 for val1 in self.lines:
00197 length = len(val1.pts)
00198 buff.write(_struct_I.pack(length))
00199 pattern = '<%sf'%length
00200 buff.write(val1.pts.tostring())
00201 length = len(self.descriptors)
00202 buff.write(_struct_I.pack(length))
00203 pattern = '<%sf'%length
00204 buff.write(self.descriptors.tostring())
00205 length = len(self.confidences)
00206 buff.write(_struct_I.pack(length))
00207 pattern = '<%sf'%length
00208 buff.write(self.confidences.tostring())
00209 buff.write(_struct_i.pack(self.descriptor_dim))
00210 except struct.error as se: self._check_types(se)
00211 except TypeError as te: self._check_types(te)
00212
00213 def deserialize_numpy(self, str, numpy):
00214 """
00215 unpack serialized message in str into this message instance using numpy for array types
00216 :param str: byte array of serialized message, ``str``
00217 :param numpy: numpy python module
00218 """
00219 try:
00220 if self.header is None:
00221 self.header = std_msgs.msg.Header()
00222 if self.lines is None:
00223 self.lines = None
00224 end = 0
00225 _x = self
00226 start = end
00227 end += 12
00228 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 if python3:
00235 self.header.frame_id = str[start:end].decode('utf-8')
00236 else:
00237 self.header.frame_id = str[start:end]
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 self.lines = []
00242 for i in range(0, length):
00243 val1 = posedetection_msgs.msg.Curve1D()
00244 start = end
00245 end += 4
00246 (length,) = _struct_I.unpack(str[start:end])
00247 pattern = '<%sf'%length
00248 start = end
00249 end += struct.calcsize(pattern)
00250 val1.pts = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00251 self.lines.append(val1)
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 pattern = '<%sf'%length
00256 start = end
00257 end += struct.calcsize(pattern)
00258 self.descriptors = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00259 start = end
00260 end += 4
00261 (length,) = _struct_I.unpack(str[start:end])
00262 pattern = '<%sf'%length
00263 start = end
00264 end += struct.calcsize(pattern)
00265 self.confidences = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00266 start = end
00267 end += 4
00268 (self.descriptor_dim,) = _struct_i.unpack(str[start:end])
00269 return self
00270 except struct.error as e:
00271 raise genpy.DeserializationError(e)
00272
00273 _struct_I = genpy.struct_I
00274 _struct_i = struct.Struct("<i")
00275 _struct_3I = struct.Struct("<3I")