Solo Development Guide

Installing Files and Code

Uploading Files

rsync is the preferred tool for synchronizing code and files between your desktop and Solo. To copy a file from the local filesystem to Solo:

rsync -avz local/file/path/. root@10.1.1.10:/solo/path/.

Installing Packages

Solo is an rpm based system. These packages can be managed by the Smart Package Manager (Smart), already installed on your Solo.

These are the requirements for setting up Smart to work with our package repositories.

This command is only needed to be run once. From now on, Solo can download packages when an Internet connection is enabled.

When logged into Solo's terminal, you can explore some of the features of Smart:

  • smart install <packagename> will download and install a package from the repository.
  • smart search <text> will search for packages matching a given string.

You will see these commands used throughout this guide. These packages are pre-compiled and provided by 3DR for your use. To compile other packages may require rebuilding via our Yocto Linux distribution.

Working with Python

Python 2.7 is used throughout our system and in many of our examples. There are a few ways in which you can deploy Python code to Solo.

Installing Python packages using Smart

Some Python libraries are provided by Solo's internal package manager. For example, opencv can be installed via Smart, which provides its own Python library. After running:

smart install python-opencv

You can see its Python library is installed:

$ python -c "import cv2; print cv2.__version__"
2.4.6.1

Installing packages directly with pip

You can install code directly from pip on Solo.

Having installed Solo CLI on your PC, you can initialize pip to work on Solo by running:

solo install-pip

This will install and update pip to the latest version. After SSHing into Solo, you can then install packages directly:

pip install requests

We also recommend that you install git, as this will be needed to get many of the examples:

smart install git

Installing packages using the Solo client

The recommended way of working with Python and DroneKit-Python is to use the Solo CLI to package and run the script in a virtual environment.

The CLI takes care of packaging all the scripts in your current folder:

solo script pack

The command also packages any dependencies listed in the folder's requirements.txt file. A minimal requirements.txt for a dronekit app will look like this:

dronekit>=2.0.0

You can then transfer the package to Solo, install it, and run it using the command:

solo script run yourscriptname.py

For more information and examples see DroneKit:Deploying scripts to Solo, Solo CLI:Deploying and Running DroneKit Scripts on Solo and Example:Hello World.

Installing packages into a virtualenv

The solo client is the easiest way to bundle and run a Python app into a virtual environment. It is however possible to manually perform the same tasks using virtualenv.

On Linux and Mac OS X, first install virtualenv on Solo using pip:

pip install virtualenv

Next, create (or navigate to) the directory in which your Python code will be run. Run the following command:

virtualenv env

This creates an environment in the local env/ directory. To "activate" this environment, run this command:

source ./env/bin/activate

You will notice your shell prompt changes to read (env)root@3dr_solo:, indicating that you are working in a virtualenv.

Now all commands you run from your shell, including launching scripts and installing packages, will only affect this local environment. For example, you can now install a different version of dronekit without impacting the global version:

pip install dronekit

The instructions for Windows are similar. The advanced topic Python bundles shows this process in more detail.