_Tag.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ar_recog/Tag.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class Tag(genpy.Message):
00009   _md5sum = "8506b66f10a2975d80e32037f36b9ab4"
00010   _type = "ar_recog/Tag"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# All screen measurements are in pixels, all spatial measurements are in meters.
00013 # Angles in radians.
00014 uint32 id
00015 # This is a rating of confidence in the tag pattern identification 0 < cf < 1.
00016 float64 cf
00017 uint32 x
00018 uint32 y
00019 # The 'diameter' is the square root of the tag's actual area, as estimated by 
00020 # the AR software.  You can use it to check the cf confidence.
00021 float64 diameter
00022 # This is the estimated distance from viewer to the center of the tag.
00023 float64 distance
00024 float64 xRot 
00025 float64 yRot 
00026 float64 zRot
00027 float64 xMetric
00028 float64 yMetric
00029 float64 zMetric
00030 # Screen coordinates of the four corners.
00031 float64[8] cwCorners
00032 # FOR TESTING ONLY
00033 # Uncommenting this and uncommenting the similarly-marked lines in 
00034 # ar_recog.cpp will put the ARToolkit rotation matrix into the Tag message,
00035 # which can be useful for debugging and testing.
00036 # float64[3] c3
00037 # float64[3] t0
00038 # float64[3] t1
00039 # float64[3] t2
00040 
00041 """
00042   __slots__ = ['id','cf','x','y','diameter','distance','xRot','yRot','zRot','xMetric','yMetric','zMetric','cwCorners']
00043   _slot_types = ['uint32','float64','uint32','uint32','float64','float64','float64','float64','float64','float64','float64','float64','float64[8]']
00044 
00045   def __init__(self, *args, **kwds):
00046     """
00047     Constructor. Any message fields that are implicitly/explicitly
00048     set to None will be assigned a default value. The recommend
00049     use is keyword arguments as this is more robust to future message
00050     changes.  You cannot mix in-order arguments and keyword arguments.
00051 
00052     The available fields are:
00053        id,cf,x,y,diameter,distance,xRot,yRot,zRot,xMetric,yMetric,zMetric,cwCorners
00054 
00055     :param args: complete set of field values, in .msg order
00056     :param kwds: use keyword arguments corresponding to message field names
00057     to set specific fields.
00058     """
00059     if args or kwds:
00060       super(Tag, self).__init__(*args, **kwds)
00061       #message fields cannot be None, assign default values for those that are
00062       if self.id is None:
00063         self.id = 0
00064       if self.cf is None:
00065         self.cf = 0.
00066       if self.x is None:
00067         self.x = 0
00068       if self.y is None:
00069         self.y = 0
00070       if self.diameter is None:
00071         self.diameter = 0.
00072       if self.distance is None:
00073         self.distance = 0.
00074       if self.xRot is None:
00075         self.xRot = 0.
00076       if self.yRot is None:
00077         self.yRot = 0.
00078       if self.zRot is None:
00079         self.zRot = 0.
00080       if self.xMetric is None:
00081         self.xMetric = 0.
00082       if self.yMetric is None:
00083         self.yMetric = 0.
00084       if self.zMetric is None:
00085         self.zMetric = 0.
00086       if self.cwCorners is None:
00087         self.cwCorners = [0.,0.,0.,0.,0.,0.,0.,0.]
00088     else:
00089       self.id = 0
00090       self.cf = 0.
00091       self.x = 0
00092       self.y = 0
00093       self.diameter = 0.
00094       self.distance = 0.
00095       self.xRot = 0.
00096       self.yRot = 0.
00097       self.zRot = 0.
00098       self.xMetric = 0.
00099       self.yMetric = 0.
00100       self.zMetric = 0.
00101       self.cwCorners = [0.,0.,0.,0.,0.,0.,0.,0.]
00102 
00103   def _get_types(self):
00104     """
00105     internal API method
00106     """
00107     return self._slot_types
00108 
00109   def serialize(self, buff):
00110     """
00111     serialize message into buffer
00112     :param buff: buffer, ``StringIO``
00113     """
00114     try:
00115       _x = self
00116       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))
00117       buff.write(_struct_8d.pack(*self.cwCorners))
00118     except struct.error as se: self._check_types(se)
00119     except TypeError as te: self._check_types(te)
00120 
00121   def deserialize(self, str):
00122     """
00123     unpack serialized message in str into this message instance
00124     :param str: byte array of serialized message, ``str``
00125     """
00126     try:
00127       end = 0
00128       _x = self
00129       start = end
00130       end += 84
00131       (_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])
00132       start = end
00133       end += 64
00134       self.cwCorners = _struct_8d.unpack(str[start:end])
00135       return self
00136     except struct.error as e:
00137       raise genpy.DeserializationError(e) #most likely buffer underfill
00138 
00139 
00140   def serialize_numpy(self, buff, numpy):
00141     """
00142     serialize message with numpy array types into buffer
00143     :param buff: buffer, ``StringIO``
00144     :param numpy: numpy python module
00145     """
00146     try:
00147       _x = self
00148       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))
00149       buff.write(self.cwCorners.tostring())
00150     except struct.error as se: self._check_types(se)
00151     except TypeError as te: self._check_types(te)
00152 
00153   def deserialize_numpy(self, str, numpy):
00154     """
00155     unpack serialized message in str into this message instance using numpy for array types
00156     :param str: byte array of serialized message, ``str``
00157     :param numpy: numpy python module
00158     """
00159     try:
00160       end = 0
00161       _x = self
00162       start = end
00163       end += 84
00164       (_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])
00165       start = end
00166       end += 64
00167       self.cwCorners = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=8)
00168       return self
00169     except struct.error as e:
00170       raise genpy.DeserializationError(e) #most likely buffer underfill
00171 
00172 _struct_I = genpy.struct_I
00173 _struct_8d = struct.Struct("<8d")
00174 _struct_Id2I8d = struct.Struct("<Id2I8d")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


ar_recog
Author(s): Graylin Trevor Jay and Christopher Crick
autogenerated on Fri Jan 25 2013 12:14:59