Go to the documentation of this file.00001 """autogenerated by genpy from r2_msgs/PDMCStatus.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 PDMCStatus(genpy.Message):
00009 _md5sum = "a68d9dc9991d8f304fc3adff90114aa5"
00010 _type = "r2_msgs/PDMCStatus"
00011 _has_header = False
00012 _full_text = """string publisher
00013 uint32 registerValue
00014 bool logicEnabled
00015 bool motorEnabled
00016
00017 """
00018 __slots__ = ['publisher','registerValue','logicEnabled','motorEnabled']
00019 _slot_types = ['string','uint32','bool','bool']
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 publisher,registerValue,logicEnabled,motorEnabled
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(PDMCStatus, self).__init__(*args, **kwds)
00037
00038 if self.publisher is None:
00039 self.publisher = ''
00040 if self.registerValue is None:
00041 self.registerValue = 0
00042 if self.logicEnabled is None:
00043 self.logicEnabled = False
00044 if self.motorEnabled is None:
00045 self.motorEnabled = False
00046 else:
00047 self.publisher = ''
00048 self.registerValue = 0
00049 self.logicEnabled = False
00050 self.motorEnabled = False
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.publisher
00065 length = len(_x)
00066 if python3 or type(_x) == unicode:
00067 _x = _x.encode('utf-8')
00068 length = len(_x)
00069 buff.write(struct.pack('<I%ss'%length, length, _x))
00070 _x = self
00071 buff.write(_struct_I2B.pack(_x.registerValue, _x.logicEnabled, _x.motorEnabled))
00072 except struct.error as se: self._check_types(se)
00073 except TypeError as te: self._check_types(te)
00074
00075 def deserialize(self, str):
00076 """
00077 unpack serialized message in str into this message instance
00078 :param str: byte array of serialized message, ``str``
00079 """
00080 try:
00081 end = 0
00082 start = end
00083 end += 4
00084 (length,) = _struct_I.unpack(str[start:end])
00085 start = end
00086 end += length
00087 if python3:
00088 self.publisher = str[start:end].decode('utf-8')
00089 else:
00090 self.publisher = str[start:end]
00091 _x = self
00092 start = end
00093 end += 6
00094 (_x.registerValue, _x.logicEnabled, _x.motorEnabled,) = _struct_I2B.unpack(str[start:end])
00095 self.logicEnabled = bool(self.logicEnabled)
00096 self.motorEnabled = bool(self.motorEnabled)
00097 return self
00098 except struct.error as e:
00099 raise genpy.DeserializationError(e)
00100
00101
00102 def serialize_numpy(self, buff, numpy):
00103 """
00104 serialize message with numpy array types into buffer
00105 :param buff: buffer, ``StringIO``
00106 :param numpy: numpy python module
00107 """
00108 try:
00109 _x = self.publisher
00110 length = len(_x)
00111 if python3 or type(_x) == unicode:
00112 _x = _x.encode('utf-8')
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 _x = self
00116 buff.write(_struct_I2B.pack(_x.registerValue, _x.logicEnabled, _x.motorEnabled))
00117 except struct.error as se: self._check_types(se)
00118 except TypeError as te: self._check_types(te)
00119
00120 def deserialize_numpy(self, str, numpy):
00121 """
00122 unpack serialized message in str into this message instance using numpy for array types
00123 :param str: byte array of serialized message, ``str``
00124 :param numpy: numpy python module
00125 """
00126 try:
00127 end = 0
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.publisher = str[start:end].decode('utf-8')
00135 else:
00136 self.publisher = str[start:end]
00137 _x = self
00138 start = end
00139 end += 6
00140 (_x.registerValue, _x.logicEnabled, _x.motorEnabled,) = _struct_I2B.unpack(str[start:end])
00141 self.logicEnabled = bool(self.logicEnabled)
00142 self.motorEnabled = bool(self.motorEnabled)
00143 return self
00144 except struct.error as e:
00145 raise genpy.DeserializationError(e)
00146
00147 _struct_I = genpy.struct_I
00148 _struct_I2B = struct.Struct("<I2B")