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
If Python is not installed then run these commands:
sudo apt update
sudo apt install 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
- Make a directory to hold your Cognitive Robotics work, e.g., ~/CogRob
- cd into the directory you made.
- Clone the vex-aim-tools repository by running this command:
git clone https://github.com/touretzkyds/vex-aim-tools
- Create a Python virtual environment by running this command:
python3 -m venv env
- Activate the virtual environment by running this command:
source ./env/bin/activate
- Install the required packages by running this command:
pip install -r vex-aim-tools/requirements-linux.txt
- 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.
- 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 PATH=$PATH:~/CogRob/vex-aim-tools
export ROBOT=AIM-xxxxxxx.wifi.local.cmu.edu
- 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 ./env/bin/activate
simple_cli
MacOS
Older Macs may be able to run simple_cli, but since Apple dropped
support for OpenGL some time ago, PyOpenGL does not work on new Apple
Silicon. If you have an Intel Mac, try these steps:
First, install Python. Some people use brew or anaconda for this.
For the remaining steps, follow the instructions for Ubuntu, except:
- Start by doing "brew install freeglut"
- Edit ~/.zshrc instead of ~/.bashrc
- Use requirements-macos.txt instead of requirements-linux.txt
Windows
Python installation
You can use any version of Python from 3.8 up. If you don't already
have Python installed on your machine, then follow these steps:
- Download a Python installer from the official website:
https://www.python.org/downloads/windows/
- Run the installer and follow the instructions. Make sure to check the box that says "Add Python to PATH".
- Verify the installation by opening Command Prompt and running this command:
python --version
Git installation
- Download the Git installer from the official
website: https://git-scm.com/download/win
- Run the installer and follow the instructions. Make sure to check
the box that says "Git Bash Here".
- Verify the installation by opening Command Prompt and running this command:
git --version
Setting up the environment
- Make a folder to hold your Cognitive Robotics work, e.g.,
C:\Users\myuserid\CogRob
- cd into the CogRob folder you made.
- Clone the vex-aim-tools repository by running this command:
git clone https://github.com/touretzkyds/vex-aim-tools
- Create a Python virtual environment by running this command:
python -m venv env
- Activate the virtual environment by running this command:
.\env\Scripts\activate
- Install the required packages by running this command:
pip install -r vex-aim-tools\requirements-windows.txt
- 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.
Setting up environment variables
- Search for "Environment Variables" in the Windows search bar and click
on "Edit the system environment variables".
- Click on the "Environment Variables" button.
- Under "System variables", click on "New" and add the following variables:
Variable name: GOOGLE_APPLICATION_CREDENTIALS
Variable value: C:\Users\myuserid\CogRob\cogrob-google-cloud.json
Variable name: OPENAI_API_KEY
Variable value: (the API key you received in email, beginning with "sk")
Variable name: ROBOT
Variable value: AIM-xxxxxxxx.wifi.local.cmu.edu
- Select the PATH variable and edit it to add the path to the simple_cli script:
Variable name: PATH
Value to add: C:\Users\myuserid\CogRob\vex-aim-tools
- Click "OK" to save your changes to the environment variables.
- To verify the installation, 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
Command Prompt and use these commands:
cd C:\Users\myuserid\CogRob
.\env\Scripts\activate
python 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".
- Make a folder called CogRob on your desktop to hold your Cognitive Robotics work.
- Open Google Chrome within Virtual Andrew. (Yes, you're running a browser within a browser.)
- Download the
file vex-aim-tools.zip
from the course web site.
- Open Windows File Explorer, and move the file from your Downloads folder to your Desktop\CogRob folder.
- Navigate to your CogRob folder, right click on
vex-aim-tools.zip, and choose "Extract all", then click the Extract
button.
- Go to your desktop, right click on the CogRob folder, and
select "Open in Terminal". This opens a Powershell terminal window.
- Type "dir" in the terminal window. You should see your
vex-aim-tools folder. Make note of your current directory path as
shown by dir.
- If you don't already have one, create a Powershell Profile by typing the following command in the terminal:
New-Item -ItemType File -Path $PROFILE -Force
- Edit your profile by typing:
notepad $PROFILE
- Insert the following lines into your profile, changing the path to match yours:
function prompt { $(Split-Path -Path $pwd -Leaf) + "> " }
function simple_cli { param ($file) python \\andrew.ad.cmu.edu\users\users14\dst\Desktop\CogRob\vex-aim-tools\simple_cli $file }
function genfsm { param ($file) python \\andrew.ad.cmu.edu\users\users14\dst\Desktop\CogRob\vex-aim-tools\genfsm $file }
$env:PYTHONPATH = "\\andrew.ad.cmu.edu\users\users14\dst\Desktop\CogRob\vex-aim-tools"
$env:ROBOT = "AIM-xxxxxxxx.wifi.local.cmu.edu"
$env:OPENAI_API_KEY = "the API key you received in email, beginning with sk"
$env:GOOGLE_APPLICATION_CREDENTIALS = "\\andrew.ad.cmu.edu\users\users14\dst\Desktop\CogRob\cogrob-google-cloud.json"
- Activate your profile by typing "powershell $PROFILE".
- Create a Python virtual environment by typing the following command:
python -m venv env1
- Activate the virtual environment by typing:
.\env1\Scripts\activate
- cd into your vex-aim-tools folder.
- Install required software modules by typing the following command:
pip install -r requirements-windows.txt
- Download the cogrob-google-cloud.json file you received in email and move it
into your Desktop\CogRob folder.
- Type "notepad" in the terminal and enter the following lines:
.\env1\Scripts\activate
- Save the file as "setup.ps1" in your Desktop\CogRob folder.
Using Your Virtual Andrew Installation
To run simple_cli in a fresh Virtual Andrew session, do the following:
- Connect to Virtual Andrew.
- Right-click on the CogRob folder on your desktop and select "Open in Terminal".
- Make sure your robot number matches the number in your $PROFILE file.
- In the PowerShell window, type the following:
.\setup.ps1
- Now, whenever you want to run the robot do:
simple_cli
- The robot is slow to connect over Virtual Andrew, so simple_cli
will likely fail with a "no image was received" message. Just run start_robot.ps1
several more times and eventually the system will catch up with the robot.
- Speech input from the browser also 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.
|