Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport/v5.12 #1230

Merged
merged 17 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3c75a00
Doc: Added tutorial for host group feature - ipc communication across…
KerstinKeller Aug 8, 2023
ce128e7
Doc: Added documentation for 5.12 release (#1182)
FlorianReimold Aug 9, 2023
b2739f1
#1186 App, Dependencies: Make compatible with ftxui 5.0.0 (#1188)
KerstinKeller Aug 23, 2023
216f4b3
Small fix for eCAL-docker documentation and one image added. (#1192)
KaanConti Aug 31, 2023
4c353a4
Fixes bug regarding unregistration introduced with #1086. (#1197)
KerstinKeller Sep 13, 2023
a44ce76
Sphinx Doc: downgrade sphinxcontrib-youtube (#1202)
FlorianReimold Sep 19, 2023
a02abee
Rec GUI: Fixed a tooltip typo (#1201)
FlorianReimold Sep 19, 2023
1a50ffa
eCAL Core: Callback after zero length send contains stale message
KerstinKeller Sep 19, 2023
0f2381c
GH Actions: Remove Python 3.6 wheel build on Windows (#1208)
FlorianReimold Sep 28, 2023
7ba32dc
Core: Fixed a bug that may have caused drops in the SHM Layer (#1198)
FlorianReimold Sep 29, 2023
6e43100
Core: Fixed ack timeout issue (#1207)
FlorianReimold Oct 4, 2023
9ef4ba1
HDF5: Make sure datasets are always closed upon reading, even when si…
KerstinKeller Oct 10, 2023
286f984
cleanup add/rem datawriter connection logic (#1216)
rex-schilasky Oct 24, 2023
f05fdb8
additional logging added for shm memfile creation/handling (#1225)
rex-schilasky Oct 25, 2023
db69c37
core: new internal event functions with ownership handling (ownership…
rex-schilasky Oct 25, 2023
2d41066
GCC 13: Added workaround for termcolor bug (missing include) (#1228)
FlorianReimold Oct 26, 2023
056366d
Do not show eCAL deprecation warnings, when building ecal_core and ec…
KerstinKeller Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,6 @@ jobs:
shell: cmd
working-directory: ${{ runner.workspace }}/_build/complete

- name: Build Python 3.6 Wheel
run: |
mkdir ".venv_36"
py -3.6 -m venv ".venv_36"
CALL ".venv_36\Scripts\activate.bat"
pip install wheel
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 -DPython_FIND_VIRTUALENV=FIRST
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 -DPython_FIND_VIRTUALENV=ONLY
cmake --build . --target create_python_wheel --config Release
shell: cmd
working-directory: ${{ runner.workspace }}/_build/complete

# - name: Build Documentation C
# run: cmake --build . --target documentation_c
# working-directory: ${{ runner.workspace }}/_build
Expand Down
5 changes: 4 additions & 1 deletion app/mon/mon_tui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ target_include_directories(${PROJECT_NAME}
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)

target_compile_definitions(${PROJECT_NAME}
PRIVATE $<$<BOOL:${MSVC}>:PCRE_STATIC;_UNICODE>)
PRIVATE
$<$<BOOL:${MSVC}>:PCRE_STATIC;_UNICODE>
FTXUI_VERSION_MAJOR=${ftxui_VERSION_MAJOR}
)

create_targets_protobuf()

Expand Down
22 changes: 20 additions & 2 deletions app/mon/mon_tui/src/tui/style_sheet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ struct StyleSheet
default: return nothing;
}
};
sheet.tab.entries.transform = [](EntryState state)
#if FTXUI_VERSION_MAJOR >= 5
sheet.tab.entries_option.transform =
#else
sheet.tab.entries.transform =
#endif
[](EntryState state)
{
if(state.active)
{
Expand All @@ -110,7 +115,11 @@ struct StyleSheet
}
return text(state.label);
};
#if FTXUI_VERSION_MAJOR >= 5
sheet.tab.direction = Direction::Right;
#else
sheet.tab.direction = MenuOption::Right;
#endif
sheet.tab.elements_prefix = [] {
return text(" ");
};
Expand Down Expand Up @@ -202,14 +211,23 @@ struct StyleSheet
default: return nothing;
}
};
sheet.tab.entries.transform = [](EntryState state) {
#if FTXUI_VERSION_MAJOR >= 5
sheet.tab.entries_option.transform =
#else
sheet.tab.entries.transform =
#endif
[](EntryState state) {
if(state.active)
{
return text(state.label) | inverted;
}
return text(state.label);
};
#if FTXUI_VERSION_MAJOR >= 5
sheet.tab.direction = Direction::Right;
#else
sheet.tab.direction = MenuOption::Right;
#endif
sheet.tab.elements_prefix = [] {
return text(" ");
};
Expand Down
1 change: 1 addition & 0 deletions app/play/play_cli/src/ecal_play_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#pragma warning(push)
#pragma warning(disable: 4800 )
#endif //_MSC_VER
#include <cstdint> // Needed for termcolor. Currently (2023-10-26) termcolor does not include this header file, but it is needed for Ubuntu 23.10 / gcc 13.2: https://github.com/ikalnytskyi/termcolor/pull/72
#include <termcolor/termcolor.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ QVariant RecorderModel::data(const QModelIndex &index, int role) const
{
if (recorder_list_[row].recording_enabled_ && recorder_list_[row].time_error_warning_)
{
return "On of the recorders appears to be out of sync!";
return "One of the recorders appears to be out of sync!";
}
}

Expand Down
1 change: 1 addition & 0 deletions app/rec/rec_server_cli/src/commands/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#pragma warning(disable: 4800) // disable termcolor warnings
#endif

#include <cstdint> // Needed for termcolor. Currently (2023-10-26) termcolor does not include this header file, but it is needed for Ubuntu 23.10 / gcc 13.2: https://github.com/ikalnytskyi/termcolor/pull/72
#include <termcolor/termcolor.hpp>

#ifdef _MSC_VER
Expand Down
1 change: 1 addition & 0 deletions app/rec/rec_server_cli/src/commands/table_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#pragma warning(disable: 4800) // disable termcolor warnings
#endif

#include <cstdint> // Needed for termcolor. Currently (2023-10-26) termcolor does not include this header file, but it is needed for Ubuntu 23.10 / gcc 13.2: https://github.com/ikalnytskyi/termcolor/pull/72
#include <termcolor/termcolor.hpp>

#ifdef _MSC_VER
Expand Down
1 change: 1 addition & 0 deletions app/sys/sys_cli/src/commands/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#pragma warning(push)
#pragma warning(disable: 4800) // disable termcolor warnings
#endif
#include <cstdint> // Needed for termcolor. Currently (2023-10-26) termcolor does not include this header file.
#include <termcolor/termcolor.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
Expand Down
10 changes: 6 additions & 4 deletions contrib/ecalhdf5/src/eh5_meas_dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,28 @@ bool eCAL::eh5::HDF5MeasDir::Open(const std::string& path, eAccessType access /*

bool eCAL::eh5::HDF5MeasDir::Close()
{
bool successfully_closed{ true };

if (access_ == eAccessType::CREATE)
{
// Close all existing file writers
for (auto& file_writer : file_writers_)
{
file_writer.second->Close();
successfully_closed &= file_writer.second->Close();
}

// Clear the list of all file writers, which will delete them
file_writers_.clear();

return true;
return successfully_closed;
}
else
{
for (auto file : file_readers_)
{
if (file != nullptr)
{
file->Close();
successfully_closed &= file->Close();
delete file;
file = nullptr;
}
Expand All @@ -125,7 +127,7 @@ bool eCAL::eh5::HDF5MeasDir::Close()
entries_by_id_.clear();
entries_by_chn_.clear();

return true;
return successfully_closed;
}
}

Expand Down
10 changes: 6 additions & 4 deletions contrib/ecalhdf5/src/eh5_meas_file_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,15 @@ bool eCAL::eh5::HDF5MeasFileV2::GetEntryData(long long entry_id, void* data) con

auto size = H5Dget_storage_size(dataset_id);

if (size <= 0) return false;

auto readStatus = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
herr_t read_status = -1;
if (size >= 0)
{
read_status = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
}

H5Dclose(dataset_id);

return (readStatus >= 0);
return (read_status >= 0);
}


Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ empy
semantic-version
exhale
Jinja2
sphinxcontrib-youtube
sphinxcontrib-youtube<=1.2
sphinxcontrib-apidoc

81 changes: 79 additions & 2 deletions doc/rst/advanced/ecal_in_docker.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: /include.txt
.. include:: /include.txt

.. _ecal_in_docker:

Expand Down Expand Up @@ -186,4 +186,81 @@ Run the docker containers
.. code-block:: bash

sudo docker-compose build
sudo docker-compose up
sudo docker-compose up

Seamless IPC-Communication across host borders
----------------------------------------------

.. important::
This will work with eCAL 5.12 and higher.
Older versions lack the ability to utilize the ``host_group_name`` in the :file:`ecal.ini` file, thus it won't work.


In eCAL, you are able to set host belonging over network borders by utilizing the :file:`ecal.ini` configuration file with the same ``host_group_name`` - in the following steps, you will learn how to set this up.

.. note::
If we don't set the same ``host_group_name`` on our Host and our Containers, an IPC-Communication across host borders is not available with different host names.

#. To encapsulate your container network from your host network, you need to create a new docker network with the following command:

.. code-block:: bash

sudo docker network create --driver=bridge --subnet=10.0.10.0/24 my_network

#. Edit your :file:`ecal.ini` and run your Container within the newly created docker network

* You will use our previously discussed :ref:`ecal-runtime-image<ecal_in_docker>` for the next step.

* First, open :file:`/etc/ecal/ecal.ini` from your preferred editor.

* Search for the line ``network_enabled`` and set it to ``true``.

* Search for the line ``host_group_name`` and write your preferred name.

* Save and close the :file:`ecal.ini` file.

* Now your :file:`ecal.ini` file is prepared.
We want to use it not only for our Host-System but also for our Container, so we don't need to edit the :file:`ecal.ini` in our Container again.
To achieve that, run following command to start your container:

.. code-block:: bash

sudo docker run --rm -it --ipc=host --pid=host --network=my_network --name=container1 -h=container1 --ip=10.0.10.10 -v /etc/ecal/ecal.ini:/etc/ecal/ecal.ini ecal-runtime

- You should now be inside the root shell of your Container.
Check if your :file:`ecal.ini` file is correct.

- Now your Container is prepared and configured correctly, so we are ready to start an eCAL example.

.. code-block:: bash

ecal_sample_person_snd


#. Configure the Host network

- eCAL is sending UDP messages to a multicast IP group ``239.0.0.0/24``, further information in :ref:`Getting Started Section <getting_started_cloud_ubuntu_routes>`.
The idea is now, to successfully receive those messages from your previously started container on your host.
For that, you need to add a route to your routing table.
By typing ``ifconfig`` in your shell, you can identify the right docker network.
In our case, the prefix of the docker network is always ``br`` followed by random numbers.
After identifying the right network, run following command.

.. code-block:: bash

sudo ip route add 239.0.0.0/24 dev <br-xxx> metric 1

- Review your network configuration. Your eCAL-Monitor should resemble this example:

.. image:: img_documentation/doku_ecal_docker_mon.png


#. (optional) After adding the route, you register the Container with IP address and name in /etc/hosts for DNS resolution, enabling easy access to it by hostname within the network.

.. code-block:: bash

sudo nano /etc/hosts

.. image:: img_documentation/vscode_etc_hosts.png

When you are done, all eCAL nodes can communicate seamlessly from docker to the host and vice versa.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 22 additions & 53 deletions doc/rst/advanced/layers/shm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Communication phase (default configuration):
* The subscribers close the memory file and release the access-mutex.


To support one to many publisher/subscriber connections the publisher creates in fact one named update event per connection.
To support one to many publisher/subscriber connections, the publisher creates one named update event per connection.

.. note::

Expand Down Expand Up @@ -92,73 +92,41 @@ Finally that means the publishers ``CPublisher::Send`` API function call is now
Zero Copy mode (optional)
-------------------------

*Zero-copy has been added in eCAL 5.10. It is turned off by default. When turned on, old eCAL Version can still receive the data but will not use zero-copy.**

The “normal” eCAL Shared memory communication results in the payload being copied at least twice:

1. Into the SHM file by the publisher

2. From the SHM file the private memory of each subscriber

Usually there is no issue with that.
Copying the payload from the memory file before executing the subscriber callback results in better decoupling, so the publisher can update the memory file with the next message while the subscriber is still processing the last one.
Small messages will be transmitted in a few microseconds and will not benefit from zero-copy.

If it comes to very large messages (e.g. high resolution images) however, copying really matters and it can make sense to activate eCAL's zero-copy mode.
With zero-copy, the communication would look like this:

1. The publisher still has to copy the data into the memory file.

2. The subscriber executes its callback directly on the memory file.
The memory file is blocked, while being used.

.. warning::

The memory file is blocked for new publications as long as the user’s callback is processing its content.
It will also block other subscribers from reading the same SHM file.

3. The subscriber releases the memory file, so the publisher can update it again.

.. note::

Even though it is called zero-copy, only the subscribers are zero-copy.
Publishers still have to copy the data into the memory file, as they have to also support other layers like UDP or TCP and therefore cannot directly work on the memory file.
Zero-copy has been added in eCAL 5.10 for subscription and in 5.12 for publishing.
It is turned off by default.
When turned on, old eCAL Versions can still receive the data but will not use zero-copy.

Zero-copy can be enabled in the following ways:
The "normal" eCAL Shared memory communication results in the payload being copied at least twice:

- **Use zero-copy as system-default (not recommended!):**

Activating zero copy system-wide is not recommended because of the mentioned disadvantages for small payloads.
But if this is wanted for reasons it can be done by adapting your :file:`ecal.ini` like this.

.. code-block:: ini

[publisher]
memfile_zero_copy = 1
1. Into the SHM file by the publisher

- **Use zero-copy for a single publisher (from your code):**
2. From the SHM file the private memory of each subscriber

Zero copy could be activated either per connection or for a complete system using the eCAL configuration file.
To activate it for a specific publisher this ``CPublisher`` `API function <https://eclipse-ecal.github.io/ecal/_api/classeCAL_1_1CPublisher.html#_CPPv4N4eCAL10CPublisher17ShmEnableZeroCopyEb>`_ needs to be called.
Copying the payload from the memory file before executing the subscriber callback results in **better decoupling**, so the publisher can update the memory file with the next message while the subscriber is still processing the last one.
**Small messages** will be transmitted in a few microseconds and will not benefit from zero-copy.

.. code-block:: cpp
If it comes to very **large messages** (e.g. high resolution images) however, copying really matters and it can make sense to activate eCAL's **zero-copy mode**.

// Create a publisher (topic name "person")
eCAL::protobuf::CPublisher<pb::People::Person> pub("person");
.. seealso::

// Enable zero-copy for this publisher
pub.ShmEnableZeroCopy(true);
Check out the following Chapter to learn how to enable zero-copy.
The chapter will also teach you about advantages and disadvantages of zero-copy:

.. note::
.. toctree::
:maxdepth: 1

In general, it is advisable to combine zero-copy with multi-buffering to reduce the impact on the publisher.
shm_zerocopy.rst

Multi-buffering mode (optional)
-------------------------------

*Multi-buffering has been added in eCAL 5.10.
Multi-buffered topics cannot be received by older eCAL versions.
The feature is turned off by default.*
.. note::

Multi-buffering has been added in eCAL 5.10.
Multi-buffered topics cannot be received by older eCAL versions.
The feature is turned off by default.

As described in the previous sections, eCAL uses one shared memory file per publisher. This can lead to performance reduction if

Expand Down Expand Up @@ -199,3 +167,4 @@ You can activate the feature in the following ways.
pub.ShmSetBufferCount(3);

Combining the zero-copy feature with an increased number of memory buffer files (like 2 or 3) could be a nice setup allowing the subscriber to work on the memory file content without copying its content and nevertheless not blocking the publisher to write new data.
Using Multibuffering however will force each Send operation to re-write the entire memory file and disable partial updates.
Loading