chalmers-revere / opendlv

OpenDLV - A modern microservice-based software ecosystem powered by libcluon to make vehicles autonomous.
http://opendlv.org
GNU General Public License v3.0
80 stars 16 forks source link
aarch64 amd64 applanix armhf autonomous-driving cpp14 docker gps h264 libcluon lidar microservice nmea opendlv openh264 oxts-gps self-driving-car trimble-gps velodyne video4linux

Moved to https://git.opendlv.org.

OpenDLV has moved to its own GitLab environment at git.opendlv.org/explore. Tutorials were also added att opendlv.org/learn.html.

OpenDLV - A modern microservice-based software ecosystem for self-driving vehicles.

OpenDLV is a modern open source software environment to support the development and testing of self-driving vehicles driven by the following design principles:

Table of Contents

What is an OpenDLV session?

Applications based on OpenDLV are grouped in UDP multicast sessions belonging to IPv4 address 225.0.0.X, where X is from the within the range [1,254]. All microservices belonging to the same UDP multicast group are able to communicate with each other; thus, two applications running in different UDP multicast sessions do not see each other and are completely separated.

The actual UDP multicast session is selected using the commandline parameter --cid=111, where 111 would define the UDP multicast address 225.0.0.111. Microservices exchange data using the message Envelope that contains besides the actual message to send further meta information like sent and received timestamp and the point in time when the contained message was actually sampled. All messages are encoded in Google's Protobuf data format (example) that has been adjusted to preserve forwards and backwards compatibility using libcluon's native implementation of Protobuf.

An Envelope contains in its field serializedData the actually message to be exchanged that is encoded in Protobuf. Furthermore, the Envelope itself is also encoded in Protobuf but prepended with the byte sequence 0x0D 0xA4 as magic number, followed by three bytes 0xXX 0xYY 0xZZ describing the length in bytes of the Protobuf-encoded Envelope. The sequence 0xA4 0xXX 0xYY 0xZZ is encoded in little endian and 0xZZ is usually 0 in practice.

As participants in a UDP multicast session automatically receive any exchanged Envelopes, a receiver can differentiate what message to expect by checking Envelope's field dataType, which is referring to a message identifier (for instance, Envelope's message identifier is 1).

OpenDLV's microservices conform to the OpenDLV Standard Message Set that enables exchangeability across hardware/software interfaces to decouple high-level application logic from low-level device drivers. For instance, OpenDLV's hardware/software interface to access an Applanix GPS unit is called opendlv-device-gps-pos according to Applanix' internal data format POS that is used across several units in their product portfolio. The microservice opendlv-device-gps-pos provides GPS information in messages GeodeticWgs84Reading and GeodeticHeadingReading.

As the microservices for the various GPS units (like, for instance Trimble and Applanix) all broadcast the aforementioned messages, the hardware units can be exchanged transparently for the high-level application logic. However, when several GPS units shall be operated in parallel, it is necessary to distinguish between them. Therefore, the commandline parameter --id=Y can be provided, where Y is a positive number to differentiate between messages of the same type. At the receiving end, the value Y is made available in Envelope's field senderStamp. As an example, when using an Applanix unit next to a Trimble unit, the respective microservices could be supplied with the suffixes --id=1 and --id=2.

Dependencies

You need a C++14-compliant compiler to compile this project as it ships the following dependencies as part of the source distribution:

For building cluon-rec2fuse, libfuse is required.

Usage

We are providing the following microservices as multi-platform (amd64/x86_64, armhf, aarch64) Docker images:

OpenDLV.OS

Complete ArchLinux-based OpenDLV OS Operating System (start here if you want to initialize a blank computing unit - WARNING! All data will be erased!)

Hardware/Software Interfaces:


Gamepad (such as PS3 or PS4 controllers): opendlv-device-gamepad Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64) Build Status

Applanix POS GPS/INSS units: opendlv-device-gps-pos Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64) Build Status

Velodyne HDL32e lidar units: opendlv-device-lidar-hdl32e Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64) Build Status

SRF08 devices connected via I2C bus: opendlv-device-ultrasonic-srf08 Docker (multi) Docker (amd64) Docker (armhf)

OpenDLV contains a highly modular and easy-to-use framework to grab video frames from various cameras, share them via shared memory, and encode/decode them into h264 frames to broadcast into an OD4Session for OpenDLV. The microservices are divided into video sources (e.g., opendlv-device-camera-v4l, opendlv-device-camera-opencv, opendlv-device-camera-ueye), or opendlv-device-camera-rpi) and video sinks (e.g., opendlv-video-h264-encoder) to process incoming video frames. Video sinks provide frames in two image formats: I420-encoded image and ARGB. The former format can be directly used for video compression (e.g., h264 encoding), while the latter can be directly used for image detection algorithms (opendlv-examples).

