Skip to content

Installing Packages

AhmedSamara edited this page Oct 24, 2014 · 11 revisions

This page will describe the packages required to run our code and how to install them.

Note that this wiki currently only supports Linux dev environments. It will eventually be extended to support Macs. We don't intend to support Windows, as it's just too much of a pain.

I'm going to assume you're on a system that uses APT as its package manager (like Debian and derivatives like Ubuntu). The bot runs on a version of Debian modified to better support the BeagleBone Black, which is what drives this convention.

Required Packages

These packages are required for the codebase to function.

Git

Install Git with:

sudo apt-get install git

You'll want to do some basic configuration. There are two easy ways to knock this out. Both end up creating the configuration file ~/.gitconfig. The CLI method creates this file in a series of steps. Manually copying my example and editing the file accomplishes the same task, but the example file includes some nice config that I'm not going to cover how to set via the CLI.

This is an example ~/.gitconfig file. You can copy it to that location and edit it to meet your preferences. You'll at least need to change the name and email.

[user]
    name = Daniel Farrell
    email = [email protected]
[core]
    editor = vim
    autocrlf = input
[color]
    ui = true
[alias]
    logg = log --graph --oneline
[help]
    autocorrect = 1

Alternatively, you can issue the following CLI commands to get the most critical parts of the above config.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

For more info about customizing git, see this very helpful resource.

Python

We're currently using Python 2.7.X for this project. We'll likely want to convert to Python 3.X fairly soon, but this isn't on our shortterm roadmap.

You almost certainly already have Python installed. Check your version:

[~]$ python --version
Python 2.7.5

YAML

YAML ("YAML Ain't Markup Language", recursive lol), is a very readable data serialization format. We use it for various configuration files (for example, config.yaml).

To parse YAML files from Python, you'll need to install python-yaml:

sudo apt-get install python-yaml

SimpleJSON

The SimpleJSON decoder is required for throwing some errors related to JSON parsing of messages passed by ZMQ over the wire.

Install SimpleJSON with:

sudo apt-get install python-simplejson

ZeroMQ

ZMQ is an awesome messaging library that you'll come to love if you've worked with sockets much previously. It basically makes messaging just work as you'd expect. We currently use it to pass messages between the CtrlClient and CtrlServer, as well as between SubClient and PubServer.

Install ZMQ with:

sudo apt-get install libzmq-dev python-zmq

For reasons I'm not going to detail here, we may eventually want to upgrade to very new versions of ZMQ (basically, very cool PUB/SUB features). See this wiki for details.

NumPy

NumPy is a large collection of very efficient math-related libraries for Python.

Install NumPy with:

sudo apt-get install python-numpy

SMBus

SMBus is required for communication with the ADCs consumed by the analog IR arrays. It's also required for other repos, like PyDMCC.

Install it with:

sudo apt-get install python-smbus

If this doesn't work (and it won't for most fedora users_, you may need to install some other dependencies: The development files for libffi:

sudo yum install libffi-devel

cffi:

pip install smbus-cffi

PyPy

virtualenv

Virtual Environment is used to install required libs to, like jschornick/i2c_device and IEEERobotics/DMCC_Library. See this wiki section for more details.

Install virtualenv with:

sudo apt-get install python-virtualenv

Suggested Packages

tmux

This isn't required, but it allows you to work with multiple terminal panes (amongst other things) which comes in handy.

On fedora enter:

sudo yum install tmux

on ubuntu:

sudo apt-get install tmux

RSYNC

Fedora:

sudo yum install rsync

There's a lot that can be done with this, but for our purposes, it'll be used to put code onto the bot. Once you have your dev environment set up, you can use the following command format to to put the code onto the bot.

rsync file_to_be_edited.ext [email protected]:/path/to/file

for example:

rsync follower.py [email protected]:/root/bot/follower/

Sphinx

Sphinx is a program used to automatically generate clean and readable documentation.

To install: fedora:

sudo yum install sphinx

Ubuntu:

sudo apt-get install python-sphinx

This is what was used to create the official Python documentation website. Once installed, you can run the following command from the root directory to generate the documentation. Read through it to get familiar with the codebase.

./scripts/build_docs.sh