_PowerBoardCommand2.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_power_board/PowerBoardCommand2Request.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 PowerBoardCommand2Request(genpy.Message):
00009   _md5sum = "a31aee1db4294698375ff2a8cf53fea5"
00010   _type = "pr2_power_board/PowerBoardCommand2Request"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int32 NUMBER_OF_CIRCUITS = 3
00013 
00014 
00015 
00016 int32 circuit
00017 
00018 
00019 
00020 int32 BASE      = 0
00021 int32 RIGHT_ARM = 1
00022 int32 LEFT_ARM  = 2
00023 
00024 
00025 
00026 
00027 string command
00028 
00029 
00030 bool reset_stats
00031 
00032 
00033 bool reset_circuits
00034 
00035 """
00036   # Pseudo-constants
00037   NUMBER_OF_CIRCUITS = 3
00038   BASE = 0
00039   RIGHT_ARM = 1
00040   LEFT_ARM = 2
00041 
00042   __slots__ = ['circuit','command','reset_stats','reset_circuits']
00043   _slot_types = ['int32','string','bool','bool']
00044 
00045   def __init__(self, *args, **kwds):
00046     """
00047     Constructor. Any message fields that are implicitly/explicitly
00048     set to None will be assigned a default value. The recommend
00049     use is keyword arguments as this is more robust to future message
00050     changes.  You cannot mix in-order arguments and keyword arguments.
00051 
00052     The available fields are:
00053        circuit,command,reset_stats,reset_circuits
00054 
00055     :param args: complete set of field values, in .msg order
00056     :param kwds: use keyword arguments corresponding to message field names
00057     to set specific fields.
00058     """
00059     if args or kwds:
00060       super(PowerBoardCommand2Request, self).__init__(*args, **kwds)
00061       #message fields cannot be None, assign default values for those that are
00062       if self.circuit is None:
00063         self.circuit = 0
00064       if self.command is None:
00065         self.command = ''
00066       if self.reset_stats is None:
00067         self.reset_stats = False
00068       if self.reset_circuits is None:
00069         self.reset_circuits = False
00070     else:
00071       self.circuit = 0
00072       self.command = ''
00073       self.reset_stats = False
00074       self.reset_circuits = False
00075 
00076   def _get_types(self):
00077     """
00078     internal API method
00079     """
00080     return self._slot_types
00081 
00082   def serialize(self, buff):
00083     """
00084     serialize message into buffer
00085     :param buff: buffer, ``StringIO``
00086     """
00087     try:
00088       buff.write(_struct_i.pack(self.circuit))
00089       _x = self.command
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       _x = self
00096       buff.write(_struct_2B.pack(_x.reset_stats, _x.reset_circuits))
00097     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00098     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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       end = 0
00107       start = end
00108       end += 4
00109       (self.circuit,) = _struct_i.unpack(str[start:end])
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       start = end
00114       end += length
00115       if python3:
00116         self.command = str[start:end].decode('utf-8')
00117       else:
00118         self.command = str[start:end]
00119       _x = self
00120       start = end
00121       end += 2
00122       (_x.reset_stats, _x.reset_circuits,) = _struct_2B.unpack(str[start:end])
00123       self.reset_stats = bool(self.reset_stats)
00124       self.reset_circuits = bool(self.reset_circuits)
00125       return self
00126     except struct.error as e:
00127       raise genpy.DeserializationError(e) #most likely buffer underfill
00128 
00129 
00130   def serialize_numpy(self, buff, numpy):
00131     """
00132     serialize message with numpy array types into buffer
00133     :param buff: buffer, ``StringIO``
00134     :param numpy: numpy python module
00135     """
00136     try:
00137       buff.write(_struct_i.pack(self.circuit))
00138       _x = self.command
00139       length = len(_x)
00140       if python3 or type(_x) == unicode:
00141         _x = _x.encode('utf-8')
00142         length = len(_x)
00143       buff.write(struct.pack('<I%ss'%length, length, _x))
00144       _x = self
00145       buff.write(_struct_2B.pack(_x.reset_stats, _x.reset_circuits))
00146     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148 
00149   def deserialize_numpy(self, str, numpy):
00150     """
00151     unpack serialized message in str into this message instance using numpy for array types
00152     :param str: byte array of serialized message, ``str``
00153     :param numpy: numpy python module
00154     """
00155     try:
00156       end = 0
00157       start = end
00158       end += 4
00159       (self.circuit,) = _struct_i.unpack(str[start:end])
00160       start = end
00161       end += 4
00162       (length,) = _struct_I.unpack(str[start:end])
00163       start = end
00164       end += length
00165       if python3:
00166         self.command = str[start:end].decode('utf-8')
00167       else:
00168         self.command = str[start:end]
00169       _x = self
00170       start = end
00171       end += 2
00172       (_x.reset_stats, _x.reset_circuits,) = _struct_2B.unpack(str[start:end])
00173       self.reset_stats = bool(self.reset_stats)
00174       self.reset_circuits = bool(self.reset_circuits)
00175       return self
00176     except struct.error as e:
00177       raise genpy.DeserializationError(e) #most likely buffer underfill
00178 
00179 _struct_I = genpy.struct_I
00180 _struct_i = struct.Struct("<i")
00181 _struct_2B = struct.Struct("<2B")
00182 """autogenerated by genpy from pr2_power_board/PowerBoardCommand2Response.msg. Do not edit."""
00183 import sys
00184 python3 = True if sys.hexversion > 0x03000000 else False
00185 import genpy
00186 import struct
00187 
00188 
00189 class PowerBoardCommand2Response(genpy.Message):
00190   _md5sum = "358e233cde0c8a8bcfea4ce193f8fc15"
00191   _type = "pr2_power_board/PowerBoardCommand2Response"
00192   _has_header = False #flag to mark the presence of a Header object
00193   _full_text = """
00194 bool success
00195 
00196 
00197 """
00198   __slots__ = ['success']
00199   _slot_types = ['bool']
00200 
00201   def __init__(self, *args, **kwds):
00202     """
00203     Constructor. Any message fields that are implicitly/explicitly
00204     set to None will be assigned a default value. The recommend
00205     use is keyword arguments as this is more robust to future message
00206     changes.  You cannot mix in-order arguments and keyword arguments.
00207 
00208     The available fields are:
00209        success
00210 
00211     :param args: complete set of field values, in .msg order
00212     :param kwds: use keyword arguments corresponding to message field names
00213     to set specific fields.
00214     """
00215     if args or kwds:
00216       super(PowerBoardCommand2Response, self).__init__(*args, **kwds)
00217       #message fields cannot be None, assign default values for those that are
00218       if self.success is None:
00219         self.success = False
00220     else:
00221       self.success = False
00222 
00223   def _get_types(self):
00224     """
00225     internal API method
00226     """
00227     return self._slot_types
00228 
00229   def serialize(self, buff):
00230     """
00231     serialize message into buffer
00232     :param buff: buffer, ``StringIO``
00233     """
00234     try:
00235       buff.write(_struct_B.pack(self.success))
00236     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00237     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00238 
00239   def deserialize(self, str):
00240     """
00241     unpack serialized message in str into this message instance
00242     :param str: byte array of serialized message, ``str``
00243     """
00244     try:
00245       end = 0
00246       start = end
00247       end += 1
00248       (self.success,) = _struct_B.unpack(str[start:end])
00249       self.success = bool(self.success)
00250       return self
00251     except struct.error as e:
00252       raise genpy.DeserializationError(e) #most likely buffer underfill
00253 
00254 
00255   def serialize_numpy(self, buff, numpy):
00256     """
00257     serialize message with numpy array types into buffer
00258     :param buff: buffer, ``StringIO``
00259     :param numpy: numpy python module
00260     """
00261     try:
00262       buff.write(_struct_B.pack(self.success))
00263     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00264     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00265 
00266   def deserialize_numpy(self, str, numpy):
00267     """
00268     unpack serialized message in str into this message instance using numpy for array types
00269     :param str: byte array of serialized message, ``str``
00270     :param numpy: numpy python module
00271     """
00272     try:
00273       end = 0
00274       start = end
00275       end += 1
00276       (self.success,) = _struct_B.unpack(str[start:end])
00277       self.success = bool(self.success)
00278       return self
00279     except struct.error as e:
00280       raise genpy.DeserializationError(e) #most likely buffer underfill
00281 
00282 _struct_I = genpy.struct_I
00283 _struct_B = struct.Struct("<B")
00284 class PowerBoardCommand2(object):
00285   _type          = 'pr2_power_board/PowerBoardCommand2'
00286   _md5sum = '4f143c27e05688798e6220ba69c6906a'
00287   _request_class  = PowerBoardCommand2Request
00288   _response_class = PowerBoardCommand2Response


pr2_power_board
Author(s): Curt Meyers, Blaise Gassend
autogenerated on Tue Apr 22 2014 19:34:59