Giter Club home page Giter Club logo

dialogflow_ros's Introduction

Dialogflow_ros

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:

Installation

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

Cloning The Repo

Install all the requirements using pip by cloning the Github repo and installing all the packages in requirements.txt.

cd ~/catkin_ws/src
git clone https://github.com/piraka9011/dialogflow_ros.git
cd dialogflow_ros
pip install -r requirements.txt

Google Cloud Setup

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.

  1. Setup a service account
  2. Download the service account key as a JSON.
  3. Check you have GOOGLE_APPLICATION_CREDENTIALS in your environment. This should be the path to the keys.
export GOOGLE_APPLICATION_CREDENTIALS='/path/to/key'
  1. Run the authentication command:
gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS

Dialogflow Setup

Follow the steps here to setup authentication with Dialogflow. Note the name of your project-id and make sure to change that in config/params.yaml.

Snowboy Setup

While a compiled .so of the library exists in the repo, you may need to compile one for your own system if you get a error complaining that _snowboydetect.so was not found. Clone the Snowboy repo to some directory and install the dependencies:

sudo apt-get install python-pyaudio python3-pyaudio sox
sudo apt-get install libatlas-base-dev
sudo apt-get install libpcre3 libpcre3-dev
pip install pyaudio

Then install swig in some other directory

wget http://downloads.sourceforge.net/swig/swig-3.0.10.tar.gz

./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings
make
make install
install -v -m755 -d /usr/share/doc/swig-3.0.10
cp -v -R Doc/* /usr/share/doc/swig-3.0.10

Now go back to your Snowboy repo and run the following:

cd swig/Python
make

SWIG will generate a _snowboydetect.so file and a simple (but hard-to-read) python wrapper snowboydetect.py. Move this to /dialogflow_ros/scripts/snowboy replacing the original one.

Usage

Follow the steps below to setup the package properly.

Configuration

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.

Launching nodes

To start the Dialogflow nodes, run the following command:

roslaunch dialogflow_ros dialogflow.launch

To use Snowboy hotword detection run:

roslaunch dialogflow_ros hotword_df.launch

ROS Nodes

mic_client

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.

Published Topics

text_topic (std_msgs/String) Acquired text from the Google Cloud Speech API.

dialogflow_client

ROS node that takes text from the mic_client node and sends it to Dialogflow for parsing.

Published Topics

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.

dialogflow_ros's People

Contributors

awesomebytes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.