Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Latest commit

 

History

History
124 lines (80 loc) · 5.23 KB

README.md

File metadata and controls

124 lines (80 loc) · 5.23 KB

Spider Robot Voice-Activated Controller for Windows

This repository contains the code for Windows to voice control the Spider Robot.

Requirements

Git for Windows

Install Git for Windows.

Visual Studio 2019

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 StartVisual Studio 2019Visual Studio ToolsDeveloper Command Prompt for VS 2019. Some commands requre elevation (Run as Administrator).

vcpkg

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

grpc and protobuf

Compile and install grpc and protobuf using vcpkg:

C:\vcpkg\vcpkg install grpc:x64-windows protobuf:x64-windows

This will take a long time.

roots.pem

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.

Create a project in the Google Cloud Platform Console

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.

  1. Open the Cloud Platform Console.
  2. In the drop-down menu at the top, select Create a project.
  3. Give your project a name.
  4. 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.

Enable billing for your project

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.

Enable APIs for your project

Click here to visit Cloud Platform Console and enable the Speech API.

If needed, override the Billing Project

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.

Download service account credentials

These samples can use service accounts for authentication.

  1. Visit the Cloud Console, and navigate to: API Manager > Credentials > Create credentials > Service account key
  2. Under Service account, select New service account.
  3. Under Service account name, enter a service account name of your choosing. For example, transcriber.
  4. Under Role, select Project > Owner.
  5. Under Key type, leave JSON selected.
  6. Click Create to create a new service account, and download the json credentials file.
  7. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your downloaded service account credentials.

See the Cloud Platform Auth Guide for more information.

Bluetooth

Pair the HC-06 of the Robot Spider with your computer. PIN is 1234. Use StartControl PanelHardware and SoundDevices and Printers to examine which COM port the HC-06 was assigned.

Compilation

cd speech\api
cmake -S. -B.build -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build .build

Run

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:

sl-SI

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

en

Text Action
robot go forward step forward
robot go backward step backward
robot turn left turn left
robot turn right turn right