This package uses the Google Text-To-Speech (TTS) API to send results to Dialogflow, Google's NLP platform.
Further information can be found at the ROS wiki. Reproduced here:
There is an install.sh script available in git directory if you wish to use it, however, I will go over the steps one-by-one here.
Installing this package requires 3 main steps: cloning the dialogflow repo, setting up your Google cloud project, and setting up Dialogflow. However, we need to install PortAudio so we can use PyAudio to get mic data.
sudo apt-get install portaudio19-dev
Install all the requirements using pip by cloning the Github repo and installing all the packages in requirements.txt.
cd <workspace>/src
git https://github.com/Juancams/dialogflow_ros2.git
cd dialogflow_ros2
pip install -r requirements.txt
Follow the instructions here for configuring your Google Cloud project and installing the SDK for authentication. You will need a google/gmail account.
Usage of the Google Cloud SDK requires authentication. This means you require an API key and an activated service account to utilize the APIs.
- Go to Google Cloud Console.
- Create a new project.
- Go to the Kick Setup.
- Enable API.
- Create Service Account.
- Create key & download the JSON File. Rename and move it t your HOME as ~/df_api.json.
- Go to DialogFlow Console.
- Create new Agent & select the project.
- Edit
dialogflow_ros2/config/param.yaml
and write down your project id. You can find it in the DialogFlow Console, clicking in the gear icon. - Add
export GOOGLE_APPLICATION_CREDENTIALS='/home/<user>/df_api.json'
to your.bashrc
and change user.
Follow the steps below to setup the package properly.
Go into the config directory and change the following parameters in the params.yaml
file:
results_topic
: (Optional) The topic where your results will be published.project_id
: The name of your project for the Google Speech node. This is the name of your Google Cloud project when going through the Google Cloud setup.
To start the Dialogflow nodes, run the following command:
ros2 launch dialogflow_ros2 dialogflow.launch
ROS node receives text from the Google Cloud Speech API and publishes it onto text_topic
(see config/params.yaml). This is used by the dialogflow_client node.
text_topic
(std_msgs/String)
Acquired text from the Google Cloud Speech API.
ROS node that takes text from the mic_client node and sends it to Dialogflow for parsing.
results_topic
(dialogflow_msgs/DialogflowResult)
Publishes a message with the actions, parameters (python dictionary), and fulfillment text associated with the detected intent as a std_msgs/String.