_PowerBoardCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_power_board/PowerBoardCommandRequest.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 PowerBoardCommandRequest(genpy.Message):
00009   _md5sum = "9c621f5309bca0033e8eaef81c31500a"
00010   _type = "pr2_power_board/PowerBoardCommandRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """uint32 serial_number
00013 int32 breaker_number
00014 string command
00015 uint32 flags
00016 
00017 """
00018   __slots__ = ['serial_number','breaker_number','command','flags']
00019   _slot_types = ['uint32','int32','string','uint32']
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        serial_number,breaker_number,command,flags
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(PowerBoardCommandRequest, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.serial_number is None:
00039         self.serial_number = 0
00040       if self.breaker_number is None:
00041         self.breaker_number = 0
00042       if self.command is None:
00043         self.command = ''
00044       if self.flags is None:
00045         self.flags = 0
00046     else:
00047       self.serial_number = 0
00048       self.breaker_number = 0
00049       self.command = ''
00050       self.flags = 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_Ii.pack(_x.serial_number, _x.breaker_number))
00066       _x = self.command
00067       length = len(_x)
00068       if python3 or type(_x) == unicode:
00069         _x = _x.encode('utf-8')
00070         length = len(_x)
00071       buff.write(struct.pack('<I%ss'%length, length, _x))
00072       buff.write(_struct_I.pack(self.flags))
00073     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00074     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00075 
00076   def deserialize(self, str):
00077     """
00078     unpack serialized message in str into this message instance
00079     :param str: byte array of serialized message, ``str``
00080     """
00081     try:
00082       end = 0
00083       _x = self
00084       start = end
00085       end += 8
00086       (_x.serial_number, _x.breaker_number,) = _struct_Ii.unpack(str[start:end])
00087       start = end
00088       end += 4
00089       (length,) = _struct_I.unpack(str[start:end])
00090       start = end
00091       end += length
00092       if python3:
00093         self.command = str[start:end].decode('utf-8')
00094       else:
00095         self.command = str[start:end]
00096       start = end
00097       end += 4
00098       (self.flags,) = _struct_I.unpack(str[start:end])
00099       return self
00100     except struct.error as e:
00101       raise genpy.DeserializationError(e) #most likely buffer underfill
00102 
00103 
00104   def serialize_numpy(self, buff, numpy):
00105     """
00106     serialize message with numpy array types into buffer
00107     :param buff: buffer, ``StringIO``
00108     :param numpy: numpy python module
00109     """
00110     try:
00111       _x = self
00112       buff.write(_struct_Ii.pack(_x.serial_number, _x.breaker_number))
00113       _x = self.command
00114       length = len(_x)
00115       if python3 or type(_x) == unicode:
00116         _x = _x.encode('utf-8')
00117         length = len(_x)
00118       buff.write(struct.pack('<I%ss'%length, length, _x))
00119       buff.write(_struct_I.pack(self.flags))
00120     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00121     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00122 
00123   def deserialize_numpy(self, str, numpy):
00124     """
00125     unpack serialized message in str into this message instance using numpy for array types
00126     :param str: byte array of serialized message, ``str``
00127     :param numpy: numpy python module
00128     """
00129     try:
00130       end = 0
00131       _x = self
00132       start = end
00133       end += 8
00134       (_x.serial_number, _x.breaker_number,) = _struct_Ii.unpack(str[start:end])
00135       start = end
00136       end += 4
00137       (length,) = _struct_I.unpack(str[start:end])
00138       start = end
00139       end += length
00140       if python3:
00141         self.command = str[start:end].decode('utf-8')
00142       else:
00143         self.command = str[start:end]
00144       start = end
00145       end += 4
00146       (self.flags,) = _struct_I.unpack(str[start:end])
00147       return self
00148     except struct.error as e:
00149       raise genpy.DeserializationError(e) #most likely buffer underfill
00150 
00151 _struct_I = genpy.struct_I
00152 _struct_Ii = struct.Struct("<Ii")
00153 """autogenerated by genpy from pr2_power_board/PowerBoardCommandResponse.msg. Do not edit."""
00154 import sys
00155 python3 = True if sys.hexversion > 0x03000000 else False
00156 import genpy
00157 import struct
00158 
00159 
00160 class PowerBoardCommandResponse(genpy.Message):
00161   _md5sum = "f5697a1e05c2a3e1c23cab49a31319ec"
00162   _type = "pr2_power_board/PowerBoardCommandResponse"
00163   _has_header = False #flag to mark the presence of a Header object
00164   _full_text = """int32 retval
00165 
00166 
00167 """
00168   __slots__ = ['retval']
00169   _slot_types = ['int32']
00170 
00171   def __init__(self, *args, **kwds):
00172     """
00173     Constructor. Any message fields that are implicitly/explicitly
00174     set to None will be assigned a default value. The recommend
00175     use is keyword arguments as this is more robust to future message
00176     changes.  You cannot mix in-order arguments and keyword arguments.
00177 
00178     The available fields are:
00179        retval
00180 
00181     :param args: complete set of field values, in .msg order
00182     :param kwds: use keyword arguments corresponding to message field names
00183     to set specific fields.
00184     """
00185     if args or kwds:
00186       super(PowerBoardCommandResponse, self).__init__(*args, **kwds)
00187       #message fields cannot be None, assign default values for those that are
00188       if self.retval is None:
00189         self.retval = 0
00190     else:
00191       self.retval = 0
00192 
00193   def _get_types(self):
00194     """
00195     internal API method
00196     """
00197     return self._slot_types
00198 
00199   def serialize(self, buff):
00200     """
00201     serialize message into buffer
00202     :param buff: buffer, ``StringIO``
00203     """
00204     try:
00205       buff.write(_struct_i.pack(self.retval))
00206     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00207     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00208 
00209   def deserialize(self, str):
00210     """
00211     unpack serialized message in str into this message instance
00212     :param str: byte array of serialized message, ``str``
00213     """
00214     try:
00215       end = 0
00216       start = end
00217       end += 4
00218       (self.retval,) = _struct_i.unpack(str[start:end])
00219       return self
00220     except struct.error as e:
00221       raise genpy.DeserializationError(e) #most likely buffer underfill
00222 
00223 
00224   def serialize_numpy(self, buff, numpy):
00225     """
00226     serialize message with numpy array types into buffer
00227     :param buff: buffer, ``StringIO``
00228     :param numpy: numpy python module
00229     """
00230     try:
00231       buff.write(_struct_i.pack(self.retval))
00232     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00233     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00234 
00235   def deserialize_numpy(self, str, numpy):
00236     """
00237     unpack serialized message in str into this message instance using numpy for array types
00238     :param str: byte array of serialized message, ``str``
00239     :param numpy: numpy python module
00240     """
00241     try:
00242       end = 0
00243       start = end
00244       end += 4
00245       (self.retval,) = _struct_i.unpack(str[start:end])
00246       return self
00247     except struct.error as e:
00248       raise genpy.DeserializationError(e) #most likely buffer underfill
00249 
00250 _struct_I = genpy.struct_I
00251 _struct_i = struct.Struct("<i")
00252 class PowerBoardCommand(object):
00253   _type          = 'pr2_power_board/PowerBoardCommand'
00254   _md5sum = 'd9e38de783aa7edc3146446518e85af2'
00255   _request_class  = PowerBoardCommandRequest
00256   _response_class = PowerBoardCommandResponse


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