Skip to content

cornell-cup/cs-reminibot

Repository files navigation

MiniBot Platform

Minibot is a modular robotics kit designed for students from age 6 - 18 developed in partnership with DaVinci Robotics. This repository contains a web app for controlling the Minibot and sample scripts that allow users to run simple algorithms on their Minibot.

This repository is currently in development.

1. Initial Requirements

Please install the following:

Note: Windows users are highly recommended to install on Windows Native rather than Ubuntu WSL.

Click on the links below for Operating System-specific guides on how to install the above dependencies:

Ubuntu 18 Installing Initial Requirements guide

Mac OS Installing Initial Requirements guide

Windows 10 Installing Initial Requirements guide

2. Cloning the respository

Please clone (download) the respository onto your local machine. On Windows open Powershell and run the following command from the directory where you would like the cs-reminibot repository to be located. On Linux or MacOS open the terminal and run the command.

git clone https://github.com/cornell-cup/cs-reminibot.git

3. Installing BaseStation Python Dependencies

Please choose either Anaconda OR Base environment installation.

Anaconda environment package installation (highly recommended for developers)

Anaconda is a Python environment and package manager.

After installing Anaconda, create a new Python 3.8 Anaconda environment named cup with the following command in your shell:

conda create -n cup python=3.8

To activate this environment and install the required Python packages, run the following commands:

conda activate cup
cd basestation
python -m pip install -r requirements.txt

Note: After installing the packages within the Anaconda environment, you must run conda activate cup on a newly opened shell window to activate the environment before starting the GUI. You'll know the environment is activated if the name of the environment (cup) is displayed before the shell prompt. Example of what the Windows Powershell prompt should look like: (cup) C:\Users\YourName

The command to deactivate the current environment and return to the base environment is conda deactivate.

Base environment package installation

Run the following commands to navigate to the basestation directory in and install the Python3 dependencies. On Windows open Windows Powershell and run the following commands. On Linux or MacOS open terminal and run the following commands:

cd basestation
python -m pip install -r requirements.txt
cd ..

4. Installing JavaScript Dependencies

Navigate to the cs-reminibot directory and run the following commands to navigate to the gui directory in static/gui and install the JavaScript dependencies.

cd static/gui
npm install
cd ../..

5. Installing the Vision System

Setting Up Vision System (Windows)

See Vision System Troubleshooting section of this troubleshooting guide for visual steps

  1. Open cs-reminibot directory in File Explorer.
  2. Navigate to the installation_scripts directory.
  3. Right click on the Vision_system_install file.
  4. Select the Open with option from the resulting drop down.
  5. Select the Git for Windows option from the resulting sub-drop down

Setting Up Vision System (MacOS/Linux)

Run the following commands to navigate to the apriltag-py directory in vision/apriltag-py and install JavaScript dependencies. On Linux or MacOS open terminal and run the commands. You should currently be in the cs-reminibot directory

cd vision/apriltag-py
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
sudo make install
cd ../..

6. Running the BaseStation & WebGUI

Setting configuration variables

config.py in the basestation folder contains configuration variables that might vary from user to user. Please refer to this file and set any necessary configurations before running.

Running the app

After all dependencies are successfully installed, you can run the WebGUI on your computer and start working with the Minibot.

From the terminal, navigate to the home cs-reminibot directory and run the following command.

Note: Anaconda users should activate the cup environment before running the GUI.

./run_bs.sh

Wait until you see the message ======= STARTING BASESTATION======== in your terminal. Open Google Chrome and go to localhost:8080/start to see the GUI in action.

Windows users who are having trouble with this step can try installing the python dependencies via Anaconda.

To stop running the program, press Ctrl+C in the terminal window.

7. Starting a virtual Minibot

Many features on the GUI require a connection to a Minibot. In the absence of a physical Minibot, we can simulate a virtual Minibot which can receive commands from the GUI with the following script. Open a new shell and run the following command from the root cs-reminibot directory:

python minibot/minibot.py -t

Note: Anaconda users should activate the cup environment before running the script.

To stop running the program, press Ctrl+C in the terminal window.

8. Running the Vision System

To run the Vision system, run the following command. You should currently be in the cs-reminibot directory.

On Windows

./run_vision.sh

On MacOS/Linux

cd vision/apriltag-py/python
python3 calibrationgui.py
cd ../../..

1a. Operating System-Specific Guides to Install Initial Requirements

Ubuntu 18: Installing Initial Requirements

Git installation

In a terminal run:

sudo apt install git

Python3 installation

Python 3 should already be installed. Run the following command in a terminal and you should see the python interpreter open.

python3

Run quit() in the interpreter to exit out of it.

Pip3 installation

In a terminal run:

sudo apt install python3-pip

Node.js and npm installation

In a terminal run:

sudo apt update
sudo apt install nodejs
sudo apt install npm

Upgrade npm to the lastest version by running:

sudo npm install npm@latest -g

Continue with the remaining installation steps


MacOS: Installing Initial Requirements

Homebrew installation

  1. Press Cmd + Space to open Spotlight Search. Search for Terminal and open it.
  2. Visit brew.sh in your browser to install Homebrew. Copy the command specified in the installation section into your terminal and run it.
  3. After installation is complete, run the following command in your terminal:
brew upgrade

Git installation

In a terminal run:

brew install git

Python3 and Pip3 installation

In a terminal run:

brew install python

Anaconda installation (highly recommended for developers)

Installing Anaconda is highly recommended to simplify management of Python virtual environments and packages.

Follow the instructions to install Anaconda through homebrew found here.

Node.js and npm installation

In a terminal run:

brew install node

Upgrade npm to the lastest version by running:

npm install npm@latest -g

CMake installation

In a terminal run:

brew install cmake

Continue with the remaining installation steps


Windows 10 (Native): Installing Initial Requirements

Git installation

Follow the instructions under Install Git on Windows found here.

Python and Pip installation

Download the official Python distribution found here. This step should install pip automatically.

After proper installation of Python and pip, the following commands should show the installed version, such as Python 3.8.0 and pip 21.2.4 from C:\Users\User\....

python --version
python -m pip --version

Anaconda installation (highly recommended for developers)

Installing Anaconda is recommended to simplify Python version and package management.

Download the official Anaconda distribution found here.

CMake installation

Download and install the official CMake distribution found here.

NodeJS and npm installation

Please follow the official Windows NodeJS and npm installation instructions found here.

Common Problems & Fixes

ImportError: cannot import name 'soft_unicode' from 'markupsafe'

Downgrade markupsafe to version 2.0.1:

python -m pip install markupsafe==2.0.1

ERROR: EACCES when trying to run npm commands

Try running the following command to fix this:

sudo chown -R $(whoami) ~/.npm

And then run your npm command with sudo in front of it if it still doesn't work. For example:

sudo npm install

Please see the Minibot Software Install Troubleshooting Guide for other common installation problems.