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


cob_light
Author(s): Benjamin Maidel
autogenerated on Sun Oct 5 2014 23:09:07