Software Installation for Cognitive Robotics

Install instructions for:

Ubuntu Linux

Python installation

Ubuntu comes with python3 by default, this can be verified by running this command in the terminal: python3

Git installation

Ubuntu comes with git installed by default, this can be verified by running this command in the terminal:
git --version
If git is not installed, then run these commands:
sudo apt update
sudo apt install git

Setting up the environment

  1. Make a directory to hold your Cognitive Robotics work, e.g., ~/CogRob

  2. cd into the directory you made.

  3. Clone the AIM_Websocket_Library repository into your CogRob directory by running this command:
    git clone https://github.com/touretzkyds/AIM_Websocket_Library
    
  4. Clone the vex-aim-tools repository by running this command:
    git clone https://github.com/touretzkyds/vex-aim-tools
    
  5. Create a Python virtual environment by running this command:
    python3 -m venv venv
    
  6. Activate the virtual environment by running this command:
    source venv/bin/activate
    
  7. Install the required packages by running this command:
    pip install -r vex-aim-tools/requirements-linux.txt
    
  8. Place the cogrob-google-cloud.json file you received in email into your CogRob directory. Warning: keep this credential file confidential. Do not place the file in a publicly-accessible directory, in a git repository, or anywhere that other people could get to it.

  9. Setting up the environment variables. Edit your ~/.bashrc file and add the following lines to the end (adjust as necessary based on where you put your CogRob directory). For the ROBOT variable, use the number of the robot that was assigned to you.
    export GOOGLE_APPLICATION_CREDENTIALS=~/CogRob/cogrob-google-cloud.json
    export OPENAI_API_KEY=(the API key you received in email)
    export PYTHONPATH=~/CogRob/AIM_Websocket_Library:~/CogRob/vex-aim-tools
    export PATH=$PATH:~/CogRob/vex-aim-tools
    export ROBOT=AIM-xxxxxxx.wifi.local.cmu.edu
    
  10. To test the installation, run these commands:
    source ~/.bashrc
    cd ~/CogRob    
    simple_cli
    
    If the installation was successful, you should see simple_cli trying to connect to your robot's IP.

Using the environment

When you come back later and want to work with the robot again, use these commands:
cd ~/CogRob
source venv/bin/activate
simple_cli

macOS

First, if you don't have Python, install Python version 3.13. Some people use brew or anaconda for this. Do not use Python 3.14.

Find out what shell you're using: open a Terminal and type echo $SHELL. For the remaining steps, follow the instructions above for Ubuntu, except if you're using zsh instead of bash as your shell, then edit ~/.zshrc instead of ~/.bashrc.

When you edit the ~/.zshrc or ~/.bashrc file, omit the line that sets the PATH variable, and add the following to the end of the file:

simple_cli() {
  python ~/Desktop/CogRob/vex-aim-tools/simple_cli "$1"
}

genfsm() {
  if [ -z "$1" ]; then
      python ~/Desktop/CogRob/vex-aim-tools/genfsm
   elif [ -z "$2" ]; then
      python ~/Desktop/CogRob/vex-aim-tools/genfsm "$1"
   else
     python ~/Desktop/CogRob/vex-aim-tools/genfsm "$1" "$2"
   fi
}

Windows

Python installation

You can use any version of Python from 3.8 up to 3.13. Do not use Python 3.14. If you don't already have Python installed on your machine, then follow these steps:
  1. Download a Python installer from the official website: https://www.python.org/downloads/windows/

  2. Run the installer and follow the instructions. Make sure to check the box that says "Add Python to PATH".

  3. Verify the installation by opening Command Prompt and running this command:
    python --version
    

Git installation

  1. Download the Git installer from the official website: https://git-scm.com/download/win

  2. Run the installer and follow the instructions. Make sure to check the box that says "Git Bash Here".

  3. Verify the installation by opening PowerShell and running this command:
    git --version
    

Setting up the environment

  1. Make a folder on your desktop called CogRob to hold your Cognitive Robotics work.
  2. Right click on the folder and choose "Open in Terminal".
  3. Clone the AIM_Websocket_Library repository into your CogRob folder by running this command in the terminal:
    git clone https://github.com/touretzkyds/AIM_Websocket_Library
    
  4. Clone the vex-aim-tools repository by running this command:
    git clone https://github.com/touretzkyds/vex-aim-tools
    
  5. Create a Python virtual environment by running this command:
    python -m venv venv
    
  6. Activate the virtual environment by running this command:
    .\venv\Scripts\activate
    
  7. Install the required packages by running this command:
    pip install -r vex-aim-tools\requirements-windows.txt
    
  8. Place the cogrob-google-cloud.json file you received in email into your CogRob folder. Warning: keep this credential file confidential. Do not place the file in a publicly-accessible directory, in a git repository, or anywhere that other people could get to it.

  9. Type "pwd" in the terminal to find the path to your CogRob folder. You will need this later. Let's pretend the path is C:\Users\dave\Desktop\CogRob.

Setting up environment variables

  1. See if you have a PowerShell profile by trying this command:
    	type $PROFILE
        
  2. If you don't already have a profile, create a PowerShell Profile by typing the following command in the terminal:
            New-Item -ItemType File -Path $PROFILE -Force
        
  3. Edit your PowerShell profile by typing: notepad $PROFILE

  4. Insert the following lines into your profile, changing the path to match yours and eliminating the spurious line breaks:
    function prompt { $(Split-Path -Path $pwd -Leaf) + "> " }

    function simple_cli { param ($file)
       python C:\Users\dave\Desktop\CogRob\vex-aim-tools\simple_cli $file }

    function genfsm { param ($file)
       python C:\Users\dave\Desktop\CogRob\vex-aim-tools\genfsm $file }

    $env:PYTHONPATH = "C:\Users\dave\Desktop\CogRob\AIM_Websocket_Library;C:\Users
    \dave\Desktop\CogRob\vex-aim-tools"

    $env:GOOGLE_APPLICATION_CREDENTIALS = "C:\Users\dave\Desktop\CogRob
    \cogrob-google-cloud.json"

    $env:OPENAI_API_KEY = "the API key you received in email, beginning with sk-"

    $env:ROBOT = "AIM-xxxxxxxx.wifi.local.cmu.edu"

  5. Save the file and exit Notepad.

  6. To verify the installation, close your PowerShell window, open CogRob again in a new one, and type "python simple_cli". If the installation was successful, you should see simple_cli trying to connect to your robot's IP.

Using the environment

When you come back later and want to work with the robot again, open your Cogrob folder in PowerShell and type the following commands:
.\venv\Scripts\activate
simple_cli

Virtual Andrew

Virtual Andrew uses Windows, but you can access it from a Mac via your browser, or by installing the VMware Horizon Client. In either case, connect to Virtual Andrew by opening
https://virtual.andrew.cmu.edu in Chrome. (The page will give you a link from which you can download the VMware Horizon Client if you wish.) If you're not using the client, then click on "Launch Via Browser", then click on "CMU vLab".

Follow the Windows install instructions above, but use your virtual Andrew account.

Using Your Virtual Andrew Installation

To run simple_cli in a fresh Virtual Andrew session, do the following:
  1. Connect to Virtual Andrew.

  2. Right-click on the CogRob folder on your desktop and select "Open in Terminal".

  3. Make sure your robot number matches the number in your $PROFILE file.

  4. In the PowerShell window, type the following:
    .\venv\Scripts\activate
        
  5. Now, whenever you want to run the robot do:
    simple_cli
        
  6. Speech input from the browser takes a few seconds to get started. Be patient. Also, it does not work with Safari; you must use Chrome to run Virtual Andrew if you want speech input to work.