@@ -22,20 +22,18 @@ def __init__(self, hand_type="left", hand_joint="L10", modbus = "None",can="can0
2222 if self .hand_type == "right" :
2323 self .hand_id = 0x27 # Right hand
2424 if self .hand_joint .upper () == "O6" or self .hand_joint == "L6" or self .hand_joint == "L6P" :
25- from .core .can .linker_hand_o6_can import LinkerHandO6Can
26- self .hand = LinkerHandO6Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
25+ if modbus != "None" :
26+ from core .rs485 .linker_hand_o6_rs485 import LinkerHandO6RS485
27+ self .hand = LinkerHandO6RS485 (hand_id = self .hand_id ,modbus_port = modbus ,baudrate = 115200 )
28+ else :
29+ from core .can .linker_hand_o6_can import LinkerHandO6Can
30+ self .hand = LinkerHandO6Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
2731 if self .hand_joint == "L7" :
2832 from core .can .linker_hand_l7_can import LinkerHandL7Can
2933 self .hand = LinkerHandL7Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
3034 if self .hand_joint == "L10" :
31- #if self.config['LINKER_HAND']['LEFT_HAND']['MODBUS'] == "RML":
32- if modbus == "RML" : # RML API2 485 protocol
33- from core .rml485 .linker_hand_l10_485 import LinkerHandL10For485
34- self .hand = LinkerHandL10For485 ()
35-
36- else : # Default CAN protocol
37- from core .can .linker_hand_l10_can import LinkerHandL10Can
38- self .hand = LinkerHandL10Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
35+ from core .can .linker_hand_l10_can import LinkerHandL10Can
36+ self .hand = LinkerHandL10Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
3937 if self .hand_joint == "L20" :
4038 from core .can .linker_hand_l20_can import LinkerHandL20Can
4139 self .hand = LinkerHandL20Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
@@ -46,7 +44,7 @@ def __init__(self, hand_type="left", hand_joint="L10", modbus = "None",can="can0
4644 from core .can .linker_hand_l25_can import LinkerHandL25Can
4745 self .hand = LinkerHandL25Can (can_id = self .hand_id ,can_channel = self .can , yaml = self .yaml )
4846 # Open can0
49- if sys .platform == "linux" :
47+ if sys .platform == "linux" and modbus == "None" :
5048 self .open_can = OpenCan (load_yaml = self .yaml )
5149 self .open_can .open_can (self .can )
5250 self .is_can = self .open_can .is_can_up_sysfs (interface = self .can )
0 commit comments