_cop_camera_mode.py
Go to the documentation of this file.
00001 """autogenerated by genpy from vision_msgs/cop_camera_mode.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class cop_camera_mode(genpy.Message):
00009   _md5sum = "238c3e19ca5f691ca2ef2dd46e1bb593"
00010   _type = "vision_msgs/cop_camera_mode"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string VERY_DARK_ENVIRONMENT=VeryDarkEnvironment
00013 string DARK_ENVIRONMENT=DarkEnvironment
00014 string AVERAGE_ENVIRONMENT=AverageEnvironment
00015 string BRIGHT_ENVIRONMENT=BrightEnvironment
00016 
00017 string mode  # switches camera to different environment modes
00018 """
00019   # Pseudo-constants
00020   VERY_DARK_ENVIRONMENT = 'VeryDarkEnvironment'
00021   DARK_ENVIRONMENT = 'DarkEnvironment'
00022   AVERAGE_ENVIRONMENT = 'AverageEnvironment'
00023   BRIGHT_ENVIRONMENT = 'BrightEnvironment'
00024 
00025   __slots__ = ['mode']
00026   _slot_types = ['string']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        mode
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(cop_camera_mode, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.mode is None:
00046         self.mode = ''
00047     else:
00048       self.mode = ''
00049 
00050   def _get_types(self):
00051     """
00052     internal API method
00053     """
00054     return self._slot_types
00055 
00056   def serialize(self, buff):
00057     """
00058     serialize message into buffer
00059     :param buff: buffer, ``StringIO``
00060     """
00061     try:
00062       _x = self.mode
00063       length = len(_x)
00064       if python3 or type(_x) == unicode:
00065         _x = _x.encode('utf-8')
00066         length = len(_x)
00067       buff.write(struct.pack('<I%ss'%length, length, _x))
00068     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00069     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00070 
00071   def deserialize(self, str):
00072     """
00073     unpack serialized message in str into this message instance
00074     :param str: byte array of serialized message, ``str``
00075     """
00076     try:
00077       end = 0
00078       start = end
00079       end += 4
00080       (length,) = _struct_I.unpack(str[start:end])
00081       start = end
00082       end += length
00083       if python3:
00084         self.mode = str[start:end].decode('utf-8')
00085       else:
00086         self.mode = str[start:end]
00087       return self
00088     except struct.error as e:
00089       raise genpy.DeserializationError(e) #most likely buffer underfill
00090 
00091 
00092   def serialize_numpy(self, buff, numpy):
00093     """
00094     serialize message with numpy array types into buffer
00095     :param buff: buffer, ``StringIO``
00096     :param numpy: numpy python module
00097     """
00098     try:
00099       _x = self.mode
00100       length = len(_x)
00101       if python3 or type(_x) == unicode:
00102         _x = _x.encode('utf-8')
00103         length = len(_x)
00104       buff.write(struct.pack('<I%ss'%length, length, _x))
00105     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00106     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00107 
00108   def deserialize_numpy(self, str, numpy):
00109     """
00110     unpack serialized message in str into this message instance using numpy for array types
00111     :param str: byte array of serialized message, ``str``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       end = 0
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += length
00121       if python3:
00122         self.mode = str[start:end].decode('utf-8')
00123       else:
00124         self.mode = str[start:end]
00125       return self
00126     except struct.error as e:
00127       raise genpy.DeserializationError(e) #most likely buffer underfill
00128 
00129 _struct_I = genpy.struct_I


vision_msgs
Author(s): Ulrich F Klank
autogenerated on Mon Oct 6 2014 00:47:36