JetRacer ROS AI Kit Advanced Tutorial VII: ROS Voice Environment Configuration

From Waveshare Wiki
Revision as of 09:11, 7 November 2022 by Eng52 (talk | contribs) (Created page with "==Step 1: Install Dependencies== *Enter the following commands to install the dependencies on the robot: <pre> sudo apt update sudo apt install python-pip sudo python -m pip...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Step 1: Install Dependencies

  • Enter the following commands to install the dependencies on the robot:
sudo apt update
sudo apt install python-pip
sudo  python -m pip install websocket
sudo  python -m pip install websocket-client
sudo apt install sox libsox-fmt-all
sudo apt install portaudio19-dev
sudo  python -m pip install pyaudio
sudo  python -m pip install webrtcvad
sudo apt install libatlas-base-dev
sudo apt install flac
sudo  python -m pip install gtts

Step 2: Install Google Assistant SDK

  • Install Python 3 virtual environment.
sudo apt-get update
sudo apt-get install python3-dev python3-venv
cd ~
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools wheel
  • The following steps are performed in the virtual environment. To reopen the terminal, you need to run the following commands to enter the virtual environment.
source env/bin/activate #Open the virtual environment

ROS Voice Environment Configuration01.png

  • Please register the setting model according to Step 4.
  • Install Google Assistant SDK.
(env) $ sudo apt-get install portaudio19-dev libffi-dev libssl-dev
(env) $ python -m pip install --upgrade google-assistant-sdk[samples]

Step 3: Authorize the Google Assistant SDK Installation or Update Authorization Tools

  • Enter the command to generate Google Assistant authorization credentials.
(env) $ python -m pip install --upgrade google-auth-oauthlib[tool]
  • Generate credentials to be able to run sample code and tools. Reference the JSON file you downloaded in the previous step; you may need to copy it to your device. do not rename the file.
(env) $ google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
      --save --headless --client-secrets /path/to/client_secret_ client-id .json
  • A URL can be seen in the terminal: Please visit this URL to authorize this application: https://..
  • Copy the URL and paste it into your browser (can be done on any computer). This page will ask you to log into your Google account. Sign in to the Google account you created the developer project in the previous step. Once the permission request is approved from the API, a code such as "4/XXXX" will be displayed in the browser. Copy and paste this code into the terminal:
Please go to this URL: https://...
Enter the authorization code:
  • If authorization is successful, you will see a response similar to the following. If you see InvalidGrantError, you have entered an invalid code. Please try again, be careful to copy and paste the entire code.
credentials saved: /path/to/.config/google-oauthlib-tool/credentials.json #Authorization
  • Run the following command to test that my-dev-project is the Google Cloud Platform project ID of the Actions Console project created. To find the project ID in the Actions Console, my-model is the name of the device model registered in the previous step.
(env) $ googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
  • If the following prompt appears, please install the lower version.

ROS Voice Environment Configuration02.png

python -m pip install cryptography==36.0.2