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 helloworld import HelloWorld
|
|
|
|
|
2024-05-14 10:18:12 +08:00
|
|
|
ChannelFactoryInitialize()
|
2024-04-26 21:26:50 +08:00
|
|
|
|
|
|
|
sub = ChannelSubscriber("topic", HelloWorld)
|
|
|
|
sub.Init()
|
|
|
|
|
|
|
|
while True:
|
|
|
|
msg = sub.Read()
|
|
|
|
|
|
|
|
if msg is None:
|
|
|
|
print("subscribe error.")
|
|
|
|
else:
|
|
|
|
print("subscribe success. msg:", msg)
|
|
|
|
|
|
|
|
pub.Close()
|