-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_robot_audio.py
More file actions
35 lines (27 loc) · 970 Bytes
/
Copy pathrun_robot_audio.py
File metadata and controls
35 lines (27 loc) · 970 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
30
31
32
33
34
35
#!/usr/bin/env python3
import os
import signal
import sys
import threading
# The G1 source build lives in this interpreter's own environment.
os.environ["CYCLONEDDS_HOME"] = sys.prefix
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
from robogesture.config import DDS_DOMAIN, ROBOT_AUDIO_SINK, ROBOT_DDS_INTERFACE
from robogesture.robot_audio import PulsePlayer, RobotAudioService
def main():
ChannelFactoryInitialize(DDS_DOMAIN, ROBOT_DDS_INTERFACE)
service = RobotAudioService(PulsePlayer(ROBOT_AUDIO_SINK))
stopped = threading.Event()
signal.signal(signal.SIGINT, lambda *_: stopped.set())
signal.signal(signal.SIGTERM, lambda *_: stopped.set())
try:
service.start()
print(
"[机器人音频] RoboGesture 已就绪:eth2 -> {}。".format(ROBOT_AUDIO_SINK),
flush=True,
)
stopped.wait()
finally:
service.close()
if __name__ == "__main__":
main()