_IrSourceInfo.py
Go to the documentation of this file.
00001 """autogenerated by genpy from wiimote/IrSourceInfo.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 IrSourceInfo(genpy.Message):
00009   _md5sum = "95274ca88b9f008b99984b9a61d2772e"
00010   _type = "wiimote/IrSourceInfo"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Sensor data pertaining to the Wiimote infrared camera.
00013 # This message contains data for one of the four infrared 
00014 # light sources that the camera detects.
00015 #
00016 # Each light is specified with a 2D position and 
00017 # a 'source magnitude' (ir_size). If the x dimension
00018 # is set to INVALID_FLOAT, then no light was detected for 
00019 # the respective light. The Wiimote handles up to
00020 # four light sources, and the wiimote_node.py software
00021 # is written to that limit as well.
00022 #
00023 # I am unsure what the 'ir_size' values represent. 
00024 # They are described as 'source magnitude' in some places. I
00025 # *assume* this is signal amplitude, but it's unclear. 
00026 # Note that current lowest level cwiid driver does not 
00027 # seem to pass the ir_size value to the cwiid Wiimote.c. 
00028 # For now this size will therefore be set INVALID
00029 
00030 float64 x 
00031 float64 y 
00032 int64 ir_size
00033 
00034 """
00035   __slots__ = ['x','y','ir_size']
00036   _slot_types = ['float64','float64','int64']
00037 
00038   def __init__(self, *args, **kwds):
00039     """
00040     Constructor. Any message fields that are implicitly/explicitly
00041     set to None will be assigned a default value. The recommend
00042     use is keyword arguments as this is more robust to future message
00043     changes.  You cannot mix in-order arguments and keyword arguments.
00044 
00045     The available fields are:
00046        x,y,ir_size
00047 
00048     :param args: complete set of field values, in .msg order
00049     :param kwds: use keyword arguments corresponding to message field names
00050     to set specific fields.
00051     """
00052     if args or kwds:
00053       super(IrSourceInfo, self).__init__(*args, **kwds)
00054       #message fields cannot be None, assign default values for those that are
00055       if self.x is None:
00056         self.x = 0.
00057       if self.y is None:
00058         self.y = 0.
00059       if self.ir_size is None:
00060         self.ir_size = 0
00061     else:
00062       self.x = 0.
00063       self.y = 0.
00064       self.ir_size = 0
00065 
00066   def _get_types(self):
00067     """
00068     internal API method
00069     """
00070     return self._slot_types
00071 
00072   def serialize(self, buff):
00073     """
00074     serialize message into buffer
00075     :param buff: buffer, ``StringIO``
00076     """
00077     try:
00078       _x = self
00079       buff.write(_struct_2dq.pack(_x.x, _x.y, _x.ir_size))
00080     except struct.error as se: self._check_types(se)
00081     except TypeError as te: self._check_types(te)
00082 
00083   def deserialize(self, str):
00084     """
00085     unpack serialized message in str into this message instance
00086     :param str: byte array of serialized message, ``str``
00087     """
00088     try:
00089       end = 0
00090       _x = self
00091       start = end
00092       end += 24
00093       (_x.x, _x.y, _x.ir_size,) = _struct_2dq.unpack(str[start:end])
00094       return self
00095     except struct.error as e:
00096       raise genpy.DeserializationError(e) #most likely buffer underfill
00097 
00098 
00099   def serialize_numpy(self, buff, numpy):
00100     """
00101     serialize message with numpy array types into buffer
00102     :param buff: buffer, ``StringIO``
00103     :param numpy: numpy python module
00104     """
00105     try:
00106       _x = self
00107       buff.write(_struct_2dq.pack(_x.x, _x.y, _x.ir_size))
00108     except struct.error as se: self._check_types(se)
00109     except TypeError as te: self._check_types(te)
00110 
00111   def deserialize_numpy(self, str, numpy):
00112     """
00113     unpack serialized message in str into this message instance using numpy for array types
00114     :param str: byte array of serialized message, ``str``
00115     :param numpy: numpy python module
00116     """
00117     try:
00118       end = 0
00119       _x = self
00120       start = end
00121       end += 24
00122       (_x.x, _x.y, _x.ir_size,) = _struct_2dq.unpack(str[start:end])
00123       return self
00124     except struct.error as e:
00125       raise genpy.DeserializationError(e) #most likely buffer underfill
00126 
00127 _struct_I = genpy.struct_I
00128 _struct_2dq = struct.Struct("<2dq")


wiimote
Author(s): Andreas Paepcke and Melonee Wise
autogenerated on Sat Dec 28 2013 17:06:50