In this lesson, we are going to create a new Alexa skill.
So a voice assistant action that performs a specific operation when it is activated.
Specifically, the action that we are going to develop will enable the Voice assistant to send several
comments to the robot in response to different received voice commands.
To develop an Alexa skill.
Amazon provides a user friendly web application so a developer console where the developers can not
only create new skills and voice assistant actions, but also can test and activate those actions using
their own voice as if they were interacting with a real voice assistant.
So to find the Alexa developer console, let's type on Google Alexa Developer console or just click
on the link that I leave in the description of this course.
So let's click on the first one.
And here, if you already have an Amazon account, you can use it also to access to the Alexa developer
console.
So here, let's click on login.
And now here you can use your Amazon account.
So I will use my own account, but if you don't have one, you can register here.
So let's log in.
And in this developer console, we can start by creating a new skill.
So let's click here on the developer console.
So let's go to the developer console.
This will open a new link and here we can start creating our skill so our Alexa skill.
Let's start by clicking on Create Skill and now let's give it a name.
So let's, for example, call it as our robot.
That is the Arduino bot.
Next, we need to define also a language.
Let's use English us.
So let's click on next here.
We also need to select the type of experience let's set to other.
And then we need to select a model to begin creating our skill.
And while Amazon Alexa offers a variety of predefined models for interacting with Alexa, there is currently
no model that is specifically for interacting with our robot and Ros2.
Therefore, let's start with a custom model.
So this one here in which we are going to build our skill and our interaction model with the robot.
So then let's move down.
And the next we need to select the hosting service.
Since Alexa needs to communicate and exchange information with our skill through the Internet.
And so we are going to configure how we intend to make our new skill accessible to the Internet.
As mentioned in the theoretical lessons, we are going to use a software called Ngrok that creates and
hosts a web service on our PC.
So this web service will serve as access point for the Alexa Assistant to send commands to our PC and
so to our robot.
Therefore, let's choose the provide on your own.
So let's choose the third one.
And now let's click on next.
And let's click on Start from scratch.
So still click on Next.
And now we can finally create our skill.
This will take a couple of seconds.
So as here in order to build our skill.
We can close this window here and now.
Let's wait for the console to finish creating and configuring.
So as we can see here, there is building progress in order to start configuring it.
Now, once this is done so we can start actually customizing this skill by defining.
So here an invocation name.
So this is a word or a phrase that we want to use to start.
So to activate the interaction with our skill.
For example, let's type the phrase activate the robot.
For example, let's use the phrase activate robot.
This means that whenever we say Alexa activate Robot, the voice assistant will understand that we want
to interact with this skill.
And so we'll begin the communication with the web service that we are hosting on our PC.
And so it will begin to send commands to the robot.
Let's save this invocation name.
So let's click on Save.
And now we can move on to the interaction model.
So let's click here on the interaction model and then to the intents.
So here are listed all the skill functionalities, so all the voice commands that are required to activate
each functionality by default.
We can see that just by creating this skill, some intents are created by default, so are already present
and these are the ones to interact with the skill in order to cancel it or to stop the interaction with
Alexa.
Now let's, for example, delete the word intent.
Let's remove this one and let's create instead a new one.
And let's call this one pick intent.
And now we need to add a list of the commands that we are going to need to activate this intent.
So first, let's create this custom intent.
And now, for example, the command that can activate this pick action is pick up this pen.
So let's press enter or also grab the pen or also, for example, we can say pick the pen.
So whenever we say one of these three commands to the Alexa assistant, it will automatically send a
goal to our action server.
So to our task server that is available on the robot and it will bring the robot in the pick position.
We can also add more comments.
So, for example, if you want, you can also add more phrases that you want to say if you want to enable
the intent.
But for the moment, we are happy about these three comments.
So these are enough.
And now let's proceed to create a new intent.
So let's go back to the intents.
Now we can see that we have our pick intent here has been created correctly.
And also it has three phrases.
So we can say three different comments to activate this pick intent.
Let's create a new one and let's call this one sleep indent.
Now let's create this custom intent and we want to activate this one.
When we say the phrase rest or sleep or turn off the robot.
So when we say one of these three phrases, basically the intent is the intent will be activated and
this will send a slip command to the robot.
So to the task server.
Let's move on.
So let's go back, let's say first.
And then let's go back to the intense.
And let's add one last intent.
So here and let's call this one wake intent.
So let's create this intent.
And now let's add the list of the commands that we want to use in order to activate this wake intent.
For example, the phrase wake up the robot or also activate the robot, or also, for example, just
wake up.
Let's save also this intent.
And now if we go back in the intense following, the same procedure, if you wish, you can continue
adding functionalities to the Alexa skill, sending actions to the robot and creating also a more complex
voice interaction model.
And so with more capabilities.
For now, I will stop here and we will move on configuring the next section of the console.
So let's go the next section.
Is the endpoint section.
So this one here is the one that we need to configure now.
Here.
We need to indicate the address that Alexa is to use for the communication with the robot.
And so for the communication with our PC, since we plan to provide and host the robots kill ourselves
using Andyrock, we can choose here the protocol to be Https.
And then for now, here, let's enter a placeholder address in the Uri field.
So here and under the default region.
So here, let's just say for example, https and rock.io.
But we will come back later to modify this address with the one that Ngrok will provide us once we start
Andyrock.
Next.
We also need to configure the SSL certificate type.
So let's press on this window and let's click on the My development endpoint is a sub domain.
So let's click on this one.
And now we can save this configuration of the endpoint.
So let's save this one.
Even though, as I said, we will come back to modify in the future, this one here.
So basically we are going to replace this one with the actual address that Ngrok will provide us.
Now we can click on save.
So.
This saved the interaction model and now we can go back to our skill.
So here to your skill.
And now actually we can click on the Arduino bot.
That is the name that we gave to our skill and now we can click on Build the Skill.
So let's press build and this process will create the voice interaction model and the natural language
processing for this skill, enabling it to convert and to understand the voice commands and also to
activate the corresponding intents.
Once the build of the voice interaction model is completed, we can proceed to test it.
Although anyway, it won't be able to communicate with our robot yet, but at least we can see that
the type and the content of the message that Alexa is going to try to send to the skill are correct.
So let's go to the test section here.
And here in this section, we can interact with the Alexa voice assistant as if we had a real Alexa
device.
And so we can use this one to test our skill.
And so let's allow the usage of the microphone.
And then let's set this one to the development.
So now we are able to test our skill and now we can interact with here with the voice assistant both
we can press the microphone and keep pressed this symbol here.
So this icon here or also we can just type here the command.
So for example, let's press this button.
Activate robot.
I am unable to reach the requested skill.
And although Alexa returned with an error, since we have entered a placeholder address for the communication
with our skill.
So basically the voice assistant was not able to contact our service and so did not receive any response.
However, the interesting part of this test is the message that appears in this console, and this is
basically a Json message that the voice assistant in the next lesson will send to our web server.
So to the web server that we are going to host on our PC.
So this is the Json that we have to receive and also to interpret in order to then activate the corresponding
action.
For example, if we scroll at the end of this message.
So here the interesting part is the type of the request that Alexa is sending to us.
So, for example, now the assistant is requesting the launch request and this is always the first message.
So the entry point of the interaction between the voice assistant and the Web service on our PC.
All the other messages that Alexa will exchange with our skill so with our web server will have a similar
format.
And so they will have the request and they will have a field name type.
And this will contain the type of the request that the assistant wants us to perform.
So, for example, this in the future will contain the peak intent or also it will contain the wake
up intent.
And so basically all the intents that we have defined.
Therefore, in the next lessons, we are going to create the code for our skill.
So we are going to implement the logic that receives this Json message, decode this message and also
based on the type of the request that it received communicates with the robot and Soviet Russia and
moves the robot in order to perform a specific task.