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


reem_msgs
Author(s): Jordan Palacios
autogenerated on Thu Jan 2 2014 11:36:42