$search
00001 """autogenerated by genmsg_py from joints_data.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import sr_robot_msgs.msg 00006 00007 class joints_data(roslib.message.Message): 00008 _md5sum = "a7bd94657f253c468247048a545e88e5" 00009 _type = "sr_robot_msgs/joints_data" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """int8 joints_list_length 00012 joint[] joints_list 00013 00014 ================================================================================ 00015 MSG: sr_robot_msgs/joint 00016 string joint_name 00017 float64 joint_position 00018 float64 joint_target 00019 float64 joint_torque 00020 float64 joint_temperature 00021 float64 joint_current 00022 string error_flag 00023 00024 """ 00025 __slots__ = ['joints_list_length','joints_list'] 00026 _slot_types = ['int8','sr_robot_msgs/joint[]'] 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 joints_list_length,joints_list 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(joints_data, self).__init__(*args, **kwds) 00044 #message fields cannot be None, assign default values for those that are 00045 if self.joints_list_length is None: 00046 self.joints_list_length = 0 00047 if self.joints_list is None: 00048 self.joints_list = [] 00049 else: 00050 self.joints_list_length = 0 00051 self.joints_list = [] 00052 00053 def _get_types(self): 00054 """ 00055 internal API method 00056 """ 00057 return self._slot_types 00058 00059 def serialize(self, buff): 00060 """ 00061 serialize message into buffer 00062 @param buff: buffer 00063 @type buff: StringIO 00064 """ 00065 try: 00066 buff.write(_struct_b.pack(self.joints_list_length)) 00067 length = len(self.joints_list) 00068 buff.write(_struct_I.pack(length)) 00069 for val1 in self.joints_list: 00070 _x = val1.joint_name 00071 length = len(_x) 00072 buff.write(struct.pack('<I%ss'%length, length, _x)) 00073 _x = val1 00074 buff.write(_struct_5d.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current)) 00075 _x = val1.error_flag 00076 length = len(_x) 00077 buff.write(struct.pack('<I%ss'%length, length, _x)) 00078 except struct.error as se: self._check_types(se) 00079 except TypeError as te: self._check_types(te) 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 00085 @type str: str 00086 """ 00087 try: 00088 end = 0 00089 start = end 00090 end += 1 00091 (self.joints_list_length,) = _struct_b.unpack(str[start:end]) 00092 start = end 00093 end += 4 00094 (length,) = _struct_I.unpack(str[start:end]) 00095 self.joints_list = [] 00096 for i in range(0, length): 00097 val1 = sr_robot_msgs.msg.joint() 00098 start = end 00099 end += 4 00100 (length,) = _struct_I.unpack(str[start:end]) 00101 start = end 00102 end += length 00103 val1.joint_name = str[start:end] 00104 _x = val1 00105 start = end 00106 end += 40 00107 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5d.unpack(str[start:end]) 00108 start = end 00109 end += 4 00110 (length,) = _struct_I.unpack(str[start:end]) 00111 start = end 00112 end += length 00113 val1.error_flag = str[start:end] 00114 self.joints_list.append(val1) 00115 return self 00116 except struct.error as e: 00117 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00118 00119 00120 def serialize_numpy(self, buff, numpy): 00121 """ 00122 serialize message with numpy array types into buffer 00123 @param buff: buffer 00124 @type buff: StringIO 00125 @param numpy: numpy python module 00126 @type numpy module 00127 """ 00128 try: 00129 buff.write(_struct_b.pack(self.joints_list_length)) 00130 length = len(self.joints_list) 00131 buff.write(_struct_I.pack(length)) 00132 for val1 in self.joints_list: 00133 _x = val1.joint_name 00134 length = len(_x) 00135 buff.write(struct.pack('<I%ss'%length, length, _x)) 00136 _x = val1 00137 buff.write(_struct_5d.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current)) 00138 _x = val1.error_flag 00139 length = len(_x) 00140 buff.write(struct.pack('<I%ss'%length, length, _x)) 00141 except struct.error as se: self._check_types(se) 00142 except TypeError as te: self._check_types(te) 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 00148 @type str: str 00149 @param numpy: numpy python module 00150 @type numpy: module 00151 """ 00152 try: 00153 end = 0 00154 start = end 00155 end += 1 00156 (self.joints_list_length,) = _struct_b.unpack(str[start:end]) 00157 start = end 00158 end += 4 00159 (length,) = _struct_I.unpack(str[start:end]) 00160 self.joints_list = [] 00161 for i in range(0, length): 00162 val1 = sr_robot_msgs.msg.joint() 00163 start = end 00164 end += 4 00165 (length,) = _struct_I.unpack(str[start:end]) 00166 start = end 00167 end += length 00168 val1.joint_name = str[start:end] 00169 _x = val1 00170 start = end 00171 end += 40 00172 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5d.unpack(str[start:end]) 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 start = end 00177 end += length 00178 val1.error_flag = str[start:end] 00179 self.joints_list.append(val1) 00180 return self 00181 except struct.error as e: 00182 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00183 00184 _struct_I = roslib.message.struct_I 00185 _struct_5d = struct.Struct("<5d") 00186 _struct_b = struct.Struct("<b")