00001 """autogenerated by genpy from metralabs_msgs/SchunkStatus.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 metralabs_msgs.msg
00008
00009 class SchunkStatus(genpy.Message):
00010 _md5sum = "25e674653eb5fea7e752f17898cdeecd"
00011 _type = "metralabs_msgs/SchunkStatus"
00012 _has_header = False
00013 _full_text = """SchunkJointStatus[] joints
00014
00015 ================================================================================
00016 MSG: metralabs_msgs/SchunkJointStatus
00017 string jointName
00018 float32 current
00019 uint8 errorCode
00020 bool referenced
00021 bool moving
00022 bool progMode
00023 bool warning
00024 bool error
00025 bool brake
00026 bool moveEnd
00027 bool posReached
00028
00029 """
00030 __slots__ = ['joints']
00031 _slot_types = ['metralabs_msgs/SchunkJointStatus[]']
00032
00033 def __init__(self, *args, **kwds):
00034 """
00035 Constructor. Any message fields that are implicitly/explicitly
00036 set to None will be assigned a default value. The recommend
00037 use is keyword arguments as this is more robust to future message
00038 changes. You cannot mix in-order arguments and keyword arguments.
00039
00040 The available fields are:
00041 joints
00042
00043 :param args: complete set of field values, in .msg order
00044 :param kwds: use keyword arguments corresponding to message field names
00045 to set specific fields.
00046 """
00047 if args or kwds:
00048 super(SchunkStatus, self).__init__(*args, **kwds)
00049
00050 if self.joints is None:
00051 self.joints = []
00052 else:
00053 self.joints = []
00054
00055 def _get_types(self):
00056 """
00057 internal API method
00058 """
00059 return self._slot_types
00060
00061 def serialize(self, buff):
00062 """
00063 serialize message into buffer
00064 :param buff: buffer, ``StringIO``
00065 """
00066 try:
00067 length = len(self.joints)
00068 buff.write(_struct_I.pack(length))
00069 for val1 in self.joints:
00070 _x = val1.jointName
00071 length = len(_x)
00072 if python3 or type(_x) == unicode:
00073 _x = _x.encode('utf-8')
00074 length = len(_x)
00075 buff.write(struct.pack('<I%ss'%length, length, _x))
00076 _x = val1
00077 buff.write(_struct_f9B.pack(_x.current, _x.errorCode, _x.referenced, _x.moving, _x.progMode, _x.warning, _x.error, _x.brake, _x.moveEnd, _x.posReached))
00078 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00079 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00080
00081 def deserialize(self, str):
00082 """
00083 unpack serialized message in str into this message instance
00084 :param str: byte array of serialized message, ``str``
00085 """
00086 try:
00087 if self.joints is None:
00088 self.joints = None
00089 end = 0
00090 start = end
00091 end += 4
00092 (length,) = _struct_I.unpack(str[start:end])
00093 self.joints = []
00094 for i in range(0, length):
00095 val1 = metralabs_msgs.msg.SchunkJointStatus()
00096 start = end
00097 end += 4
00098 (length,) = _struct_I.unpack(str[start:end])
00099 start = end
00100 end += length
00101 if python3:
00102 val1.jointName = str[start:end].decode('utf-8')
00103 else:
00104 val1.jointName = str[start:end]
00105 _x = val1
00106 start = end
00107 end += 13
00108 (_x.current, _x.errorCode, _x.referenced, _x.moving, _x.progMode, _x.warning, _x.error, _x.brake, _x.moveEnd, _x.posReached,) = _struct_f9B.unpack(str[start:end])
00109 val1.referenced = bool(val1.referenced)
00110 val1.moving = bool(val1.moving)
00111 val1.progMode = bool(val1.progMode)
00112 val1.warning = bool(val1.warning)
00113 val1.error = bool(val1.error)
00114 val1.brake = bool(val1.brake)
00115 val1.moveEnd = bool(val1.moveEnd)
00116 val1.posReached = bool(val1.posReached)
00117 self.joints.append(val1)
00118 return self
00119 except struct.error as e:
00120 raise genpy.DeserializationError(e)
00121
00122
00123 def serialize_numpy(self, buff, numpy):
00124 """
00125 serialize message with numpy array types into buffer
00126 :param buff: buffer, ``StringIO``
00127 :param numpy: numpy python module
00128 """
00129 try:
00130 length = len(self.joints)
00131 buff.write(_struct_I.pack(length))
00132 for val1 in self.joints:
00133 _x = val1.jointName
00134 length = len(_x)
00135 if python3 or type(_x) == unicode:
00136 _x = _x.encode('utf-8')
00137 length = len(_x)
00138 buff.write(struct.pack('<I%ss'%length, length, _x))
00139 _x = val1
00140 buff.write(_struct_f9B.pack(_x.current, _x.errorCode, _x.referenced, _x.moving, _x.progMode, _x.warning, _x.error, _x.brake, _x.moveEnd, _x.posReached))
00141 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00142 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00143
00144 def deserialize_numpy(self, str, numpy):
00145 """
00146 unpack serialized message in str into this message instance using numpy for array types
00147 :param str: byte array of serialized message, ``str``
00148 :param numpy: numpy python module
00149 """
00150 try:
00151 if self.joints is None:
00152 self.joints = None
00153 end = 0
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 self.joints = []
00158 for i in range(0, length):
00159 val1 = metralabs_msgs.msg.SchunkJointStatus()
00160 start = end
00161 end += 4
00162 (length,) = _struct_I.unpack(str[start:end])
00163 start = end
00164 end += length
00165 if python3:
00166 val1.jointName = str[start:end].decode('utf-8')
00167 else:
00168 val1.jointName = str[start:end]
00169 _x = val1
00170 start = end
00171 end += 13
00172 (_x.current, _x.errorCode, _x.referenced, _x.moving, _x.progMode, _x.warning, _x.error, _x.brake, _x.moveEnd, _x.posReached,) = _struct_f9B.unpack(str[start:end])
00173 val1.referenced = bool(val1.referenced)
00174 val1.moving = bool(val1.moving)
00175 val1.progMode = bool(val1.progMode)
00176 val1.warning = bool(val1.warning)
00177 val1.error = bool(val1.error)
00178 val1.brake = bool(val1.brake)
00179 val1.moveEnd = bool(val1.moveEnd)
00180 val1.posReached = bool(val1.posReached)
00181 self.joints.append(val1)
00182 return self
00183 except struct.error as e:
00184 raise genpy.DeserializationError(e)
00185
00186 _struct_I = genpy.struct_I
00187 _struct_f9B = struct.Struct("<f9B")