<launch>

  <!-- This launch file is based on sample_respeaker.launch from the official respeaker_ros package. -->
  
  <!-- publish tf of respeaker -->
  <arg name="publish_tf" default="true"/>
  <!-- launch sound_play node -->
  <arg name="launch_soundplay" default="true"/>
  <!-- input speech topic of speech_to_text.py -->
  <arg name="audio" default="speech_audio"/>
  <!-- output text topic of speech_to_text.py -->
  <arg name="speech_to_text" default="speech_to_text"/>
  <!-- langage used in speech_to_text.py -->
  <arg name="language" default="en-US"/>

  <node name="respeaker_node" pkg="respeaker_ros" type="respeaker_node.py"
        respawn="true"/>

  <node if="$(arg launch_soundplay)"
        name="sound_play" pkg="sound_play" type="soundplay_node.py"/>

  <node name="speech_to_text" pkg="respeaker_ros" type="speech_to_text.py"
        output="screen">
    <remap from="audio" to="$(arg audio)"/>
    <remap from="speech_to_text" to="$(arg speech_to_text)"/>
    <rosparam subst_value="true">
      language: $(arg language)
      self_cancellation: true
      tts_tolerance: 0.5
    </rosparam>
  </node>

</launch>
