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