A locally hosted web service + ROS node for custom Alexa skills based on Flask-Ask.
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.
-
Ubuntu 16.04
-
ROS Kinetic
-
Flask-ask (Python): follow installation from source here.
-
Lucas Porto lucasporto@outlook.com
-
Sina Radmard s.radmard85@gmail.com
-
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
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
-
Set the
ROS_IP
environment variable to be the local machine IP -
Download ngrok for Linux and unzip
-
Start an ngrok server:
./ngrok http $ROS_IP:5000
-
Open the Amazon Developer Console and navigate to your custom skill:
-
Run the skill server with the ngrok argument set to
true
:roslaunch flask_ask_ros start_skill_server.launch ngrok:=true
-
Set the
ROS_IP
environment variable to be the local machine IP -
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.
-
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 lineIP.1 = <your ip>
and/orDNS.1 = <your hostname>
-
Run the script
generate_ssl_cert.sh
to generate the certificate in/config/ssl_keys/certificate.pem
-
Open the Amazon Developer Console and navigate to your custom skill:
-
Under Configuration, select HTTPS and type in
https://<your hostname>
orhttps://<your ip>
-
Under SSL Certificate, select I will upload a self-signed certificate... and paste the contents of
/config/ssl_keys/certificate.pem
-
-
Run the skill server
roslaunch flask_ask_ros start_skill_server.launch
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.
- Sample code for ROS services
This app was not created or endorsed by Amazon.