Video4Linux cameras (e.g., /dev/video0): opendlv-device-camera-v4l Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64) Build Status

opendlv-video-h264-decoder to decode h264 video frames from an ImageReading (OpenDLV Standard Message Set v0.9.6) into a shared memory (OpenH264 Video Codec provided by Cisco Systems, Inc.):

opendlv-video-x264-encoder to encode video frames from a shared memory into h264 frames as ImageReading (OpenDLV Standard Message Set v0.9.6):

opendlv-video-vpx-encoder to encode video frames from a shared memory into VP8 or VP9 frames as ImageReading (OpenDLV Standard Message Set v0.9.6): opendlv-video-vpx-encoder Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64)

opendlv-video-vpx-decoder to decode h264 video frames from an ImageReading (OpenDLV Standard Message Set v0.9.6) into a shared memory: opendlv-video-vpx-decoder Docker (multi) Docker (amd64) Docker (armhf) Docker (aarch64)


Data Post Processing:

rec2csv-png to extract messages as .csv and h264 frames as separate .png files from a .rec file from a recorded OpenDLV session (OpenH264 Video Codec provided by Cisco Systems, Inc.):

cluon-rec2fuse to mount a recording file to a folder and dynamically map its content as .csv files:

  docker run --rm -ti -v $PWD/myrecording.rec:/opt/input.rec \
                    -v $PWD/opendlv.odvd:/opt/odvd \
                    -v $PWD/mnt:/opt/output:shared \
                    --cap-add SYS_ADMIN \
                    --cap-add MKNOD \
                    --security-opt apparmor:unconfined \
                    --device=/dev/fuse \
                    -v /etc/passwd:/etc/passwd:ro \
                    -v /etc/group:/etc/group \
                    chrberger/cluon-rec2fuse-amd64:v0.0.104 \
                    /bin/sh -c "chown $UID:$UID /opt/output && \
                    su -s /bin/sh $USER -c 'cluon-rec2fuse --rec=/opt/input.rec --odvd=/opt/odvd -f /opt/output' \
                    && tail -f /dev/null"

Visualizations:

cluon-livefeed to display any messages exchanged in the communication session 111 on console: docker run --rm -ti --init --net=host chrberger/cluon-livefeed-multi:v0.0.122 --cid=111

opendlv-signal-viewer to view any messages from the OpenDLV Standard Message Set exchanged in the communication session 111 (after starting this microservice, point your web-browser to the computer's IP address, port 8080): docker run --rm --net=host -p 8080:8080 chalmersrevere/opendlv-signal-viewer-multi:v0.0.8 --cid=111

version: '2' # Must be present exactly once at the beginning of the docker-compose.yml file
services:    # Must be present exactly once at the beginning of the docker-compose.yml file
    signal-viewer:
        container_name: signal-viewer
        image: chalmersrevere/opendlv-signal-viewer-multi:v0.0.8
        restart: on-failure
        network_mode: "host"
        ports:
        - "8080:8080"
        command: "--cid=111"

screenshot from signal viewer

opendlv-vehicle-view to view vehicle messages from the OpenDLV Standard Message Set exchanged in the communication session 111 (after starting this microservice, point your web-browser to the computer's IP address, port 8081): docker run --rm --net=host --name=opendlv-vehicle-view -v ~/recordings:/opt/vehicle-view/recordings -v /var/run/docker.sock:/var/run/docker.sock -p 8081:8081 chalmersrevere/opendlv-vehicle-view-multi:v0.0.60

version: '2' # Must be present exactly once at the beginning of the docker-compose.yml file
services:    # Must be present exactly once at the beginning of the docker-compose.yml file
    vehicle-view:
        container_name: opendlv-vehicle-view
        image: chalmersrevere/opendlv-vehicle-view-multi:v0.0.60
        restart: on-failure
        network_mode: "host"
        volumes:
        - ~/recordings:/opt/vehicle-view/recordings
        - /var/run/docker.sock:/var/run/docker.sock
        ports:
        - "8081:8081"

screenshot from vehicle view

Build from sources on the example of Ubuntu 16.04 LTS

To build this software, you need cmake, C++14 or newer, and make. Having these preconditions, update the contained submodules first.

git submodule update --init --recursive
git submodule update --remote --merge
git submodule status

Now, you can change into the various sub-folders and run cmake and make as follows:

mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release ..
make && make test && make install

License

Publications

The following list contains publications related to the OpenDLV Software Ecosystem: