47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
from launch import LaunchDescription
|
||
from launch_ros.actions import Node
|
||
from launch.actions import SetEnvironmentVariable
|
||
import os
|
||
|
||
|
||
def generate_launch_description():
|
||
"""启动语音交互节点,所有参数从 voice.yaml 读取"""
|
||
# 获取interfaces包的install路径
|
||
interfaces_install_path = os.path.expanduser('~/ros_learn/hivecore_robot_interfaces/install')
|
||
|
||
# 设置AMENT_PREFIX_PATH,确保能找到interfaces包的消息类型
|
||
ament_prefix_path = os.environ.get('AMENT_PREFIX_PATH', '')
|
||
if interfaces_install_path not in ament_prefix_path:
|
||
if ament_prefix_path:
|
||
ament_prefix_path = f'{ament_prefix_path}:{interfaces_install_path}'
|
||
else:
|
||
ament_prefix_path = interfaces_install_path
|
||
|
||
return LaunchDescription([
|
||
SetEnvironmentVariable('AMENT_PREFIX_PATH', ament_prefix_path),
|
||
# ASR + 音频输入设备节点(同时提供VAD事件Service,利用云端ASR的VAD)
|
||
Node(
|
||
package='robot_speaker',
|
||
executable='asr_audio_node',
|
||
name='asr_audio_node',
|
||
output='screen'
|
||
),
|
||
# TTS + 音频输出设备节点
|
||
Node(
|
||
package='robot_speaker',
|
||
executable='tts_audio_node',
|
||
name='tts_audio_node',
|
||
output='screen'
|
||
),
|
||
# 主业务逻辑节点
|
||
Node(
|
||
package='robot_speaker',
|
||
executable='robot_speaker_node',
|
||
name='robot_speaker_node',
|
||
output='screen'
|
||
),
|
||
])
|
||
|
||
|
||
|