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


metralabs_msgs
Author(s): Felix Kolbe
autogenerated on Mon Oct 6 2014 07:27:55