Skip to content

Commit b3b763b

Browse files
committed
修改已知BUG
1 parent 2212e24 commit b3b763b

11 files changed

+33
-760
lines changed
Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +0,0 @@
1-
LEFT_HAND:
2-
- ACTION_NAME: 张开
3-
POSITION:
4-
- 96
5-
- 255
6-
- 255
7-
- 255
8-
- 255
9-
- 150
10-
- 114
11-
- 151
12-
- 189
13-
- 255
14-
- 180
15-
- 255
16-
- 255
17-
- 255
18-
- 255
19-
- 255
20-
- 255
21-
- 255
22-
- 255
23-
- 255
24-
25-
RIGHT_HAND:
26-
- ACTION_NAME: 张开
27-
POSITION:
28-
- 96
29-
- 255
30-
- 255
31-
- 255
32-
- 255
33-
- 150
34-
- 114
35-
- 151
36-
- 189
37-
- 255
38-
- 180
39-
- 255
40-
- 255
41-
- 255
42-
- 255
43-
- 255
44-
- 255
45-
- 255
46-
- 255
47-
- 255
48-
49-
- ACTION_NAME: 握拳
50-
POSITION:
51-
- 230
52-
- 80
53-
- 51
54-
- 42
55-
- 7
56-
- 35
57-
- 114
58-
- 151
59-
- 189
60-
- 255
61-
- 58
62-
- 255
63-
- 255
64-
- 255
65-
- 255
66-
- 133
67-
- 5
68-
- 0
69-
- 0
70-
- 0
71-

LinkerHand/config/setting.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION: 2.1.4 # 支持新传感器
1+
VERSION: 2.1.7 # 支持新传感器
22
LINKER_HAND: # 手部配置信息
33
LEFT_HAND:
44
EXISTS: False # 是否存在左手
196 Bytes
Binary file not shown.

LinkerHand/core/can/linker_hand_l10_can.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def init_can_bus(self, channel, baudrate):
7373
if sys.platform == "linux":
7474
return can.interface.Bus(channel=channel, interface="socketcan", bitrate=baudrate)
7575
elif sys.platform == "win32":
76-
return can.interface.Bus(channel='PCAN_USBBUS1', interface='pcan', bitrate=baudrate)
76+
return can.interface.Bus(channel=channel, interface='pcan', bitrate=baudrate)
7777
else:
7878
raise EnvironmentError("Unsupported platform for CAN interface")
7979

@@ -256,9 +256,13 @@ def get_version(self):
256256
return self.version
257257
def get_current_status(self):
258258
'''Get current joint status'''
259-
# self.send_frame(0x01,[],sleep=0.005)
260-
# self.send_frame(0x04,[],sleep=0.005)
261-
return self.x01 + self.x04
259+
state = self.x01 + self.x04
260+
if len(state) < 10:
261+
self.send_frame(0x01,[],sleep=0.005)
262+
self.send_frame(0x04,[],sleep=0.005)
263+
time.sleep(0.001)
264+
state = self.x01 + self.x04
265+
return state
262266
def get_speed(self):
263267
'''Get current speed'''
264268
# self.send_frame(0x05,[],sleep=0.005)
@@ -308,6 +312,7 @@ def get_torque(self):
308312
self.send_frame(0x02, [])
309313
time.sleep(0.002)
310314
self.send_frame(0x03,[])
315+
time.sleep(0.002)
311316
#self.set_max_torque_limits(pressures=[0.0], type="get")
312317
#time.sleep(0.001)
313318
return self.x02+self.x03
@@ -316,9 +321,16 @@ def get_fault(self):
316321
'''Get motor fault'''
317322
self.get_motor_fault_code()
318323
return self.x35+self.x36
324+
319325
def get_current(self):
320326
'''Get current'''
321-
return [None]*10
327+
self.send_frame(0x02, [])
328+
time.sleep(0.002)
329+
self.send_frame(0x03,[])
330+
#self.set_max_torque_limits(pressures=[0.0], type="get")
331+
#time.sleep(0.001)
332+
return self.x02+self.x03
333+
322334
def close_can_interface(self):
323335
"""Stop the CAN communication."""
324336
self.running = False

LinkerHand/core/can/linker_hand_l20_can.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, can_channel='can0', baudrate=1000000, can_id=0x28):
6565
)
6666
elif sys.platform == "win32":
6767
self.bus = can.interface.Bus(
68-
channel='PCAN_USBBUS1', interface='pcan', bitrate=baudrate,
68+
channel=can_channel, interface='pcan', bitrate=baudrate,
6969
can_filters=[{"can_id": can_id, "can_mask": 0x7FF}]
7070
)
7171
else:

LinkerHand/core/can/linker_hand_l21_can.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(self, can_channel='can0', baudrate=1000000, can_id=0x28):
152152
)
153153
elif sys.platform == "win32":
154154
self.bus = can.interface.Bus(
155-
channel='PCAN_USBBUS1', interface='pcan', bitrate=baudrate,
155+
channel=can_channel, interface='pcan', bitrate=baudrate,
156156
can_filters=[{"can_id": can_id, "can_mask": 0x7FF}]
157157
)
158158
else:

LinkerHand/core/can/linker_hand_l24_can.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def __init__(self, config, can_channel='can0', baudrate=1000000, can_id=0x28):
126126
)
127127
elif sys.platform == "win32":
128128
self.bus = can.interface.Bus(
129-
channel='PCAN_USBBUS1', interface='pcan', bitrate=baudrate,
129+
channel=can_channel, interface='pcan', bitrate=baudrate,
130130
can_filters=[{"can_id": can_id, "can_mask": 0x7FF}]
131131
)
132132
else:

LinkerHand/core/can/linker_hand_l25_can.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __init__(self, can_channel='can0', baudrate=1000000, can_id=0x28):
155155
)
156156
elif sys.platform == "win32":
157157
self.bus = can.interface.Bus(
158-
channel='PCAN_USBBUS1', interface='pcan', bitrate=baudrate,
158+
channel=can_channel, interface='pcan', bitrate=baudrate,
159159
can_filters=[{"can_id": can_id, "can_mask": 0x7FF}]
160160
)
161161
else:

0 commit comments

Comments
 (0)