_PlugCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_gazebo_plugins/PlugCommand.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 PlugCommand(genpy.Message):
00009   _md5sum = "852b7035ee3e7fa6390824cf7b7e6dd1"
00010   _type = "pr2_gazebo_plugins/PlugCommand"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """bool ac_present
00013 float64 charge_rate
00014 float64 discharge_rate
00015 float64 charge
00016 
00017 """
00018   __slots__ = ['ac_present','charge_rate','discharge_rate','charge']
00019   _slot_types = ['bool','float64','float64','float64']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        ac_present,charge_rate,discharge_rate,charge
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(PlugCommand, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.ac_present is None:
00039         self.ac_present = False
00040       if self.charge_rate is None:
00041         self.charge_rate = 0.
00042       if self.discharge_rate is None:
00043         self.discharge_rate = 0.
00044       if self.charge is None:
00045         self.charge = 0.
00046     else:
00047       self.ac_present = False
00048       self.charge_rate = 0.
00049       self.discharge_rate = 0.
00050       self.charge = 0.
00051 
00052   def _get_types(self):
00053     """
00054     internal API method
00055     """
00056     return self._slot_types
00057 
00058   def serialize(self, buff):
00059     """
00060     serialize message into buffer
00061     :param buff: buffer, ``StringIO``
00062     """
00063     try:
00064       _x = self
00065       buff.write(_struct_B3d.pack(_x.ac_present, _x.charge_rate, _x.discharge_rate, _x.charge))
00066     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00067     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00068 
00069   def deserialize(self, str):
00070     """
00071     unpack serialized message in str into this message instance
00072     :param str: byte array of serialized message, ``str``
00073     """
00074     try:
00075       end = 0
00076       _x = self
00077       start = end
00078       end += 25
00079       (_x.ac_present, _x.charge_rate, _x.discharge_rate, _x.charge,) = _struct_B3d.unpack(str[start:end])
00080       self.ac_present = bool(self.ac_present)
00081       return self
00082     except struct.error as e:
00083       raise genpy.DeserializationError(e) #most likely buffer underfill
00084 
00085 
00086   def serialize_numpy(self, buff, numpy):
00087     """
00088     serialize message with numpy array types into buffer
00089     :param buff: buffer, ``StringIO``
00090     :param numpy: numpy python module
00091     """
00092     try:
00093       _x = self
00094       buff.write(_struct_B3d.pack(_x.ac_present, _x.charge_rate, _x.discharge_rate, _x.charge))
00095     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00096     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00097 
00098   def deserialize_numpy(self, str, numpy):
00099     """
00100     unpack serialized message in str into this message instance using numpy for array types
00101     :param str: byte array of serialized message, ``str``
00102     :param numpy: numpy python module
00103     """
00104     try:
00105       end = 0
00106       _x = self
00107       start = end
00108       end += 25
00109       (_x.ac_present, _x.charge_rate, _x.discharge_rate, _x.charge,) = _struct_B3d.unpack(str[start:end])
00110       self.ac_present = bool(self.ac_present)
00111       return self
00112     except struct.error as e:
00113       raise genpy.DeserializationError(e) #most likely buffer underfill
00114 
00115 _struct_I = genpy.struct_I
00116 _struct_B3d = struct.Struct("<B3d")


pr2_gazebo_plugins
Author(s): Sachin Chitta, Stu Glaser, John Hsu
autogenerated on Thu Apr 24 2014 15:47:43