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