00001 """autogenerated by genpy from cob_light/LightMode.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 std_msgs.msg
00008
00009 class LightMode(genpy.Message):
00010 _md5sum = "5c61cdd41b56356f16e4e7ab38a77236"
00011 _type = "cob_light/LightMode"
00012 _has_header = False
00013 _full_text = """uint8 mode
00014 uint8 NONE = 0 # will turn everything off
00015 uint8 STATIC = 1 # will change the LEDs to "color"
00016 uint8 FLASH = 2 # will change the LEDs frequently with "frequency" from "color" to black
00017 uint8 BREATH = 3 # will change the LEDs smoothly with "frequency" from "color" to black
00018 uint8 BREATH_COLOR = 4 # will change the LEDs smoothly with "frequency" from "color" to black
00019 # and flips color in time
00020 uint8 FADE_COLOR = 5 # will fade the colors in rainbow
00021
00022 std_msgs/ColorRGBA color #the color which will be used
00023 float32 frequency # in Hz
00024 float32 timeout # in s, requested mode will be executed for max timout s.
00025 # default is 0 and meens no timeout.
00026 int32 pulses # spezifies the amount of pulses which will be executed.
00027 # eg: mode = flash, pulses = 2. Meens the light will flash two times
00028 int8 priority # priority [-20,20] default = 0. Modes with same or higher priorities will
00029 # be executed.
00030 ================================================================================
00031 MSG: std_msgs/ColorRGBA
00032 float32 r
00033 float32 g
00034 float32 b
00035 float32 a
00036
00037 """
00038
00039 NONE = 0
00040 STATIC = 1
00041 FLASH = 2
00042 BREATH = 3
00043 BREATH_COLOR = 4
00044 FADE_COLOR = 5
00045
00046 __slots__ = ['mode','color','frequency','timeout','pulses','priority']
00047 _slot_types = ['uint8','std_msgs/ColorRGBA','float32','float32','int32','int8']
00048
00049 def __init__(self, *args, **kwds):
00050 """
00051 Constructor. Any message fields that are implicitly/explicitly
00052 set to None will be assigned a default value. The recommend
00053 use is keyword arguments as this is more robust to future message
00054 changes. You cannot mix in-order arguments and keyword arguments.
00055
00056 The available fields are:
00057 mode,color,frequency,timeout,pulses,priority
00058
00059 :param args: complete set of field values, in .msg order
00060 :param kwds: use keyword arguments corresponding to message field names
00061 to set specific fields.
00062 """
00063 if args or kwds:
00064 super(LightMode, self).__init__(*args, **kwds)
00065
00066 if self.mode is None:
00067 self.mode = 0
00068 if self.color is None:
00069 self.color = std_msgs.msg.ColorRGBA()
00070 if self.frequency is None:
00071 self.frequency = 0.
00072 if self.timeout is None:
00073 self.timeout = 0.
00074 if self.pulses is None:
00075 self.pulses = 0
00076 if self.priority is None:
00077 self.priority = 0
00078 else:
00079 self.mode = 0
00080 self.color = std_msgs.msg.ColorRGBA()
00081 self.frequency = 0.
00082 self.timeout = 0.
00083 self.pulses = 0
00084 self.priority = 0
00085
00086 def _get_types(self):
00087 """
00088 internal API method
00089 """
00090 return self._slot_types
00091
00092 def serialize(self, buff):
00093 """
00094 serialize message into buffer
00095 :param buff: buffer, ``StringIO``
00096 """
00097 try:
00098 _x = self
00099 buff.write(_struct_B6fib.pack(_x.mode, _x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.frequency, _x.timeout, _x.pulses, _x.priority))
00100 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00101 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00102
00103 def deserialize(self, str):
00104 """
00105 unpack serialized message in str into this message instance
00106 :param str: byte array of serialized message, ``str``
00107 """
00108 try:
00109 if self.color is None:
00110 self.color = std_msgs.msg.ColorRGBA()
00111 end = 0
00112 _x = self
00113 start = end
00114 end += 30
00115 (_x.mode, _x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.frequency, _x.timeout, _x.pulses, _x.priority,) = _struct_B6fib.unpack(str[start:end])
00116 return self
00117 except struct.error as e:
00118 raise genpy.DeserializationError(e)
00119
00120
00121 def serialize_numpy(self, buff, numpy):
00122 """
00123 serialize message with numpy array types into buffer
00124 :param buff: buffer, ``StringIO``
00125 :param numpy: numpy python module
00126 """
00127 try:
00128 _x = self
00129 buff.write(_struct_B6fib.pack(_x.mode, _x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.frequency, _x.timeout, _x.pulses, _x.priority))
00130 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00131 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00132
00133 def deserialize_numpy(self, str, numpy):
00134 """
00135 unpack serialized message in str into this message instance using numpy for array types
00136 :param str: byte array of serialized message, ``str``
00137 :param numpy: numpy python module
00138 """
00139 try:
00140 if self.color is None:
00141 self.color = std_msgs.msg.ColorRGBA()
00142 end = 0
00143 _x = self
00144 start = end
00145 end += 30
00146 (_x.mode, _x.color.r, _x.color.g, _x.color.b, _x.color.a, _x.frequency, _x.timeout, _x.pulses, _x.priority,) = _struct_B6fib.unpack(str[start:end])
00147 return self
00148 except struct.error as e:
00149 raise genpy.DeserializationError(e)
00150
00151 _struct_I = genpy.struct_I
00152 _struct_B6fib = struct.Struct("<B6fib")