Skip to content

Commit 44a8042

Browse files
authored
Merge pull request #23 from agilexrobotics/pr
[BUG]修复hardware/can_encapsulation.py/C_STD_CAN类内的SendCanMessage函数内调用is_can_bus_ok函数时,base_state为None的问题
2 parents 793601a + 02762c5 commit 44a8042

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hardware_port/can_encapsulation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ def is_can_bus_ok(self) -> bool:
170170
'''
171171
Check whether the CAN bus status is normal.
172172
'''
173-
bus_state = self.bus.state
173+
if isinstance(self.bus, can.BusABC):
174+
bus_state = self.bus.state
175+
else: bus_state = None
174176
if bus_state == can.BusState.ACTIVE:
175177
# print("CAN bus state: ACTIVE - Bus is functioning normally")
176178
return True

0 commit comments

Comments
 (0)