Getting Started With OttoFly¶
This section provides all information you need about unpackaging the hardware and installing Ardupilot and the SKD on the board.
Installing OttoFly on Ubuntu¶
OttoFly was designed to be installed on a PC running Ubuntu (or linux systems in general). You write your program and compile it on the PC running Ubuntu. You can also test it directly on the simulator. After that, you move the binaries to the drone and run them there.
OttoFly is shipped in three different ways up to your needs:
- As a shared C++ library (with CMake package option): This is the basic package of OttoFly where it is shipped as a standalone shared library where all-dependencies were solved internally.
- As a static C++ library (with CMake package option): This is the advance package of OttoFly where it is shipped as static library and solving the dependencies is left to the developer. You need to deal with Boost, OpenCV, RealSense, RLM… However, this gives you more options about the versions of those libraries. It is helpful also when you want to use those libraries directly in your code.
- As Source code with CMake support: In this package, you receive the source code with CMake Support. This package gives you the ultimate level of configuration, customization, and reusability. However, shipping OttoFly as source code will require signing an NDA and possibly other legal agreements.
In this tutorial, you will learn how to write your first program with OttoFly. The instructions provided in the tutorial apply to the basic OttoFly package.
Installing the dependencies¶
Before we start, you will need to follow those steps:
- Execute the following commands in terminal:
sudo apt-get update sudo apt-get upgrade
- Install GCC if not already installed on your computer. We are using GCC 4.9 as the default compiler. If you want to use another version (or another compiler), please make sure that you have requested a compatible OttoFly package:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 g++-4.9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
gcc (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Install CMake and CMake-GUI if they are not already installed on your computer:
sudo apt-get install cmake sudo apt install cmake-gui
- Install Unzip to unpack zipped files. You may also use a different tool that you prefer if you have the tool installed already:
sudo apt-get install unzip
- Unpack the folder sent to you by OttoFly. The folder should have a name like OttoFly_1.0_GCC_4.9.zip. Use this command to unpack the folder:
sudo unzip OttoFly_1.0_GCC_4.9
- The unpacked folder should look like:
- To install the library into your system, run the install.sh script:
cd OttoFly_1.0_GCC_4.9/ sudo sh install.sh
The library is now installed on your machine as a CMake package.
Building the first example¶
- Run CMake GUI using the following command:
After the command executes, you should see the following screen:
- Fill in the information needed for “where is the source code” and “where to build the binaries” as shown in the following screen. If you changed your paths during installation, use the paths you selected in these two boxes.
- Click Configure and follow the steps shown in the following screens:
- Make sure that the CMake has found the OttoFly path:
- Check BUILD_WITH_AUTONOMOUS and BUILD_WITH_REALSENSE flags for autonomous system and realsense support, respectively, if you wish to work with these systems.
- Click Generate:
- Go to the folder Example/_build and execute the make command:
- After executing the command, you will find this binary has been added:
You have built your first example of a drone controlling program using OttoFly!
Running the first example¶
The first step consists of putting all of the files needed for the program together. The needed files include the executable, the configuration file and the activate tool.
- Go to library directory (the package you unzipped before) and create a new folder called OttoFlyFirstProgram:
sudo mkdir OttoFlyFirstProgram
- Move the previously mentioned files using those commands:
sudo cp example/_build/OttoflyDemo OttoFlyFirstProgram/ sudo cp resources/config.json OttoFlyFirstProgram/ sudo cp activation/OttoFlyActivation OttoFlyFirstProgram/
Your program is now ready to be sent to the drone or to be tested on the simulator on your PC.
Running the Program on the PC¶
First, please make sure that you have set up and run the simulator.
- Go the folder OttoFlyFirstProgram and execute:
- You should get an error message saying that your version is not licensed:
Error checking out OTTOFly license No license for product (-1) Not Licensed! Finished
- In order to activate your licenses, you must be connected to the internet. Once you have established an internet connection, execute the following command:
- After executing the command, you should get this message. Type ‘y’ and press enter:
- On the next screen, you will be asked for the activation key:
- Input the Activation Key which has been sent to you via e-mail. It should look similar to this format:
- The activation process should take a few seconds (up to 1 minute maximum in the case of a slow internet connection). After the activation process completes, you should see a screen like:
- You have activated your license successfully. (If something went wrong please call OttoFly support with the full error message).
- Execute the following command:
Your example should start now. You can observe the simulator to see the execution.
OttoFly with Intel Aero¶
Running the program on the drone requires almost the same steps. However, you will first need to send the folder OttoFlyFirstProgram to the drone. After sending the folder to the drone, make sure that the drone is connected to the internet and execute the same steps as described above for running the program on the PC:
- First, you must transfer OttoFlyFirstProgram.zip to the Intel RTF either by flash memory or using SSH commands over the network. To send the file via the network, first switch the drone to Access point (hotspot) mode. (You can find here the steps). Then connect to the new network that appears – the default name for the network starts with Aero-XXXXXX.
- The default IP address for the Intel RTF is 192.168.8.1 and you can check whether or not the connection succeeded using the ping command.
- To send the OttoFlyFirstProgram.zip file to Intel RTF, first navigate to the path containing the file (for example go to desktop if the file is located in desktop), then execute the following command:
sudo scp -r OttoFlyFirstProgram.zip email@example.com:/home
"home": represents the destination path for the file in Intel RTF. "firstname.lastname@example.org": represents the default username and IP.
- At the point, the file is now located in the path /home in Intel RTF. To start using OttoFly on Intel Aero:
- Disable hotspot mode and and join a wifi network with Internet access so that you can activate OttoFly (here you can find the steps).
- To check the internet connection execute the following command:
- Go to the path where OttoFlyFirstProgram.zip exists and unzip the file using the following commands:
Cd /home Unzip OttoFlyFirstProgram.zip Cd OttoFlyFirstProgram
- Copy the libOttoFly.so.1 library into a specific path so that the program can find it (this step should be done only once).To copy the file, execute the following command in OttoFlyFirstProgram folder:
Sudo cp -r libOttoFly.so.1 /usr/local/lib
- To activate OttoFly, follow the same steps for activating OttoFly on Ubuntu PC.
OttoFly with Nvidia TX1,TX2¶
Nvidia Jetson TX1/TX2 runs ubuntu so you can follow the same steps for ubuntu installation.