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/. firstname.lastname@example.org:/solo/path/.
These are the requirements for setting up Smart to work with our package repositories.
solo wifi. This will be needed to download the package lists.
solo install-smartto install and download the package repository list.
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.
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.
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__" 188.8.131.52
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:
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
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:
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.
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:
This creates an environment in the local
env/ directory. To "activate" this environment, run this command:
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.