00001 """autogenerated by genpy from nao_msgs/FadeRGB.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 genpy
00008 import std_msgs.msg
00009
00010 class FadeRGB(genpy.Message):
00011 _md5sum = "0df8c8fbe7f1de5f2168d6117ffced08"
00012 _type = "nao_msgs/FadeRGB"
00013 _has_header = False
00014 _full_text = """#Message to fade leds
00015 string led_name
00016 std_msgs/ColorRGBA color
00017 duration fade_duration
00018
00019 ================================================================================
00020 MSG: std_msgs/ColorRGBA
00021 float32 r
00022 float32 g
00023 float32 b
00024 float32 a
00025
00026 """
00027 __slots__ = ['led_name','color','fade_duration']
00028 _slot_types = ['string','std_msgs/ColorRGBA','duration']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 led_name,color,fade_duration
00039
00040 :param args: complete set of field values, in .msg order
00041 :param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(FadeRGB, self).__init__(*args, **kwds)
00046
00047 if self.led_name is None:
00048 self.led_name = ''
00049 if self.color is None:
00050 self.color = std_msgs.msg.ColorRGBA()
00051 if self.fade_duration is None:
00052 self.fade_duration = genpy.Duration()
00053 else:
00054 self.led_name = ''
00055 self.color = std_msgs.msg.ColorRGBA()
00056 self.fade_duration = genpy.Duration()
00057
00058 def _get_types(self):
00059 """
00060 internal API method
00061 """
00062 return self._slot_types
00063
00064 def serialize(self, buff):
00065 """
00066 serialize message into buffer
00067 :param buff: buffer, ``StringIO``
00068 """
00069 try:
00070 _x = self.led_name
00071 length = len(_x)
00072 if python3 or type(_x) == unicode:
00073 _x = _x.encode('utf-8')
00074 length = len(_x)
00075 buff.write(struct.pack('<I%ss'%length, length, _x))
00076 _x = self
00077 buff.write(_struct_4f2i.pack(_x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.fade_duration.secs, _x.fade_duration.nsecs))
00078 except struct.error as se: self._check_types(se)
00079 except TypeError as te: self._check_types(te)
00080
00081 def deserialize(self, str):
00082 """
00083 unpack serialized message in str into this message instance
00084 :param str: byte array of serialized message, ``str``
00085 """
00086 try:
00087 if self.color is None:
00088 self.color = std_msgs.msg.ColorRGBA()
00089 if self.fade_duration is None:
00090 self.fade_duration = genpy.Duration()
00091 end = 0
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 start = end
00096 end += length
00097 if python3:
00098 self.led_name = str[start:end].decode('utf-8')
00099 else:
00100 self.led_name = str[start:end]
00101 _x = self
00102 start = end
00103 end += 24
00104 (_x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.fade_duration.secs, _x.fade_duration.nsecs,) = _struct_4f2i.unpack(str[start:end])
00105 self.fade_duration.canon()
00106 return self
00107 except struct.error as e:
00108 raise genpy.DeserializationError(e)
00109
00110
00111 def serialize_numpy(self, buff, numpy):
00112 """
00113 serialize message with numpy array types into buffer
00114 :param buff: buffer, ``StringIO``
00115 :param numpy: numpy python module
00116 """
00117 try:
00118 _x = self.led_name
00119 length = len(_x)
00120 if python3 or type(_x) == unicode:
00121 _x = _x.encode('utf-8')
00122 length = len(_x)
00123 buff.write(struct.pack('<I%ss'%length, length, _x))
00124 _x = self
00125 buff.write(_struct_4f2i.pack(_x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.fade_duration.secs, _x.fade_duration.nsecs))
00126 except struct.error as se: self._check_types(se)
00127 except TypeError as te: self._check_types(te)
00128
00129 def deserialize_numpy(self, str, numpy):
00130 """
00131 unpack serialized message in str into this message instance using numpy for array types
00132 :param str: byte array of serialized message, ``str``
00133 :param numpy: numpy python module
00134 """
00135 try:
00136 if self.color is None:
00137 self.color = std_msgs.msg.ColorRGBA()
00138 if self.fade_duration is None:
00139 self.fade_duration = genpy.Duration()
00140 end = 0
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 if python3:
00147 self.led_name = str[start:end].decode('utf-8')
00148 else:
00149 self.led_name = str[start:end]
00150 _x = self
00151 start = end
00152 end += 24
00153 (_x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.fade_duration.secs, _x.fade_duration.nsecs,) = _struct_4f2i.unpack(str[start:end])
00154 self.fade_duration.canon()
00155 return self
00156 except struct.error as e:
00157 raise genpy.DeserializationError(e)
00158
00159 _struct_I = genpy.struct_I
00160 _struct_4f2i = struct.Struct("<4f2i")