<launch>
  <!-- publish tf of respeaker -->
  <arg name="publish_tf" default="true"/>
  <!-- launch respeaker -->
  <arg name="launch_respeaker" 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"/>
  <!-- self cancellation -->
  <arg name="self_cancellation" default="true"/>

  <node if="$(arg publish_tf)"
        name="static_transformer" pkg="tf" type="static_transform_publisher"
        args="0 0 0 0 0 0 1 map respeaker_base 100"/>

  <node if="$(arg launch_respeaker)"
        name="respeaker_node" pkg="respeaker_ros" type="respeaker_node.py"
        respawn="true" respawn_delay="10" />

  <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: $(arg self_cancellation)
      tts_tolerance: 0.5
    </rosparam>
  </node>
</launch>
