Skip to content

Commit f0efea9

Browse files
committed
新增O6支持USB-RS485模块
新增O6支持USB-RS485模块
1 parent b21a81d commit f0efea9

17 files changed

+412
-21
lines changed
-16 Bytes
Binary file not shown.
1.66 KB
Binary file not shown.

LinkerHand/config/setting.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
VERSION: 2.1.9 # 修复撞帧
22
LINKER_HAND: # 手部配置信息
33
LEFT_HAND:
4-
EXISTS: False # 是否存在左手
5-
TOUCH: True # 是否有压力传感器
6-
MODBUS: "None" # 通讯协议是否为485 默认None 当前支持RML(睿尔曼API2)
7-
JOINT: L10 # 左手关节数 O6/L6/L7/L10/L20/L21/L25/
4+
EXISTS: True # 是否存在左手
5+
TOUCH: False # 是否有压力传感器
6+
MODBUS: "/dev/ttyUSB0" # 通讯协议是否为485 默认None 如果启动485,则是设备端口 /dev/ttyUSB*
7+
JOINT: O6 # 左手关节数 O6/L6/L7/L10/L20/L21/L25/
88
NAME: # 无论l10还是l20 joint name都是20个
99
- joint41
1010
- joint42
-23 Bytes
Binary file not shown.
Binary file not shown.

LinkerHand/core/rs485/linker_hand_o6_rs485.py

Lines changed: 382 additions & 0 deletions
Large diffs are not rendered by default.

LinkerHand/linker_hand_api.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
-23 Bytes
Binary file not shown.
-23 Bytes
Binary file not shown.
-23 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)