_DockInfraRed.py
Go to the documentation of this file.
00001 """autogenerated by genpy from kobuki_comms/DockInfraRed.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 DockInfraRed(genpy.Message):
00010   _md5sum = "4247d91ea10269fb062c53396d016a2c"
00011   _type = "kobuki_comms/DockInfraRed"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """uint8 NEAR_LEFT   =  1
00014 uint8 NEAR_CENTER =  2
00015 uint8 NEAR_RIGHT  =  4
00016 uint8 FAR_LEFT    =  8
00017 uint8 FAR_CENTER  = 16
00018 uint8 FAR_RIGHT   = 32
00019 
00020 Header header
00021 uint8[] data
00022 
00023 ================================================================================
00024 MSG: std_msgs/Header
00025 # Standard metadata for higher-level stamped data types.
00026 # This is generally used to communicate timestamped data 
00027 # in a particular coordinate frame.
00028 # 
00029 # sequence ID: consecutively increasing ID 
00030 uint32 seq
00031 #Two-integer timestamp that is expressed as:
00032 # * stamp.secs: seconds (stamp_secs) since epoch
00033 # * stamp.nsecs: nanoseconds since stamp_secs
00034 # time-handling sugar is provided by the client library
00035 time stamp
00036 #Frame this data is associated with
00037 # 0: no frame
00038 # 1: global frame
00039 string frame_id
00040 
00041 """
00042   # Pseudo-constants
00043   NEAR_LEFT = 1
00044   NEAR_CENTER = 2
00045   NEAR_RIGHT = 4
00046   FAR_LEFT = 8
00047   FAR_CENTER = 16
00048   FAR_RIGHT = 32
00049 
00050   __slots__ = ['header','data']
00051   _slot_types = ['std_msgs/Header','uint8[]']
00052 
00053   def __init__(self, *args, **kwds):
00054     """
00055     Constructor. Any message fields that are implicitly/explicitly
00056     set to None will be assigned a default value. The recommend
00057     use is keyword arguments as this is more robust to future message
00058     changes.  You cannot mix in-order arguments and keyword arguments.
00059 
00060     The available fields are:
00061        header,data
00062 
00063     :param args: complete set of field values, in .msg order
00064     :param kwds: use keyword arguments corresponding to message field names
00065     to set specific fields.
00066     """
00067     if args or kwds:
00068       super(DockInfraRed, self).__init__(*args, **kwds)
00069       #message fields cannot be None, assign default values for those that are
00070       if self.header is None:
00071         self.header = std_msgs.msg.Header()
00072       if self.data is None:
00073         self.data = ''
00074     else:
00075       self.header = std_msgs.msg.Header()
00076       self.data = ''
00077 
00078   def _get_types(self):
00079     """
00080     internal API method
00081     """
00082     return self._slot_types
00083 
00084   def serialize(self, buff):
00085     """
00086     serialize message into buffer
00087     :param buff: buffer, ``StringIO``
00088     """
00089     try:
00090       _x = self
00091       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00092       _x = self.header.frame_id
00093       length = len(_x)
00094       if python3 or type(_x) == unicode:
00095         _x = _x.encode('utf-8')
00096         length = len(_x)
00097       buff.write(struct.pack('<I%ss'%length, length, _x))
00098       _x = self.data
00099       length = len(_x)
00100       # - if encoded as a list instead, serialize as bytes instead of string
00101       if type(_x) in [list, tuple]:
00102         buff.write(struct.pack('<I%sB'%length, length, *_x))
00103       else:
00104         buff.write(struct.pack('<I%ss'%length, length, _x))
00105     except struct.error as se: self._check_types(se)
00106     except TypeError as te: self._check_types(te)
00107 
00108   def deserialize(self, str):
00109     """
00110     unpack serialized message in str into this message instance
00111     :param str: byte array of serialized message, ``str``
00112     """
00113     try:
00114       if self.header is None:
00115         self.header = std_msgs.msg.Header()
00116       end = 0
00117       _x = self
00118       start = end
00119       end += 12
00120       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00121       start = end
00122       end += 4
00123       (length,) = _struct_I.unpack(str[start:end])
00124       start = end
00125       end += length
00126       if python3:
00127         self.header.frame_id = str[start:end].decode('utf-8')
00128       else:
00129         self.header.frame_id = str[start:end]
00130       start = end
00131       end += 4
00132       (length,) = _struct_I.unpack(str[start:end])
00133       start = end
00134       end += length
00135       if python3:
00136         self.data = str[start:end].decode('utf-8')
00137       else:
00138         self.data = str[start:end]
00139       return self
00140     except struct.error as e:
00141       raise genpy.DeserializationError(e) #most likely buffer underfill
00142 
00143 
00144   def serialize_numpy(self, buff, numpy):
00145     """
00146     serialize message with numpy array types into buffer
00147     :param buff: buffer, ``StringIO``
00148     :param numpy: numpy python module
00149     """
00150     try:
00151       _x = self
00152       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00153       _x = self.header.frame_id
00154       length = len(_x)
00155       if python3 or type(_x) == unicode:
00156         _x = _x.encode('utf-8')
00157         length = len(_x)
00158       buff.write(struct.pack('<I%ss'%length, length, _x))
00159       _x = self.data
00160       length = len(_x)
00161       # - if encoded as a list instead, serialize as bytes instead of string
00162       if type(_x) in [list, tuple]:
00163         buff.write(struct.pack('<I%sB'%length, length, *_x))
00164       else:
00165         buff.write(struct.pack('<I%ss'%length, length, _x))
00166     except struct.error as se: self._check_types(se)
00167     except TypeError as te: self._check_types(te)
00168 
00169   def deserialize_numpy(self, str, numpy):
00170     """
00171     unpack serialized message in str into this message instance using numpy for array types
00172     :param str: byte array of serialized message, ``str``
00173     :param numpy: numpy python module
00174     """
00175     try:
00176       if self.header is None:
00177         self.header = std_msgs.msg.Header()
00178       end = 0
00179       _x = self
00180       start = end
00181       end += 12
00182       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00183       start = end
00184       end += 4
00185       (length,) = _struct_I.unpack(str[start:end])
00186       start = end
00187       end += length
00188       if python3:
00189         self.header.frame_id = str[start:end].decode('utf-8')
00190       else:
00191         self.header.frame_id = str[start:end]
00192       start = end
00193       end += 4
00194       (length,) = _struct_I.unpack(str[start:end])
00195       start = end
00196       end += length
00197       if python3:
00198         self.data = str[start:end].decode('utf-8')
00199       else:
00200         self.data = str[start:end]
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 _struct_I = genpy.struct_I
00206 _struct_3I = struct.Struct("<3I")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


kobuki_comms
Author(s): Daniel Stonier, 주영훈
autogenerated on Thu Nov 15 2012 18:05:16