_PowerStatus.py
Go to the documentation of this file.
00001 """autogenerated by genpy from clearpath_base/PowerStatus.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 clearpath_base.msg
00008 import std_msgs.msg
00009 
00010 class PowerStatus(genpy.Message):
00011   _md5sum = "f246c359530c58415aee4fe89d1aca04"
00012   _type = "clearpath_base/PowerStatus"
00013   _has_header = True #flag to mark the presence of a Header object
00014   _full_text = """Header header
00015 PowerSource[] sources
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 MSG: clearpath_base/PowerSource
00037 float32 charge
00038 int16 capacity
00039 bool present
00040 bool in_use
00041 uint8 description
00042 
00043 """
00044   __slots__ = ['header','sources']
00045   _slot_types = ['std_msgs/Header','clearpath_base/PowerSource[]']
00046 
00047   def __init__(self, *args, **kwds):
00048     """
00049     Constructor. Any message fields that are implicitly/explicitly
00050     set to None will be assigned a default value. The recommend
00051     use is keyword arguments as this is more robust to future message
00052     changes.  You cannot mix in-order arguments and keyword arguments.
00053 
00054     The available fields are:
00055        header,sources
00056 
00057     :param args: complete set of field values, in .msg order
00058     :param kwds: use keyword arguments corresponding to message field names
00059     to set specific fields.
00060     """
00061     if args or kwds:
00062       super(PowerStatus, self).__init__(*args, **kwds)
00063       #message fields cannot be None, assign default values for those that are
00064       if self.header is None:
00065         self.header = std_msgs.msg.Header()
00066       if self.sources is None:
00067         self.sources = []
00068     else:
00069       self.header = std_msgs.msg.Header()
00070       self.sources = []
00071 
00072   def _get_types(self):
00073     """
00074     internal API method
00075     """
00076     return self._slot_types
00077 
00078   def serialize(self, buff):
00079     """
00080     serialize message into buffer
00081     :param buff: buffer, ``StringIO``
00082     """
00083     try:
00084       _x = self
00085       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00086       _x = self.header.frame_id
00087       length = len(_x)
00088       if python3 or type(_x) == unicode:
00089         _x = _x.encode('utf-8')
00090         length = len(_x)
00091       buff.write(struct.pack('<I%ss'%length, length, _x))
00092       length = len(self.sources)
00093       buff.write(_struct_I.pack(length))
00094       for val1 in self.sources:
00095         _x = val1
00096         buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description))
00097     except struct.error as se: self._check_types(se)
00098     except TypeError as te: self._check_types(te)
00099 
00100   def deserialize(self, str):
00101     """
00102     unpack serialized message in str into this message instance
00103     :param str: byte array of serialized message, ``str``
00104     """
00105     try:
00106       if self.header is None:
00107         self.header = std_msgs.msg.Header()
00108       if self.sources is None:
00109         self.sources = None
00110       end = 0
00111       _x = self
00112       start = end
00113       end += 12
00114       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00115       start = end
00116       end += 4
00117       (length,) = _struct_I.unpack(str[start:end])
00118       start = end
00119       end += length
00120       if python3:
00121         self.header.frame_id = str[start:end].decode('utf-8')
00122       else:
00123         self.header.frame_id = str[start:end]
00124       start = end
00125       end += 4
00126       (length,) = _struct_I.unpack(str[start:end])
00127       self.sources = []
00128       for i in range(0, length):
00129         val1 = clearpath_base.msg.PowerSource()
00130         _x = val1
00131         start = end
00132         end += 9
00133         (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end])
00134         val1.present = bool(val1.present)
00135         val1.in_use = bool(val1.in_use)
00136         self.sources.append(val1)
00137       return self
00138     except struct.error as e:
00139       raise genpy.DeserializationError(e) #most likely buffer underfill
00140 
00141 
00142   def serialize_numpy(self, buff, numpy):
00143     """
00144     serialize message with numpy array types into buffer
00145     :param buff: buffer, ``StringIO``
00146     :param numpy: numpy python module
00147     """
00148     try:
00149       _x = self
00150       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00151       _x = self.header.frame_id
00152       length = len(_x)
00153       if python3 or type(_x) == unicode:
00154         _x = _x.encode('utf-8')
00155         length = len(_x)
00156       buff.write(struct.pack('<I%ss'%length, length, _x))
00157       length = len(self.sources)
00158       buff.write(_struct_I.pack(length))
00159       for val1 in self.sources:
00160         _x = val1
00161         buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description))
00162     except struct.error as se: self._check_types(se)
00163     except TypeError as te: self._check_types(te)
00164 
00165   def deserialize_numpy(self, str, numpy):
00166     """
00167     unpack serialized message in str into this message instance using numpy for array types
00168     :param str: byte array of serialized message, ``str``
00169     :param numpy: numpy python module
00170     """
00171     try:
00172       if self.header is None:
00173         self.header = std_msgs.msg.Header()
00174       if self.sources is None:
00175         self.sources = None
00176       end = 0
00177       _x = self
00178       start = end
00179       end += 12
00180       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00181       start = end
00182       end += 4
00183       (length,) = _struct_I.unpack(str[start:end])
00184       start = end
00185       end += length
00186       if python3:
00187         self.header.frame_id = str[start:end].decode('utf-8')
00188       else:
00189         self.header.frame_id = str[start:end]
00190       start = end
00191       end += 4
00192       (length,) = _struct_I.unpack(str[start:end])
00193       self.sources = []
00194       for i in range(0, length):
00195         val1 = clearpath_base.msg.PowerSource()
00196         _x = val1
00197         start = end
00198         end += 9
00199         (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end])
00200         val1.present = bool(val1.present)
00201         val1.in_use = bool(val1.in_use)
00202         self.sources.append(val1)
00203       return self
00204     except struct.error as e:
00205       raise genpy.DeserializationError(e) #most likely buffer underfill
00206 
00207 _struct_I = genpy.struct_I
00208 _struct_fh3B = struct.Struct("<fh3B")
00209 _struct_3I = struct.Struct("<3I")


clearpath_base
Author(s): Mike Purvis
autogenerated on Sat Dec 28 2013 16:50:47