GithubHelp home page GithubHelp logo

3spheresroboticsproject / flask_ask_ros Goto Github PK

View Code? Open in Web Editor NEW
15.0 7.0 7.0 95 KB

A locally hosted web service + ROS node for custom Alexa skills based on Flask-Ask: https://github.com/johnwheeler/flask-ask

License: MIT License

CMake 77.23% Shell 2.06% Python 20.71%
alexa-skills-kit alexa ros ros-kinetic

flask_ask_ros's Introduction

flask_ask_ros

A locally hosted web service + ROS node for custom Alexa skills based on Flask-Ask.

Table of Contents

Description

This package combines a Flask server and ROS node into a script that serves as an endpoint for a custom Alexa Skill. This enables information sent by voice to the Amazon Alexa to be processed by other ROS nodes and services.

In this package we provide a simple Alexa skill that parses a single slot (word/argument) from an utterance (spoken function call) and publishes it to a ROS topic.

Requirements

  • Ubuntu 16.04

  • ROS Kinetic

  • Flask-ask (Python): follow installation from source here.

Maintainers

Installation

  • Navigate to source directory of your ROS catkin workspace (e.g. catkin_ws):

        cd catkin_ws/src
        git clone https://github.com/3SpheresRoboticsProject/flask_ask_ros
  • Build catkin workspace:

        cd catkin_ws
        catkin_make
  • If necessary, set script file permissions to executable:

        chmod +x catkin_ws/src/flask_ask_ros/src/*
  • Source workspace:

        source catkin_ws/devel/setup.bash

Usage

Endpoint configuration

In order for the Alexa requests to reach the local skill server, the local network must be configured to tunnel HTTPS traffic to a specific port on the local machine.

We have tested two ways to accomplish this:

  • Using ngrok as a tunnel

  • Static IP/Dynamic DNS + self-signed SSL certificate

ngrok tunnel configuration

  1. Set the ROS_IP environment variable to be the local machine IP

  2. Download ngrok for Linux and unzip

  3. Start an ngrok server:

    ./ngrok http $ROS_IP:5000
  4. Open the Amazon Developer Console and navigate to your custom skill:

    • Under Configuration, select HTTPS and paste the URL shown on the ngrok terminal (see below).

      alt text

    • Under SSL Certificate select My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority.

  5. Run the skill server with the ngrok argument set to true:

    roslaunch flask_ask_ros start_skill_server.launch ngrok:=true

Static IP/Dynamic DNS + self-signed SSL certificate

  1. Set the ROS_IP environment variable to be the local machine IP

  2. Configure the router to forward HTTPS requests (port 443) from the local network's public IP to a local IP and port 5000

    This setting is usually located under 'Virtual Server', or 'Port triggering'. See an example below on the D-Link DIR-655 router.

    alt_text

  3. Include the static IP and/or Dynamic DNS hostname in a SSL configuration file /config/ssl_keys/configuration.cnf (sample provided)

    Under [subject_alternate_names] add the line IP.1 = <your ip> and/or DNS.1 = <your hostname>

  4. Run the script generate_ssl_cert.sh to generate the certificate in /config/ssl_keys/certificate.pem

  5. Open the Amazon Developer Console and navigate to your custom skill:

    • Under Configuration, select HTTPS and type in https://<your hostname> or https://<your ip>

    • Under SSL Certificate, select I will upload a self-signed certificate... and paste the contents of /config/ssl_keys/certificate.pem

  6. Run the skill server

    roslaunch flask_ask_ros start_skill_server.launch

Testing

In order to test the provided skill server, open your Amazon Developer Console, create a custom skill, and follow the steps above to configure your endpoint.

Inside the skill builder, navigate to the JSON Editor and paste the contents of src/test_skill.json. Save and build the model.

Run the skill server to test your skill.

TODO

  • Sample code for ROS services

This app was not created or endorsed by Amazon.

flask_ask_ros's People

Contributors

lucasporto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask_ask_ros's Issues

Ngrok server issue

I ran the ngrok server and the skill server but it is still having issues. When I run the skill I get a 500 internal server error. The Alexa developer console is set up with no issue, and I use a physical echo for testing. I followed the tutorial but I wonder where I went wrong? We can Skype if you would like?

screenshot from 2018-07-19 12-01-46

http://127.0.0.1:4040/inspect/http
screenshot from 2018-07-19 12-04-14

Thanks,
University of Delaware

Pre-release review

Overall, good job! Here are few things to consider:

ReadMe:

  1. Consider being more specific about the "installation of Flask_ask from source" requirement
  2. Add "Amazon Developer Account" to the Requirements section
  3. In section "Static IP/Dynamic DNS", for consistency, change "Alexa Developer Console" to "Amazon Developer Console (https://developer.amazon.com)
  4. Include the following statement in the ReadMe description: “This app was not created or endorsed by Amazon.” See https://developer.amazon.com/public/support/legal/tuabg

Files:

  1. Add MIT Licence file to root
  2. Review potential trademark issues related to use of "alexa" in "alexa_ros.launch" file.

Consider "ros_for_alexa.launch"

"...Alexa
If you are authorized to develop for the Alexa service, you may use the “Alexa” word mark (and any Alexa badges that may be added to these Guidelines in the future) to promote your product in accordance with these Guidelines....
...Refer to Amazon or the Amazon product or service only in a way that describes the app’s compatibility or purpose, using words like “for” or “to....”
Source: https://developer.amazon.com/public/support/legal/tuabg

Can't build model in alexa developer console

Original error: Build Failed
There are missing slot values in slot type "AMAZON.FirstName" for slot "name" in intent "TestIntent". Error code: MissingSlot

After adding a slot value: Build Failed
Slot type name "AMAZON.FirstName" is invalid. The name of a custom slot type must begin with an alphabetic character and can consist only of alphabetic characters or underscores. Error code: InvalidSlotTypeName

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.