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


roomba_500_series
Author(s): Gonçalo Cabrita
autogenerated on Mon Jan 6 2014 11:26:40