-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Dockerfile and instructions on how to build it and how to use it
Signed-off-by: jparisu <[email protected]>
- Loading branch information
jparisu
committed
Jan 23, 2023
1 parent
e6519c9
commit 922dfed
Showing
8 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
######################################################################################### | ||
# DDS Recorder Demos Dockerfile | ||
######################################################################################### | ||
|
||
FROM ubuntu:jammy | ||
|
||
# Avoids using interactions during building | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Use a bash shell so it is possigle to run things like `source` (required for colcon builds) | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Avoid interactuation with installation of some package that needs the locale. | ||
ENV TZ=Europe/Madrid | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
################################ | ||
# Download system dependencies # | ||
################################ | ||
RUN apt update && \ | ||
apt install -y cmake g++ pip wget git && \ | ||
apt install -y libasio-dev libtinyxml2-dev && \ | ||
apt install -y libssl-dev && \ | ||
apt install -y libyaml-cpp-dev liblz4-dev libzstd-dev && \ | ||
pip3 install -U colcon-common-extensions vcstool | ||
|
||
########################### | ||
# Download eProsima repos # | ||
########################### | ||
# Download all dependencies for dds recorder (except the recorder) | ||
RUN mkdir -p /home/recorder/src | ||
COPY recorder.repos /home/recorder/recorder.repos | ||
RUN cd /home/recorder && \ | ||
vcs import src < recorder.repos | ||
# Copy DDS Recorder private repo | ||
COPY ddsrecorder /home/recorder/src | ||
|
||
######################## | ||
# Build eProsima repos # | ||
######################## | ||
RUN cd /home/recorder && \ | ||
colcon build --cmake-args "-DCOMPILE_EXAMPLES=ON" | ||
|
||
################# | ||
# Add resources # | ||
################# | ||
COPY resources/ /home/configurations | ||
|
||
# Source built workspace | ||
RUN echo "source /home/recorder/install/setup.bash" >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# eProsima DDS Recorder docker Image | ||
|
||
This image is installed with a DDS Recorder Prototype that is able to run a `DDS Recorder` application | ||
Fast DDS, DDS Recorder and all dependencies are already installed in the image. | ||
In order to run the image use the following command. | ||
|
||
--- | ||
|
||
## DDS Recorder Tool | ||
|
||
This tool is a CLI tool with several arguments and configured by a `.yaml` file. | ||
This tool subscribes to allowed DDS Topics and record the data received in a `.mcap` file. | ||
The schemas to deserialize this data in FoxGlove are also written in the `.mcap` file in `.msg` ROS 2 format. | ||
Those schemas are generated when the tool has access to the Type Object or Type Identifier of the Data Type used. | ||
|
||
### How to retrieve Data Type to the tool | ||
|
||
Fast DDS does not send the Data Type information by default, it must be configured to do so. | ||
First of all, when generating the Types using Fast DDS Gen, it must be added the option `-typeobject` in order to generate the needed code to fill the TypeObject data. | ||
|
||
For native types (Data Types that does not rely in other Data Types) this is enough, as Fast DDS will send the TypeObject by default. | ||
However, for more complex types, it is required to use `TypeInformation` mechanism. | ||
In the Fast DDS `DomainParticipant` set the following QoS in order to send this information: | ||
|
||
```cpp | ||
DomainParticipantQos pqos; | ||
pqos.wire_protocol().builtin.typelookup_config.use_server = true; | ||
``` | ||
|
||
--- | ||
|
||
## Run DDS Recorder | ||
|
||
There are some configurations already available in the container under directory `/home/configurations/` | ||
|
||
- `simple_configuration.yaml` Configuration with just the basics to run the executable. | ||
- `complete_configuration.yaml` Configuration with all the possible configurations available. | ||
- `share_configuration.yaml` Ccondifureonfiguration to store the result files in a shared volume directory. | ||
|
||
In order to execute the `DDS Recorder` use the following command: | ||
> `ddsrecorder --config-path configurations/<configuration>.yaml` | ||
In order to know all the possible arguments supported by this tool, use the command: | ||
> `ddsrecorder --help` or `ddsrecorder -h` | ||
In order to see further information and debugging info about what the tool is executing, use the argument `--debug`: | ||
> `ddsrecorder --config-path configurations/<configuration>.yaml --debug` | ||
### Use Custom Configurations | ||
|
||
There are 2 ways to write a custom configuration: | ||
|
||
1. Using a text editor (e.g. nano) inside the container and modifying a `.yaml` file. | ||
2. Using Docker volumes and adding a `.yaml` file inside a container when running it. | ||
|
||
### Run with shared volume | ||
|
||
In order to automatically retrieve every `.mcap` file generated inside the container, use a docker volume. | ||
First, have a folder `share_volume` in your current workspace (if not in this workspace, add the absolute path in the docjer call). | ||
Then run the following command: | ||
> `docker run --rm --interactive -t --workdir /home --net=host --volume $(PWD)/share_volume/:/home/share_volume ddsrecorder:figure` | ||
Once inside the docker, using configuration `share_configuration` the `.mcap` result files will be stored in the `share_volume` directory inside the container, and thus they will be accessible from the host. | ||
|
||
Launch the `DDS Recorder` with the following command | ||
> `ddsrecorder --config-path configurations/share_configuration.yaml` | ||
--- | ||
|
||
## Configuration | ||
|
||
This first version does support the following configurations: | ||
|
||
| | Description | Type | Default | | ||
|---------------|-------------------------------------------------------------|----------------|-----------| | ||
| allowlist | List of topics that are going to be recorded | List of topics | Empty | | ||
| blocklist | List of topics that are **not** going to be recorded | List of topics | Empty | | ||
| domain | DDS Domain to discover and subscribe to topics allowed | integer | 0 | | ||
| extension | File extension for the result file | string | .mcap | | ||
| filename | File name for the result file | string | MANDATORY | | ||
| path | Path to result file | string | ./ | | ||
| use-timestamp | Whether to add or not the timestamp to the result file name | bool | true | | ||
|
||
The topics in `allowlist` and `blocklist` are filled with elements with field `name` referring to the Topic name. | ||
Optionally each element can have the element `type` referring to the Topic Data Type name. | ||
Both name and allow wildcards (`*`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Instructions to build the Docker image | ||
|
||
## Branches | ||
|
||
- Fast DDS (``) | ||
- Modify `recorder.repos` file | ||
- IntrospectionExample + DynamicTypes fixes : `experimental/filthy/complex-dynamic-data` | ||
- dev-utils | ||
- Modify `recorder.repos` file | ||
- Tree + File + TimeToString : `feature/time_to_string` | ||
- DDS Recorder | ||
- Checkout in `ddsrecorder` directory | ||
- Requires access to private repository | ||
- Tool : `feature/tool` | ||
|
||
## Commands | ||
|
||
Before building the Dockerfile, the DDS Recorder directory must be in directory `./ddsrecorder` | ||
|
||
```sh | ||
# Build docker image | ||
docker build --rm -t ddsrecorder:figure -f Dockerfile . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
repositories: | ||
foonathan_memory_vendor: | ||
type: git | ||
url: https://github.com/eProsima/foonathan_memory_vendor.git | ||
version: master | ||
fastcdr: | ||
type: git | ||
url: https://github.com/eProsima/Fast-CDR.git | ||
version: master | ||
fastdds: | ||
type: git | ||
url: https://github.com/eProsima/Fast-DDS.git | ||
version: experimental/filthy/complex-dynamic-data | ||
dev-utils: | ||
type: git | ||
url: https://github.com/eProsima/dev-utils.git | ||
version: feature/time_to_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
# Allowed topics | ||
allowlist: | ||
- name: "*" # Allow all topics | ||
|
||
# Blocked topics | ||
blocklist: | ||
- name: "add_blocked_topics_list_here" | ||
|
||
# Simple Participant domain | ||
domain: 0 | ||
|
||
# Recorder output file | ||
extension: ".mcap" | ||
filename: "output" | ||
use-timestamp: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
# Allowed topics | ||
allowlist: | ||
- name: "*" # Allow all topics | ||
|
||
# Blocked topics | ||
blocklist: | ||
- name: "add_blocked_topics_list_here" | ||
|
||
# Simple Participant domain | ||
domain: 0 | ||
|
||
# Recorder output file | ||
extension: ".mcap" | ||
path: "/home/share_volume/" | ||
filename: "output" | ||
use-timestamp: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Simple Participant domain | ||
domain: 0 | ||
|
||
# Recorder output file | ||
filename: "output" | ||
use-timestamp: false |
Binary file not shown.