_SystemStatus.py
Go to the documentation of this file.
00001 """autogenerated by genpy from clearpath_base/SystemStatus.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 SystemStatus(genpy.Message):
00010   _md5sum = "b24850c808eb727058fff35ba598006f"
00011   _type = "clearpath_base/SystemStatus"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 uint32 uptime
00015 float64[] voltages
00016 float64[] currents
00017 float64[] temperatures
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','uptime','voltages','currents','temperatures']
00039   _slot_types = ['std_msgs/Header','uint32','float64[]','float64[]','float64[]']
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,uptime,voltages,currents,temperatures
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(SystemStatus, 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.uptime is None:
00061         self.uptime = 0
00062       if self.voltages is None:
00063         self.voltages = []
00064       if self.currents is None:
00065         self.currents = []
00066       if self.temperatures is None:
00067         self.temperatures = []
00068     else:
00069       self.header = std_msgs.msg.Header()
00070       self.uptime = 0
00071       self.voltages = []
00072       self.currents = []
00073       self.temperatures = []
00074 
00075   def _get_types(self):
00076     """
00077     internal API method
00078     """
00079     return self._slot_types
00080 
00081   def serialize(self, buff):
00082     """
00083     serialize message into buffer
00084     :param buff: buffer, ``StringIO``
00085     """
00086     try:
00087       _x = self
00088       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00089       _x = self.header.frame_id
00090       length = len(_x)
00091       if python3 or type(_x) == unicode:
00092         _x = _x.encode('utf-8')
00093         length = len(_x)
00094       buff.write(struct.pack('<I%ss'%length, length, _x))
00095       buff.write(_struct_I.pack(self.uptime))
00096       length = len(self.voltages)
00097       buff.write(_struct_I.pack(length))
00098       pattern = '<%sd'%length
00099       buff.write(struct.pack(pattern, *self.voltages))
00100       length = len(self.currents)
00101       buff.write(_struct_I.pack(length))
00102       pattern = '<%sd'%length
00103       buff.write(struct.pack(pattern, *self.currents))
00104       length = len(self.temperatures)
00105       buff.write(_struct_I.pack(length))
00106       pattern = '<%sd'%length
00107       buff.write(struct.pack(pattern, *self.temperatures))
00108     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00109     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00110 
00111   def deserialize(self, str):
00112     """
00113     unpack serialized message in str into this message instance
00114     :param str: byte array of serialized message, ``str``
00115     """
00116     try:
00117       if self.header is None:
00118         self.header = std_msgs.msg.Header()
00119       end = 0
00120       _x = self
00121       start = end
00122       end += 12
00123       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00124       start = end
00125       end += 4
00126       (length,) = _struct_I.unpack(str[start:end])
00127       start = end
00128       end += length
00129       if python3:
00130         self.header.frame_id = str[start:end].decode('utf-8')
00131       else:
00132         self.header.frame_id = str[start:end]
00133       start = end
00134       end += 4
00135       (self.uptime,) = _struct_I.unpack(str[start:end])
00136       start = end
00137       end += 4
00138       (length,) = _struct_I.unpack(str[start:end])
00139       pattern = '<%sd'%length
00140       start = end
00141       end += struct.calcsize(pattern)
00142       self.voltages = struct.unpack(pattern, str[start:end])
00143       start = end
00144       end += 4
00145       (length,) = _struct_I.unpack(str[start:end])
00146       pattern = '<%sd'%length
00147       start = end
00148       end += struct.calcsize(pattern)
00149       self.currents = struct.unpack(pattern, str[start:end])
00150       start = end
00151       end += 4
00152       (length,) = _struct_I.unpack(str[start:end])
00153       pattern = '<%sd'%length
00154       start = end
00155       end += struct.calcsize(pattern)
00156       self.temperatures = struct.unpack(pattern, str[start:end])
00157       return self
00158     except struct.error as e:
00159       raise genpy.DeserializationError(e) #most likely buffer underfill
00160 
00161 
00162   def serialize_numpy(self, buff, numpy):
00163     """
00164     serialize message with numpy array types into buffer
00165     :param buff: buffer, ``StringIO``
00166     :param numpy: numpy python module
00167     """
00168     try:
00169       _x = self
00170       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00171       _x = self.header.frame_id
00172       length = len(_x)
00173       if python3 or type(_x) == unicode:
00174         _x = _x.encode('utf-8')
00175         length = len(_x)
00176       buff.write(struct.pack('<I%ss'%length, length, _x))
00177       buff.write(_struct_I.pack(self.uptime))
00178       length = len(self.voltages)
00179       buff.write(_struct_I.pack(length))
00180       pattern = '<%sd'%length
00181       buff.write(self.voltages.tostring())
00182       length = len(self.currents)
00183       buff.write(_struct_I.pack(length))
00184       pattern = '<%sd'%length
00185       buff.write(self.currents.tostring())
00186       length = len(self.temperatures)
00187       buff.write(_struct_I.pack(length))
00188       pattern = '<%sd'%length
00189       buff.write(self.temperatures.tostring())
00190     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00191     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00192 
00193   def deserialize_numpy(self, str, numpy):
00194     """
00195     unpack serialized message in str into this message instance using numpy for array types
00196     :param str: byte array of serialized message, ``str``
00197     :param numpy: numpy python module
00198     """
00199     try:
00200       if self.header is None:
00201         self.header = std_msgs.msg.Header()
00202       end = 0
00203       _x = self
00204       start = end
00205       end += 12
00206       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00207       start = end
00208       end += 4
00209       (length,) = _struct_I.unpack(str[start:end])
00210       start = end
00211       end += length
00212       if python3:
00213         self.header.frame_id = str[start:end].decode('utf-8')
00214       else:
00215         self.header.frame_id = str[start:end]
00216       start = end
00217       end += 4
00218       (self.uptime,) = _struct_I.unpack(str[start:end])
00219       start = end
00220       end += 4
00221       (length,) = _struct_I.unpack(str[start:end])
00222       pattern = '<%sd'%length
00223       start = end
00224       end += struct.calcsize(pattern)
00225       self.voltages = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00226       start = end
00227       end += 4
00228       (length,) = _struct_I.unpack(str[start:end])
00229       pattern = '<%sd'%length
00230       start = end
00231       end += struct.calcsize(pattern)
00232       self.currents = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00233       start = end
00234       end += 4
00235       (length,) = _struct_I.unpack(str[start:end])
00236       pattern = '<%sd'%length
00237       start = end
00238       end += struct.calcsize(pattern)
00239       self.temperatures = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00240       return self
00241     except struct.error as e:
00242       raise genpy.DeserializationError(e) #most likely buffer underfill
00243 
00244 _struct_I = genpy.struct_I
00245 _struct_3I = struct.Struct("<3I")


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