Given that Raspbian's OS is a comfortable environment to work with Python, and provided that the libraries and programs in charge of controlling both the Voice Kit and Cozmo are avaliable in the same language, it will be the one we will be using to write our scripts and future programs. But before this, it's required that we obtain the appropiated libraries for an optimal communication between the robot and our board, while verifying the kit is working accordingly.
We will start off by making the adequated checks regarding this last one: According to the user manual associated to the AIY's Voice Kit, in order to check both the microphone and speaker are working fine, it will be necessary to execute the Python script "Check audio.py".
We will start off by making the adequated checks regarding this last one: According to the user manual associated to the AIY's Voice Kit, in order to check both the microphone and speaker are working fine, it will be necessary to execute the Python script "Check audio.py".
After executing it from the LXTerminal, our output shows the program has been executed successfuly and, because of this, we can safely assume both peripherials are working.
Next up, we need to check our Raspberry Pi's WiFi connection. this is a very important step, given that the AIY Voice Kit is constantly exchanging all the information picked up by the peripherials for the responses stored in the cloud, therefore it's not really our kit the one who's processing the user's commands. While interpreting and responding appropiatedly to a human's commands would certainly surpass the processing capabilities of our board, we can overcome this obstacle performing said operations from a remote server, as long as it has a stable connection to the web with a wide enough broadband.
Before performing any WiFi checks, we must ensure our Raspberry Pi is connected to a viable network. In order to achive this, we can connect our device to a WiFi signal amplifier, or simply connect it analogically to a router via Ethernet cable. To make sure a connection has been established, we can simply type the command "ifconfig wlan0" in any terminal, which should return the WiFi connection details without any error messages.
To check if our connection is also viable for the AIY's Voice Kit to properly work, we will execute the script "Check wifi.py".
If the output is the same shown above, then everything is working just fine.
Once we've managed to get everything setup and working, it's Cozmo's turn. The machine itself can both work freely in a sort of "auto mode", following some predefined guidelines stored in its app, also including an additional functionality called "Code Lab", which allows to create basic block-based scripts. But we are interested on creating our own programs at a more complex level than what the Code Lab offers, therefore we will focus on the Python's SDK (Software Developement Kit) built-in functionalities, all free and created by Anki. This set of libraries comprises dedicated to the communication between mobile devices and our PC, while also implementing various control functions, being our bridge to a series of communication protocols between both sides (AIY's Voice Kit and Cozmo the robot) and the user themselves. It will also allow us to create a purely spoken HMI (Human-Machine Interface) that controls all the aforementioned devices.
The SDK in question requires Python 3.6.0 or any superior version to work. To check the current Python version in our Raspberry Pi, we must simply open a terminal and run the command "python --version". Once we made sure we have the correct version (if not, do "pip3 install python3" in the terminal and wait for the instalation to be completed), we can proceed to install all the required Cozmo libraries via "pip3 install --user cozmo[camera]", followed by "pip3 install --user --upgrade cozmo". These libraries allow us to make use of the standard speech, sensorization and movement features the robot offers, also letting us access all data picked up by its front and infrared cameras.
Following these steps, we will need to install the ADB (Android Debug Bridge) libraries, which will allow us to communicate with our mobile device (as long as they are running Android, that is). To do so, we need to run the commands "sudo apt-get update" and "sudo apt-get install -y android-tools-adb". To check the installation was successful, we can run the command "adb" in our terminal, which will let us know via an error message if there were any inconveniences during the installation. If that's not teh case, we can verify the connection between our mobile device and the Raspberry Pi running the command "adb devices", again in any terminal. This should display a list of all active connections alongside each device's MAC address.
It should be born in mind that our mobile device won't appear in the aforementioned list unless we turn on "Debug Mode" from our smartphone. In order to do so, we should navigate to the phone's "Settings" app, go to "Developer options" (which can be unlocked by going to "About this phone" and tapping 7 times on the version number, which should prompt a small message saying there are new settings avaliable), and from there turn on "Debug Mode". Once we had managed to connect our mobile device to the Raspberry Pi, we should confirm from our smartphone that we wish to grant communication permissions to the board (a notification should pop up once connected giving you the option to do so).
If we managed to do everything right, we should be able to access the SDK from Cozmo and execute the exampels that can be downloaded from the developer website.
Comments
Post a Comment