2024-04-26 21:26:50 +08:00
|
|
|
import time
|
2024-05-14 10:18:12 +08:00
|
|
|
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
2024-04-26 21:26:50 +08:00
|
|
|
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
|
|
|
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
|
|
|
|
|
|
|
def LowStateHandler(msg: LowState_):
|
|
|
|
print(msg.motor_state)
|
|
|
|
|
|
|
|
|
2024-05-14 10:18:12 +08:00
|
|
|
ChannelFactoryInitialize(0, "enp2s0")
|
2024-04-26 21:26:50 +08:00
|
|
|
sub = ChannelSubscriber("rt/lowstate", LowState_)
|
|
|
|
sub.Init(LowStateHandler, 10)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
time.sleep(10.0)
|