Build & Run the Camera Manager
This topic explains how to setup and run the Dronecode Camera Manager (DCM) on a Linux computer.
The build system follows a typical configure > build > install cycle. The configuration step allows you enable/disable specific features in the build, thereby choosing the combination of features that best-fit your requirements.
We recommend you read this topic as it fully explains the build process. The Quickstart topics (see sidebar) provide additional instructions for setting up common configurations.
The DCM can be configured to enable/disable specific functionality at compile-time. As a result, some dependencies are only required in order to use specific features.
The following packages are needed to compile the DCM with core functionality (RTSP streaming and MAVLink support):
- Autoconf and libtool (for build configuration)
- GCC/G++ compiler 4.9 or newer
- C and C++ standard libraries
- GLib 2.42 or newer
- GStreamer 1.4 or newer
- GStreamer RTSP Server 1.4 or newer
- Python 2
Optional packages include:
- Avahi 0.6 to enable publishing what RTSP streams are available.
- RealSense to support the Intel RealSense 3D Camera.
- Gazebo in order to enable a simulated camera within the Gazebo environment.
Installing Prerequisites on Ubuntu
The following sections show how to install the required packages on Ubuntu 16.04 LTS.
The core dependencies are required to build DCM with MAVLink and RTSP video streaming support.
sudo apt-get update -y sudo apt-get install git autoconf libtool python-pip -y sudo apt-get install gstreamer-1.0 \ libgstreamer-plugins-base1.0-dev \ libgstrtspserver-1.0-dev -y # Required python packages sudo pip2 -q install -U future
GCC 5.4 and the C/C++ standard libraries are installed by default.
Run the following command to get the Avahi dependencies:
sudo apt-get install libavahi-client-dev libavahi-core-dev libavahi-glib-dev -y
RealSense 3D Camera
Run the following command to get the RealSense SDK 1 libraries:
echo 'deb "http://realsense-alm-public.s3.amazonaws.com/apt-repo" xenial main' | sudo tee /etc/apt/sources.list.d/realsense-latest.list sudo apt-key adv --keyserver keys.gnupg.net --recv-key D6FB2970 sudo apt update -y sudo apt-get install librealsense-dev -y
The RealSense 2 SDK is not supported.
The DCM only has access to this camera when it is not being used for optical flow or VIO.
The easiest way to set up Gazebo and the PX4 simulator to use the PX4 Developer Guide scripts: Development Environment on Linux > jMAVSim/Gazebo Simulation.
Get the Source Code
Clone the camera-manager repo (or your fork):
git clone https://github.com/Dronecode/camera-manager.git cd camera-manager git submodule update --init --recursive
This fetches all the sources for the project (including the MAVLink C library submodule, which is generated by the build system during compilation).
Alternatively you can do this in one line:
git clone https://github.com/Dronecode/camera-manager.git --recursive
Serve Camera Definition Files
Before running the Camera Manager with MAVLink enabled on Ubuntu, you should start serving the sample Camera Definition Files:
- Open a new terminal to /samples/def
- Enter the following command to start the server on the default port (8000):
python -m SimpleHTTPServer
The Camera Definition Files is only needed if you are running DCM with MAVLink enabled.
Here we chose to serve the the file from Ubuntu. In fact, the file can be hosted anywhere that is accessible to clients (e.g. QGroundControl, Dronecode SDK), provided you update the DCM Configuration File with its URI. For more information see Camera Definition Files.
Configuration allows you to specify the features that will be included when DCM is compiled (this step need only be done once).
The full configuration syntax is given below:
./autogen.sh && ./configure [--enable-mavlink] [--enable-aero] [--enable-avahi] [--enable-gazebo]
The optional configuration options enable specific functionality at compile-time:
--enable-aero: Enables aero-specific bottom bottom facing VGA camera (OV7251 sensor for optical flow/VIO).
--enable-realsense: Enables Intel RealSense 3D Camera.
--enable-avahi: Enables Avahi to advertise the list of available RTSP streams.
--enable-mavlink: Enables MAVLink Camera Protocol support.
--enable-gazebo: Enables Gazebo camera.
In addition, DCM generates the file dronecode-camera-manager.service by default (see Auto-start DCM). File generation can be disabled/configured using:
--disable-systemd: Disable systemd support (i.e. on systems where systemd is not present).
--with-systemdsystemunitdir <path>: Set the systemd system directory to
<path>(Default is taken from pkg-config).
The configuration step will fail gracefully if any dependency required by the specified configuration is not available. At the end of the configuration process the system will output a report showing what additional features are enabled:
RealSense support: yes MAVLink support: yes AVAHI support: no Intel Aero support: no Gazebo support: no
After configuration, build the camera manager using make:
The dcm executable will be created in the root of your DCM source tree (along with the Intel Aero DCM startup file: dronecode-camera-manager.service).
The line below shows how to start DCM, specifying a DCM Configuration File (in this case the Ubuntu .conf file in the source tree):
./dcm -c samples/config/ubuntu.conf
The samples/config directory contains sample configuration files that you can use to set up the DCM for use on Ubuntu, Aero and other platforms. To use a sample file, copy it to /etc/dcm/main.conf, specify it in the
DCM_CONF_FILEenvironment variable, or set the
-cswitch when starting the DCM.
Other command line options can be displayed using the
$ ./dcm -h dcm [OPTIONS...] -c --conf-file .conf file with configurations for dronecode-camera-manager. -d --conf-dir <dir> Directory where to look for .conf files overriding default conf file. -g --debug-log-level <level> Set debug log level. Levels are <error|warning|notice|info|debug> -v --verbose Verbose. Same as --debug-log-level=debug -h --help Print this message
After installing dcm, use the Sanity Tests to verify that DCN is working correctly.