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


clearpath_base
Author(s): Mike Purvis
autogenerated on Sun Oct 5 2014 22:52:08