@@ -71,7 +71,7 @@ def finger_move(self, pose=[]):
7171 if any (not isinstance (x , (int , float )) or x < 0 or x > 255 for x in pose ):
7272 ColorMsg (msg = f"The numerical range cannot be less than 0 or greater than 255" ,color = "red" )
7373 return
74- if self .hand_joint == "O6" and len (pose ) == 6 :
74+ if ( self .hand_joint . upper () == "O6" or self . hand_joint . upper () == "L6" ) and len (pose ) == 6 :
7575 self .hand .set_joint_positions (pose )
7676 elif self .hand_joint == "L7" and len (pose ) == 7 :
7777 self .hand .set_joint_positions (pose )
@@ -139,6 +139,9 @@ def set_torque(self, torque=[180] * 5):
139139 if self .hand_joint == "L7" and len (torque ) < 7 :
140140 print ("数据长度不够,至少7个元素" , flush = True )
141141 return
142+ if (self .hand_joint == "L6" or self .hand_joint == "O6" ) and len (torque ) != 6 :
143+ print ("L6 or O6数据长度错误,至少6个元素" , flush = True )
144+ return
142145 ColorMsg (msg = f"{ self .hand_type } { self .hand_joint } set maximum torque to { torque } " , color = "green" )
143146 return self .hand .set_torque (torque = torque )
144147
@@ -174,7 +177,7 @@ def get_speed(self):
174177
175178 def get_joint_speed (self ):
176179 speed = []
177- if self .hand_joint .upper () == "O6" :
180+ if self .hand_joint .upper () == "O6" or self . hand_joint . upper () == "L6" :
178181 return self .hand .get_speed ()
179182 elif self .hand_joint == "L7" :
180183 return self .hand .get_speed ()
@@ -269,4 +272,4 @@ def close_can(self):
269272 self .open_can .close_can0 ()
270273
271274if __name__ == "__main__" :
272- hand = LinkerHandApi (hand_type = "right" , hand_joint = "L10" )
275+ hand = LinkerHandApi (hand_type = "right" , hand_joint = "L10" )
0 commit comments