Skip to content

Adding AI chat and voice command functionality to Cozmo robot.

License

Notifications You must be signed in to change notification settings

c64-dev/Cozmo.AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cozmo.AI Header

This project aims to extend Cozmo's abilities with voice recognition, interactive chatting sessions (served by online AI chatbots) special user commands, pulling useful information from the internet, etc.

Requirements

  1. If not already installed, download and install the following:
  1. Download geckodriver and install according to your OS.
  • On Windows, copy the .exe to a folder (eg C:\bin\gecko) and open a command prompt to declare it in your PATH:
$ set PATH=%PATH%;C:\bin\gecko
  • On Linux and MacOS extract the file to your home folder, open a Terminal prompt and run:
mkdir ~/.local/bin
cp ~/geckodriver ~/.local/bin/
export PATH=$PATH:~/.local/bin/
  1. Install all the necessary Python libraries.

Important note: Since Cozmo's API is unfortunately not actively maintained anymore, I had to fork the whole API and incorporate various fixes for issues that were caused by third party Python libraries ungrading and breaking various calls in the code. As such we are going to install cozmo's API library from the fork.

  • On Windows start a command prompt, go to Python's pip.exe location (eg C:\Python35\Scripts) and run:
pip.exe install -U selenium pillow numpy termcolor requests SpeechRecognition selenium feedparser beautifulsoup4 unidecode pyaudio
pip.exe install -U git+https://github.com/c64-dev/cozmo-python-sdk.git
  • On MacOS/Linux start a Terminal and run:
pip3 install selenium pillow numpy termcolor requests SpeechRecognition selenium feedparser beautifulsoup4 unidecode pyaudio
pip3 install git+https://github.com/c64-dev/cozmo-python-sdk.git

For Apple Mac users only: If you encounter an error trying to install pyaudio, then please install Homebrew and then run the following terminal commands:

brew install --build-from-source portaudio
pip3 install pyaudio

After pyaudio is installed, then run the previous pip command to install all the other libraries.

Installation

After all the requirements are met you can install Cozmo.AI as follows:

  • Windows:
set PATH=%PATH%;C:\Program Files\Git\cmd
cd %HOME%
git.exe clone https://github.com/c64-dev/Cozmo.AI.git
  • MacOS/Linux:
cd ~/
git clone https://github.com/c64-dev/Cozmo.AI.git

Usage

  1. For the very first time only, you will need to enable the connection between your phone and your PC. There are various guides on the internet (like this one depending on your computer OS and phone type but generally the typical process for an Android phone is this:
  • Enable USB debugging on your phone.
  • Get Android ADB & Fastboot drivers either for Mac/Linux or Windows and install them.
  • Connect your phone to your computer using a USB cable.
  • Tap the USB option from the Notification Panel on your phone and make sure that MTP mode and USB Debugging are both enabled.
  • In a Terminal/Command prompt run adb devices. It should list your phone as unauthorised.
  • Run any push/pull adb command such as adb push abc abc to prompt your phone to authorize your computer.
  1. With your phone connected via USB to your computer, connect your Cozmo robot to your smartphone/tablet via wifi and run Cozmo's app.

  2. After Cozmo wakes up go to the app's settings and enable SDK mode. Now the phone should display a black text screen and Cozmo should stop moving around. The robot is now ready to execute our Python program.

  3. Run the CozmoAI program as follows:

  • Windows:
python.exe %HOME%\Cozmo.AI\main.py
  • MacOS/Linux:
python3 ~/Cozmo.AI/main.py

Updating

To update to the latest version of CozmoAI simply run the following commands:

  • Windows:
cd %HOME%\Cozmo.AI
git.exe pull https://github.com/c64-dev/Cozmo.AI.git
  • MacOS/Linux:
cd ~/Cozmo.AI/
git pull https://github.com/c64-dev/Cozmo.AI.git