-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathreset_pose_test.py
More file actions
29 lines (23 loc) · 839 Bytes
/
reset_pose_test.py
File metadata and controls
29 lines (23 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
"""
publish reset category command to rt/reset_pose/cmd
"""
import time
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
from unitree_sdk2py.idl.std_msgs.msg.dds_ import String_
def publish_reset_category(category: int,publisher):
# construct message
msg = String_(data=str(category)) # pass data parameter directly during initialization
# create publisher
# publish message
publisher.Write(msg)
print(f"published reset category: {category}")
if __name__ == "__main__":
# initialize DDS
ChannelFactoryInitialize(1)
publisher = ChannelPublisher("rt/reset_pose/cmd", String_)
publisher.Init()
for cat in [1]:
publish_reset_category(cat,publisher)
time.sleep(1) # wait for 1 second
print("test publish completed")