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