This repository contains the code for Windows to voice control the Spider Robot.
Install Git for Windows.
Download and install Visual Studio 2019 Community Edition. Select Desktop development with C++ workload and make sure C++ CMake tools for Windows component is also selected.
Note: All commands below should be executed from the Start → Visual Studio 2019 → Visual Studio Tools → Developer Command Prompt for VS 2019. Some commands requre elevation (Run as Administrator).
In elevated command prompt run:
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
C:\vcpkg\vcpkg\bootstrap-vcpkg.bat
C:\vcpkg\vcpkg integrate install
Compile and install grpc and protobuf using vcpkg:
C:\vcpkg\vcpkg install grpc:x64-windows protobuf:x64-windows
This will take a long time.
gRPC requires an environment variable to configure the trust store for SSL certificates. This repo already contains roots.pem file. Set the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH
environment variable to point to the roots.pem file in the root of this repository.
If you haven't already created a project, create one now. Projects enable you to manage all Google Cloud Platform resources for your app, including deployment, access control, billing, and services.
- Open the Cloud Platform Console.
- In the drop-down menu at the top, select Create a project.
- Give your project a name.
- Make a note of the project ID, which might be different from the project name. The project ID is used in commands and in configurations.
If you haven't already enabled billing for your project, enable billing now. Enabling billing allows the application to consume billable resources such as Speech API calls. See Cloud Platform Console Help for more information about billing settings.
Click here to visit Cloud Platform Console and enable the Speech API.
If you are using a user account for authentication, you need to set the GOOGLE_CLOUD_CPP_USER_PROJECT
environment variable to the project you created in the previous step. Be aware that you must have serviceusage.services.use
permission on the project. Alternatively, use a service account as described next.
These samples can use service accounts for authentication.
- Visit the Cloud Console, and navigate to:
API Manager > Credentials > Create credentials > Service account key
- Under Service account, select
New service account
. - Under Service account name, enter a service account name of your choosing. For example,
transcriber
. - Under Role, select
Project > Owner
. - Under Key type, leave
JSON
selected. - Click Create to create a new service account, and download the json credentials file.
- Set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to your downloaded service account credentials.
See the Cloud Platform Auth Guide for more information.
Pair the HC-06 of the Robot Spider with your computer. PIN is 1234
. Use Start → Control Panel → Hardware and Sound → Devices and Printers to examine which COM port the HC-06 was assigned.
cd speech\api
cmake -S. -B.build -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build .build
cd speech\api
.build\Debug\streaming_transcribe --language-code sl-SI --bitrate 32000 COM5
Use the sl-SI
or en
(default) language codes.
Use the same COM port assigned to HC-06 in Bluetooth.
The best recognition success was observed with 32000 Hz sampling frequency and a professional microphone. 16000 Hz prooved a bit too unreliable for female and child voices.
The streaming_transcribe
will listen for audio on default recording device for 10 minutes. It can be cancelled with Ctrl+C
.
Recognised commands are:
Text | Action |
---|---|
robot pojdi naprej | step forward |
robot pojdi nazaj | step backward |
robot pojdi levo | turn left |
robot obrni se levo | turn left |
robot pojdi desno | turn right |
robot obrni se desno | turn right |
Text | Action |
---|---|
robot go forward | step forward |
robot go backward | step backward |
robot turn left | turn left |
robot turn right | turn right |