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