_SetLightMode.py
Go to the documentation of this file.
00001 """autogenerated by genpy from cob_light/SetLightModeRequest.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 SetLightModeRequest(genpy.Message):
00011   _md5sum = "bfc3763d6f527fc6f26b234ea07ebf58"
00012   _type = "cob_light/SetLightModeRequest"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """cob_light/LightMode mode
00015 
00016 ================================================================================
00017 MSG: cob_light/LightMode
00018 uint8 mode
00019 uint8 NONE = 0                  # will turn everything off
00020 uint8 STATIC = 1                # will change the LEDs to "color"
00021 uint8 FLASH = 2                 # will change the LEDs frequently with "frequency" from "color" to black
00022 uint8 BREATH = 3                # will change the LEDs smoothly with "frequency" from "color" to black
00023 uint8 BREATH_COLOR = 4  # will change the LEDs smoothly with "frequency" from "color" to black
00024                                                 # and flips color in time
00025 uint8 FADE_COLOR = 5    # will fade the colors in rainbow
00026 
00027 std_msgs/ColorRGBA color #the color which will be used
00028 float32 frequency               # in Hz
00029 float32 timeout                 # in s, requested mode will be executed for max timout s.
00030                                                 # default is 0 and meens no timeout.
00031 int32 pulses                    # spezifies the amount of pulses which will be executed.
00032                                                 # eg: mode = flash, pulses = 2. Meens the light will flash two times
00033 int8 priority                   # priority [-20,20] default = 0. Modes with same or higher priorities will 
00034                                                 # be executed.
00035 ================================================================================
00036 MSG: std_msgs/ColorRGBA
00037 float32 r
00038 float32 g
00039 float32 b
00040 float32 a
00041 
00042 """
00043   __slots__ = ['mode']
00044   _slot_types = ['cob_light/LightMode']
00045 
00046   def __init__(self, *args, **kwds):
00047     """
00048     Constructor. Any message fields that are implicitly/explicitly
00049     set to None will be assigned a default value. The recommend
00050     use is keyword arguments as this is more robust to future message
00051     changes.  You cannot mix in-order arguments and keyword arguments.
00052 
00053     The available fields are:
00054        mode
00055 
00056     :param args: complete set of field values, in .msg order
00057     :param kwds: use keyword arguments corresponding to message field names
00058     to set specific fields.
00059     """
00060     if args or kwds:
00061       super(SetLightModeRequest, self).__init__(*args, **kwds)
00062       #message fields cannot be None, assign default values for those that are
00063       if self.mode is None:
00064         self.mode = cob_light.msg.LightMode()
00065     else:
00066       self.mode = cob_light.msg.LightMode()
00067 
00068   def _get_types(self):
00069     """
00070     internal API method
00071     """
00072     return self._slot_types
00073 
00074   def serialize(self, buff):
00075     """
00076     serialize message into buffer
00077     :param buff: buffer, ``StringIO``
00078     """
00079     try:
00080       _x = self
00081       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))
00082     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00083     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00084 
00085   def deserialize(self, str):
00086     """
00087     unpack serialized message in str into this message instance
00088     :param str: byte array of serialized message, ``str``
00089     """
00090     try:
00091       if self.mode is None:
00092         self.mode = cob_light.msg.LightMode()
00093       end = 0
00094       _x = self
00095       start = end
00096       end += 30
00097       (_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])
00098       return self
00099     except struct.error as e:
00100       raise genpy.DeserializationError(e) #most likely buffer underfill
00101 
00102 
00103   def serialize_numpy(self, buff, numpy):
00104     """
00105     serialize message with numpy array types into buffer
00106     :param buff: buffer, ``StringIO``
00107     :param numpy: numpy python module
00108     """
00109     try:
00110       _x = self
00111       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))
00112     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00113     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00114 
00115   def deserialize_numpy(self, str, numpy):
00116     """
00117     unpack serialized message in str into this message instance using numpy for array types
00118     :param str: byte array of serialized message, ``str``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       if self.mode is None:
00123         self.mode = cob_light.msg.LightMode()
00124       end = 0
00125       _x = self
00126       start = end
00127       end += 30
00128       (_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])
00129       return self
00130     except struct.error as e:
00131       raise genpy.DeserializationError(e) #most likely buffer underfill
00132 
00133 _struct_I = genpy.struct_I
00134 _struct_B6fib = struct.Struct("<B6fib")
00135 """autogenerated by genpy from cob_light/SetLightModeResponse.msg. Do not edit."""
00136 import sys
00137 python3 = True if sys.hexversion > 0x03000000 else False
00138 import genpy
00139 import struct
00140 
00141 
00142 class SetLightModeResponse(genpy.Message):
00143   _md5sum = "18daff0db423efd323f68cd039226daa"
00144   _type = "cob_light/SetLightModeResponse"
00145   _has_header = False #flag to mark the presence of a Header object
00146   _full_text = """uint8 active_mode
00147 uint8 active_priority
00148 
00149 
00150 """
00151   __slots__ = ['active_mode','active_priority']
00152   _slot_types = ['uint8','uint8']
00153 
00154   def __init__(self, *args, **kwds):
00155     """
00156     Constructor. Any message fields that are implicitly/explicitly
00157     set to None will be assigned a default value. The recommend
00158     use is keyword arguments as this is more robust to future message
00159     changes.  You cannot mix in-order arguments and keyword arguments.
00160 
00161     The available fields are:
00162        active_mode,active_priority
00163 
00164     :param args: complete set of field values, in .msg order
00165     :param kwds: use keyword arguments corresponding to message field names
00166     to set specific fields.
00167     """
00168     if args or kwds:
00169       super(SetLightModeResponse, self).__init__(*args, **kwds)
00170       #message fields cannot be None, assign default values for those that are
00171       if self.active_mode is None:
00172         self.active_mode = 0
00173       if self.active_priority is None:
00174         self.active_priority = 0
00175     else:
00176       self.active_mode = 0
00177       self.active_priority = 0
00178 
00179   def _get_types(self):
00180     """
00181     internal API method
00182     """
00183     return self._slot_types
00184 
00185   def serialize(self, buff):
00186     """
00187     serialize message into buffer
00188     :param buff: buffer, ``StringIO``
00189     """
00190     try:
00191       _x = self
00192       buff.write(_struct_2B.pack(_x.active_mode, _x.active_priority))
00193     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00194     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00195 
00196   def deserialize(self, str):
00197     """
00198     unpack serialized message in str into this message instance
00199     :param str: byte array of serialized message, ``str``
00200     """
00201     try:
00202       end = 0
00203       _x = self
00204       start = end
00205       end += 2
00206       (_x.active_mode, _x.active_priority,) = _struct_2B.unpack(str[start:end])
00207       return self
00208     except struct.error as e:
00209       raise genpy.DeserializationError(e) #most likely buffer underfill
00210 
00211 
00212   def serialize_numpy(self, buff, numpy):
00213     """
00214     serialize message with numpy array types into buffer
00215     :param buff: buffer, ``StringIO``
00216     :param numpy: numpy python module
00217     """
00218     try:
00219       _x = self
00220       buff.write(_struct_2B.pack(_x.active_mode, _x.active_priority))
00221     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00222     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00223 
00224   def deserialize_numpy(self, str, numpy):
00225     """
00226     unpack serialized message in str into this message instance using numpy for array types
00227     :param str: byte array of serialized message, ``str``
00228     :param numpy: numpy python module
00229     """
00230     try:
00231       end = 0
00232       _x = self
00233       start = end
00234       end += 2
00235       (_x.active_mode, _x.active_priority,) = _struct_2B.unpack(str[start:end])
00236       return self
00237     except struct.error as e:
00238       raise genpy.DeserializationError(e) #most likely buffer underfill
00239 
00240 _struct_I = genpy.struct_I
00241 _struct_2B = struct.Struct("<2B")
00242 class SetLightMode(object):
00243   _type          = 'cob_light/SetLightMode'
00244   _md5sum = '57298654f4212b21595f18a9835f0a95'
00245   _request_class  = SetLightModeRequest
00246   _response_class = SetLightModeResponse


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