_BatteryState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_msgs/BatteryState.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class BatteryState(genpy.Message):
00009   _md5sum = "00e9f996c2fc26700fd25abcd8422db0"
00010   _type = "pr2_msgs/BatteryState"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# DEPRECATED.  Use pr2_msgs/BatteryState2 instead.
00013 # Each batteries registers
00014 int32 lastTimeBattery #epoch time
00015 uint16[48] batReg
00016 uint16[48] batRegFlag
00017 int32[48] batRegTime
00018 
00019 """
00020   __slots__ = ['lastTimeBattery','batReg','batRegFlag','batRegTime']
00021   _slot_types = ['int32','uint16[48]','uint16[48]','int32[48]']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        lastTimeBattery,batReg,batRegFlag,batRegTime
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(BatteryState, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.lastTimeBattery is None:
00041         self.lastTimeBattery = 0
00042       if self.batReg is None:
00043         self.batReg = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00044       if self.batRegFlag is None:
00045         self.batRegFlag = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00046       if self.batRegTime is None:
00047         self.batRegTime = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00048     else:
00049       self.lastTimeBattery = 0
00050       self.batReg = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00051       self.batRegFlag = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00052       self.batRegTime = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00053 
00054   def _get_types(self):
00055     """
00056     internal API method
00057     """
00058     return self._slot_types
00059 
00060   def serialize(self, buff):
00061     """
00062     serialize message into buffer
00063     :param buff: buffer, ``StringIO``
00064     """
00065     try:
00066       buff.write(_struct_i.pack(self.lastTimeBattery))
00067       buff.write(_struct_48H.pack(*self.batReg))
00068       buff.write(_struct_48H.pack(*self.batRegFlag))
00069       buff.write(_struct_48i.pack(*self.batRegTime))
00070     except struct.error as se: self._check_types(se)
00071     except TypeError as te: self._check_types(te)
00072 
00073   def deserialize(self, str):
00074     """
00075     unpack serialized message in str into this message instance
00076     :param str: byte array of serialized message, ``str``
00077     """
00078     try:
00079       end = 0
00080       start = end
00081       end += 4
00082       (self.lastTimeBattery,) = _struct_i.unpack(str[start:end])
00083       start = end
00084       end += 96
00085       self.batReg = _struct_48H.unpack(str[start:end])
00086       start = end
00087       end += 96
00088       self.batRegFlag = _struct_48H.unpack(str[start:end])
00089       start = end
00090       end += 192
00091       self.batRegTime = _struct_48i.unpack(str[start:end])
00092       return self
00093     except struct.error as e:
00094       raise genpy.DeserializationError(e) #most likely buffer underfill
00095 
00096 
00097   def serialize_numpy(self, buff, numpy):
00098     """
00099     serialize message with numpy array types into buffer
00100     :param buff: buffer, ``StringIO``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       buff.write(_struct_i.pack(self.lastTimeBattery))
00105       buff.write(self.batReg.tostring())
00106       buff.write(self.batRegFlag.tostring())
00107       buff.write(self.batRegTime.tostring())
00108     except struct.error as se: self._check_types(se)
00109     except TypeError as te: self._check_types(te)
00110 
00111   def deserialize_numpy(self, str, numpy):
00112     """
00113     unpack serialized message in str into this message instance using numpy for array types
00114     :param str: byte array of serialized message, ``str``
00115     :param numpy: numpy python module
00116     """
00117     try:
00118       end = 0
00119       start = end
00120       end += 4
00121       (self.lastTimeBattery,) = _struct_i.unpack(str[start:end])
00122       start = end
00123       end += 96
00124       self.batReg = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=48)
00125       start = end
00126       end += 96
00127       self.batRegFlag = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=48)
00128       start = end
00129       end += 192
00130       self.batRegTime = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=48)
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_i = struct.Struct("<i")
00137 _struct_48i = struct.Struct("<48i")
00138 _struct_48H = struct.Struct("<48H")


pr2_msgs
Author(s): Eric Berger and many others
autogenerated on Mon Jan 6 2014 11:34:07