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


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