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