_PowerState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_msgs/PowerState.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 genpy
00008 import std_msgs.msg
00009 
00010 class PowerState(genpy.Message):
00011   _md5sum = "e6fa46a387cad0b7a80959a21587a6c9"
00012   _type = "pr2_msgs/PowerState"
00013   _has_header = True #flag to mark the presence of a Header object
00014   _full_text = """# This message communicates the state of the PR2's power system.
00015 Header header
00016 float64 power_consumption ## Watts
00017 duration time_remaining ## estimated time to empty or full
00018 string prediction_method ## how time_remaining is being calculated
00019 int8  relative_capacity ## percent of capacity
00020 int8  AC_present ## number of packs detecting AC power, > 0 means plugged in
00021 
00022 ================================================================================
00023 MSG: std_msgs/Header
00024 # Standard metadata for higher-level stamped data types.
00025 # This is generally used to communicate timestamped data 
00026 # in a particular coordinate frame.
00027 # 
00028 # sequence ID: consecutively increasing ID 
00029 uint32 seq
00030 #Two-integer timestamp that is expressed as:
00031 # * stamp.secs: seconds (stamp_secs) since epoch
00032 # * stamp.nsecs: nanoseconds since stamp_secs
00033 # time-handling sugar is provided by the client library
00034 time stamp
00035 #Frame this data is associated with
00036 # 0: no frame
00037 # 1: global frame
00038 string frame_id
00039 
00040 """
00041   __slots__ = ['header','power_consumption','time_remaining','prediction_method','relative_capacity','AC_present']
00042   _slot_types = ['std_msgs/Header','float64','duration','string','int8','int8']
00043 
00044   def __init__(self, *args, **kwds):
00045     """
00046     Constructor. Any message fields that are implicitly/explicitly
00047     set to None will be assigned a default value. The recommend
00048     use is keyword arguments as this is more robust to future message
00049     changes.  You cannot mix in-order arguments and keyword arguments.
00050 
00051     The available fields are:
00052        header,power_consumption,time_remaining,prediction_method,relative_capacity,AC_present
00053 
00054     :param args: complete set of field values, in .msg order
00055     :param kwds: use keyword arguments corresponding to message field names
00056     to set specific fields.
00057     """
00058     if args or kwds:
00059       super(PowerState, self).__init__(*args, **kwds)
00060       #message fields cannot be None, assign default values for those that are
00061       if self.header is None:
00062         self.header = std_msgs.msg.Header()
00063       if self.power_consumption is None:
00064         self.power_consumption = 0.
00065       if self.time_remaining is None:
00066         self.time_remaining = genpy.Duration()
00067       if self.prediction_method is None:
00068         self.prediction_method = ''
00069       if self.relative_capacity is None:
00070         self.relative_capacity = 0
00071       if self.AC_present is None:
00072         self.AC_present = 0
00073     else:
00074       self.header = std_msgs.msg.Header()
00075       self.power_consumption = 0.
00076       self.time_remaining = genpy.Duration()
00077       self.prediction_method = ''
00078       self.relative_capacity = 0
00079       self.AC_present = 0
00080 
00081   def _get_types(self):
00082     """
00083     internal API method
00084     """
00085     return self._slot_types
00086 
00087   def serialize(self, buff):
00088     """
00089     serialize message into buffer
00090     :param buff: buffer, ``StringIO``
00091     """
00092     try:
00093       _x = self
00094       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00095       _x = self.header.frame_id
00096       length = len(_x)
00097       if python3 or type(_x) == unicode:
00098         _x = _x.encode('utf-8')
00099         length = len(_x)
00100       buff.write(struct.pack('<I%ss'%length, length, _x))
00101       _x = self
00102       buff.write(_struct_d2i.pack(_x.power_consumption, _x.time_remaining.secs, _x.time_remaining.nsecs))
00103       _x = self.prediction_method
00104       length = len(_x)
00105       if python3 or type(_x) == unicode:
00106         _x = _x.encode('utf-8')
00107         length = len(_x)
00108       buff.write(struct.pack('<I%ss'%length, length, _x))
00109       _x = self
00110       buff.write(_struct_2b.pack(_x.relative_capacity, _x.AC_present))
00111     except struct.error as se: self._check_types(se)
00112     except TypeError as te: self._check_types(te)
00113 
00114   def deserialize(self, str):
00115     """
00116     unpack serialized message in str into this message instance
00117     :param str: byte array of serialized message, ``str``
00118     """
00119     try:
00120       if self.header is None:
00121         self.header = std_msgs.msg.Header()
00122       if self.time_remaining is None:
00123         self.time_remaining = genpy.Duration()
00124       end = 0
00125       _x = self
00126       start = end
00127       end += 12
00128       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00129       start = end
00130       end += 4
00131       (length,) = _struct_I.unpack(str[start:end])
00132       start = end
00133       end += length
00134       if python3:
00135         self.header.frame_id = str[start:end].decode('utf-8')
00136       else:
00137         self.header.frame_id = str[start:end]
00138       _x = self
00139       start = end
00140       end += 16
00141       (_x.power_consumption, _x.time_remaining.secs, _x.time_remaining.nsecs,) = _struct_d2i.unpack(str[start:end])
00142       start = end
00143       end += 4
00144       (length,) = _struct_I.unpack(str[start:end])
00145       start = end
00146       end += length
00147       if python3:
00148         self.prediction_method = str[start:end].decode('utf-8')
00149       else:
00150         self.prediction_method = str[start:end]
00151       _x = self
00152       start = end
00153       end += 2
00154       (_x.relative_capacity, _x.AC_present,) = _struct_2b.unpack(str[start:end])
00155       self.time_remaining.canon()
00156       return self
00157     except struct.error as e:
00158       raise genpy.DeserializationError(e) #most likely buffer underfill
00159 
00160 
00161   def serialize_numpy(self, buff, numpy):
00162     """
00163     serialize message with numpy array types into buffer
00164     :param buff: buffer, ``StringIO``
00165     :param numpy: numpy python module
00166     """
00167     try:
00168       _x = self
00169       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00170       _x = self.header.frame_id
00171       length = len(_x)
00172       if python3 or type(_x) == unicode:
00173         _x = _x.encode('utf-8')
00174         length = len(_x)
00175       buff.write(struct.pack('<I%ss'%length, length, _x))
00176       _x = self
00177       buff.write(_struct_d2i.pack(_x.power_consumption, _x.time_remaining.secs, _x.time_remaining.nsecs))
00178       _x = self.prediction_method
00179       length = len(_x)
00180       if python3 or type(_x) == unicode:
00181         _x = _x.encode('utf-8')
00182         length = len(_x)
00183       buff.write(struct.pack('<I%ss'%length, length, _x))
00184       _x = self
00185       buff.write(_struct_2b.pack(_x.relative_capacity, _x.AC_present))
00186     except struct.error as se: self._check_types(se)
00187     except TypeError as te: self._check_types(te)
00188 
00189   def deserialize_numpy(self, str, numpy):
00190     """
00191     unpack serialized message in str into this message instance using numpy for array types
00192     :param str: byte array of serialized message, ``str``
00193     :param numpy: numpy python module
00194     """
00195     try:
00196       if self.header is None:
00197         self.header = std_msgs.msg.Header()
00198       if self.time_remaining is None:
00199         self.time_remaining = genpy.Duration()
00200       end = 0
00201       _x = self
00202       start = end
00203       end += 12
00204       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00205       start = end
00206       end += 4
00207       (length,) = _struct_I.unpack(str[start:end])
00208       start = end
00209       end += length
00210       if python3:
00211         self.header.frame_id = str[start:end].decode('utf-8')
00212       else:
00213         self.header.frame_id = str[start:end]
00214       _x = self
00215       start = end
00216       end += 16
00217       (_x.power_consumption, _x.time_remaining.secs, _x.time_remaining.nsecs,) = _struct_d2i.unpack(str[start:end])
00218       start = end
00219       end += 4
00220       (length,) = _struct_I.unpack(str[start:end])
00221       start = end
00222       end += length
00223       if python3:
00224         self.prediction_method = str[start:end].decode('utf-8')
00225       else:
00226         self.prediction_method = str[start:end]
00227       _x = self
00228       start = end
00229       end += 2
00230       (_x.relative_capacity, _x.AC_present,) = _struct_2b.unpack(str[start:end])
00231       self.time_remaining.canon()
00232       return self
00233     except struct.error as e:
00234       raise genpy.DeserializationError(e) #most likely buffer underfill
00235 
00236 _struct_I = genpy.struct_I
00237 _struct_d2i = struct.Struct("<d2i")
00238 _struct_3I = struct.Struct("<3I")
00239 _struct_2b = struct.Struct("<2b")


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