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

Presentation publisher and subscriber #378

Merged
merged 64 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
15279a9
Remove None as a scheduling option #verification #docs #sonar
serges147 Aug 12, 2024
d69a980
#verification #docs #nosonar
serges147 Aug 12, 2024
e0f5e3f
#verification #docs #sonar
serges147 Aug 12, 2024
6809b59
minor fixes #verification #docs #sonar
serges147 Aug 12, 2024
cb6714b
minor fixes #verification #docs #sonar
serges147 Aug 12, 2024
6ba04da
sonar fixes #verification #docs #sonar
serges147 Aug 12, 2024
7d76b37
Introduced `presentation` layer #verification #docs #sonar
serges147 Aug 12, 2024
c70bd4b
Added "epoll" Linux executor - no PMR at all.
serges147 Aug 14, 2024
6f4867f
Merge branch 'main' into sshirokov/epoll #verification #docs #sonar
serges147 Aug 14, 2024
544b23f
Merge branch 'main' into sshirokov/presentation
serges147 Aug 14, 2024
f6765e7
sonar fixes
serges147 Aug 14, 2024
2553cc9
Minor fixes #verification #docs #sonar
serges147 Aug 14, 2024
5d6f4d5
Minor fixes #verification #docs #sonar
serges147 Aug 14, 2024
66f0002
Added `ITimeProvider` interface #verification #docs #sonar
serges147 Aug 14, 2024
0725281
Merge branch 'sshirokov/epoll' into sshirokov/presentation_epoll
serges147 Aug 14, 2024
58f7c48
Added 'GetInfo' server #verification #docs #sonar
serges147 Aug 14, 2024
7aa6e9b
minor refactoring of examples
serges147 Aug 15, 2024
defc31a
added deserialization of heartbeats
serges147 Aug 15, 2024
9792f33
Report node's name (via `GetInfo`)
serges147 Aug 15, 2024
8a75cbd
less example code duplication
serges147 Aug 15, 2024
c173edb
Implemented presentation publisher
serges147 Aug 16, 2024
5144f39
Latest toolshed 4.22.10 #verification #docs #sonar
serges147 Aug 16, 2024
56f31b4
Sonar fixes #verification #docs #sonar
serges147 Aug 16, 2024
9c7407a
Sonar fixes #verification #docs #sonar
serges147 Aug 16, 2024
9abef71
Fix TX/RX metadata to have `deadline` and `timestamp` fields; Elimina…
serges147 Aug 16, 2024
ecb5e14
typo fix #verification #docs #sonar
serges147 Aug 16, 2024
f2be566
latest CETL #verification #docs #sonar
serges147 Aug 16, 2024
545b9db
sonar fixes #verification #docs #sonar
serges147 Aug 16, 2024
de897dd
first draft of subscriber
serges147 Aug 17, 2024
c6c0259
added `IMessageRxSession::setOnReceiveCallback`
serges147 Aug 17, 2024
06bc0f4
clang-format
serges147 Aug 17, 2024
db8418c
implemented generic subscriber and its deserializer #verification #do…
serges147 Aug 18, 2024
7a1355e
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
daa3f92
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
0c40580
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
93e9cc1
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
449cd96
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
6c88149
Sonar fixes #verification #docs #sonar
serges147 Aug 18, 2024
13a8c24
`Presentation` coverage #verification #docs #sonar
serges147 Aug 19, 2024
9acea51
try fix build #verification #docs #sonar
serges147 Aug 19, 2024
80512e3
try to fix build #verification #docs #sonar
serges147 Aug 19, 2024
8d3113b
initial publisher tests #verification #docs #sonar
serges147 Aug 19, 2024
7fe56de
apply PR comments; verify serialization failure #verification #docs #…
serges147 Aug 19, 2024
80325e1
fix build #verification #docs #sonar
serges147 Aug 19, 2024
b5d16c9
fix build #verification #docs #sonar
serges147 Aug 19, 2024
8d61f54
initial tests for subscriber #verification #docs #sonar
serges147 Aug 19, 2024
c50fd0c
better tests #verification #docs #sonar
serges147 Aug 20, 2024
61c5aae
unit tests fixes #verification #docs #sonar
serges147 Aug 20, 2024
d765539
Merge branch 'main' into sshirokov/presentation_epoll
serges147 Aug 20, 2024
132bf37
Merge branch 'sshirokov/presentation_epoll' into sshirokov/presentati…
serges147 Aug 20, 2024
aae76c8
- refactored CAVL `remove` method
serges147 Aug 20, 2024
9af1a31
Merge remote-tracking branch 'origin/sshirokov/presentation_subscribe…
serges147 Aug 20, 2024
e1ae8aa
- refactored CAVL `remove` method
serges147 Aug 20, 2024
444dcc8
Sonar fixes #verification #docs #sonar
serges147 Aug 20, 2024
4bffdfc
Sonar fixes #verification #docs #sonar
serges147 Aug 20, 2024
d6833dc
Sonar and build fixes #verification #docs #sonar
serges147 Aug 20, 2024
7ca11b1
Added `TestSubscriber, setOnReceiveCallback` unit test #verification …
serges147 Aug 20, 2024
d9101d3
Added `my_custom` DSDL types for unit test #verification #docs #sonar
serges147 Aug 21, 2024
8520bf0
more subscriber unit tests #verification #docs #sonar
serges147 Aug 21, 2024
eb7611e
more subscriber unit tests #verification #docs #sonar
serges147 Aug 21, 2024
02e88e1
more msg RX unit tests #verification #docs #sonar
serges147 Aug 21, 2024
731fcbd
minor fixes
serges147 Aug 21, 2024
25c4c4f
minor fixes
serges147 Aug 23, 2024
5731a55
clang-tidy fix
serges147 Aug 23, 2024
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linux development environment for libcyphal",
"image": "ghcr.io/opencyphal/toolshed:ts22.4.8",
"image": "ghcr.io/opencyphal/toolshed:ts22.4.10",
"customizations": {
"vscode": {
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
contains(github.ref, '/issue/') ||
(github.event_name == 'pull_request')
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.7
container: ghcr.io/opencyphal/toolshed:ts22.4.10
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
contains(github.ref, '/issue/') ||
(github.event_name == 'pull_request')
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.7
container: ghcr.io/opencyphal/toolshed:ts22.4.10
steps:
- uses: actions/checkout@v4
- name: Cache ext modules
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
contains(github.ref, '/issue/') ||
(github.event_name == 'pull_request')
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.7
container: ghcr.io/opencyphal/toolshed:ts22.4.10
needs: [warmup]
strategy:
matrix:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
contains(github.ref, '/issue/') ||
(github.event_name == 'pull_request')
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.7
container: ghcr.io/opencyphal/toolshed:ts22.4.10
needs: [warmup]
steps:
- uses: actions/checkout@v4
Expand Down
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,38 @@ if (NOT NO_STATIC_ANALYSIS)
message(STATUS "Using clang-tidy: ${clang_tidy}")
endif ()

# +---------------------------------------------------------------------------+
# | BUILD DSDL TYPES
# +---------------------------------------------------------------------------+

find_package(public_regulated_data_types REQUIRED)
find_package(nnvg REQUIRED)

if (CETL_ENABLE_DEBUG_ASSERT)
set(NNVG_ASSERT_ARGS "ENABLE_SER_ASSERT")
else()
set(NNVG_ASSERT_ARGS )
endif()

if (${CMAKE_MESSAGE_LOG_LEVEL} MATCHES "VERBOSE|TRACE|DEBUG")
set(NNVG_VERBOSE_ARGS "VERBOSE")
else()
set(NNVG_VERBOSE_ARGS )
endif()
define_nunavut_support_target(
TARGET dsdl_support
${NNVG_ASSERT_ARGS}
${NNVG_VERBOSE_ARGS}
)
add_dsdl_cpp_codegen(
TARGET dsdl_public_types
DSDL_ROOT_DIR ${public_regulated_data_types_SOURCE_DIR}/uavcan
${NNVG_ASSERT_ARGS}
${NNVG_VERBOSE_ARGS}
DSDL_DEPENDENCIES
dsdl_support
)

add_subdirectory(test/unittest)
add_subdirectory(docs)

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ and manually run it.

### TLDR
```
docker pull ghcr.io/opencyphal/toolshed:ts22.4.7
docker pull ghcr.io/opencyphal/toolshed:ts22.4.10
git clone {this repo}
cd {this repo}
docker run --rm -it -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.7
docker run --rm -it -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.10
mkdir build
cd build
cmake ..
Expand Down Expand Up @@ -200,7 +200,7 @@ To ensure that the formatting matches the expectations of the CI suite,
invoke Clang-Format of the correct version from the container (be sure to use the correct image tag):

```
docker run --rm -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.7 ./build-tools/bin/verify.py build-danger-danger-repo-clang-format-in-place
docker run --rm -v ${PWD}:/repo ghcr.io/opencyphal/toolshed:ts22.4.10 ./build-tools/bin/verify.py build-danger-danger-repo-clang-format-in-place
```

### `issue/*` and hashtag-based CI triggering
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findcetl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

include(FetchContent)
set(cetl_GIT_REPOSITORY "https://github.com/OpenCyphal/cetl.git")
set(cetl_GIT_TAG "e9bf9ba46d618dda4a39110dbc118549a905f9a7")
set(cetl_GIT_TAG "37d19afb6254ed06f0847f9839eb2c0b340ea6eb")

FetchContent_Declare(
cetl
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findlibudpard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(FindPackageHandleStandardArgs)
include(ProjectLibrary)

set(libudpard_GIT_REPOSITORY "https://github.com/OpenCyphal-garage/libudpard.git")
set(libudpard_GIT_TAG "6c7c12ef1db0338684c536167dc4ba6dc7fa8b5a")
set(libudpard_GIT_TAG "1.0.1")

FetchContent_Declare(
libudpard
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findnnvg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ endfunction()
# :option ENABLE_OVR_VAR_ARRAY: Generates code with variable array capacity override enabled
# :option ENABLE_SER_ASSERT: Generates code with serialization asserts enabled
# :option VERBOSE Enable verbose output from nnvg.
function (define_nuanvut_support_target)
function (define_nunavut_support_target)
#+-[input]----------------------------------------------------------------+
set(options VERBOSE ENABLE_SER_ASSERT ENABLE_OVR_VAR_ARRAY)
set(singleValueArgs TARGET OUTPUT_FOLDER)
Expand Down
37 changes: 8 additions & 29 deletions docs/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ project(libcyphal_docs_examples C CXX)
include("../../cmake/CMakeCommon.cmake" REQUIRED)

find_package(cyphal REQUIRED)
find_package(public_regulated_data_types REQUIRED)
find_package(nnvg REQUIRED)
find_package(googletest REQUIRED)
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
find_package(gcovr REQUIRED)
Expand All @@ -25,32 +23,6 @@ endif()
# +---------------------------------------------------------------------------+
# | BUILD EXAMPLE TYPES
# +---------------------------------------------------------------------------+
if (CETL_ENABLE_DEBUG_ASSERT)
set(NNVG_ASSERT_ARGS "ENABLE_SER_ASSERT")
else()
set(NNVG_ASSERT_ARGS )
endif()

if (${CMAKE_MESSAGE_LOG_LEVEL} MATCHES "VERBOSE|TRACE|DEBUG")
set(NNVG_VERBOSE_ARGS "VERBOSE")
else()
set(NNVG_VERBOSE_ARGS )
endif()

define_nuanvut_support_target(
TARGET dsdl_support
${NNVG_ASSERT_ARGS}
${NNVG_VERBOSE_ARGS}
)

add_dsdl_cpp_codegen(
TARGET dsdl_public_types
DSDL_ROOT_DIR ${public_regulated_data_types_SOURCE_DIR}/uavcan
${NNVG_ASSERT_ARGS}
${NNVG_VERBOSE_ARGS}
DSDL_DEPENDENCIES
dsdl_support
)

add_dsdl_cpp_codegen(
TARGET dsdl_example_types
Expand Down Expand Up @@ -120,18 +92,25 @@ foreach(NATIVE_EXAMPLE ${NATIVE_EXAMPLES})

define_native_gtest_unittest_targets(
TEST_SOURCE ${NATIVE_EXAMPLE}
EXTRA_TEST_LIBS cyphal cetl dsdl_example_types ${EXAMPLES_PLATFORM_LIBS}
EXTRA_TEST_LIBS cyphal cetl dsdl_support dsdl_example_types ${EXAMPLES_PLATFORM_LIBS}
LINK_TO_MAIN
OUT_TEST_LIB_VARIABLE LOCAL_TEST_LIB
OUT_TEST_EXE_VARIABLE LOCAL_TEST_TARGET
OUT_TEST_REPORT_VARIABLE LOCAL_TEST_REPORT
)

# We need to exclude the "external", "nunavut" & "uavcan" directories from coverage reports.
cmake_path(APPEND LIBCYPHAL_ROOT "external" OUTPUT_VARIABLE LIBCYPHAL_EXTERNAL_PATH)
cmake_path(APPEND LIBCYPHAL_ROOT "${CMAKE_INSTALL_PREFIX}/nunavut" OUTPUT_VARIABLE LIBCYPHAL_NUNAVUT_PATH)
cmake_path(APPEND LIBCYPHAL_ROOT "${CMAKE_INSTALL_PREFIX}/uavcan" OUTPUT_VARIABLE LIBCYPHAL_UAVCAN_PATH)

if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
define_gcovr_tracefile_target(
TARGET ${LOCAL_TEST_TARGET}
ROOT_DIRECTORY ${LIBCYPHAL_ROOT}
TARGET_EXECUTION_DEPENDS ${LOCAL_TEST_REPORT}
OBJECT_LIBRARY ${LOCAL_TEST_LIB}
EXCLUDE_PATHS ${LIBCYPHAL_EXTERNAL_PATH} ${LIBCYPHAL_NUNAVUT_PATH} ${LIBCYPHAL_UAVCAN_PATH}
EXCLUDE_TEST_FRAMEWORKS
EXCLUDE_TARGET
ENABLE_INSTRUMENTATION
Expand Down
65 changes: 32 additions & 33 deletions docs/examples/example_01_hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,52 +48,51 @@ template <typename T>
using polymorphic_allocator = cetl::pf17::pmr::polymorphic_allocator<T>;

constexpr std::size_t foo_count_ = 24u;
using FooStorageType = std::aligned_storage<dsdl_traits<example::foo_1_0>::extent(), dsdl_traits<example::foo_1_0>::align()>;
FooStorageType foo_storage_[foo_count_];
FooStorageType input_buffer_[1];
using FooStorageType = std::aligned_storage<dsdl_traits<example::foo_1_0>::extent(),
dsdl_traits<example::foo_1_0>::align()>; FooStorageType foo_storage_[foo_count_]; FooStorageType input_buffer_[1];

*/

TEST(example_01_serialize_foo, snippit_0)
{
// TODO: Uncomment this when we have a real example to test.
/*
// TODO: Uncomment this when we have a real example to test.
/*

//! [snippit_0]
// to include in doxygen just do:
// @snippet{trimleft} example_01_hello_world.cpp snippit_0
//! [snippit_0]
// to include in doxygen just do:
// @snippet{trimleft} example_01_hello_world.cpp snippit_0

// Here we're using CETL's VLA to store a bunch of our foo instances.Foo is a type we defined in
// dsd/example/foo.1.0.dsdl
// Here we're using CETL's VLA to store a bunch of our foo instances.Foo is a type we defined in
// dsd/example/foo.1.0.dsdl

monotonic_buffer_resource mr{&foo_storage_[0], sizeof(FooStorageType::type) * foo_count_};
polymorphic_allocator<example::foo_1_0> alloc(&mr);
cetl::VariableLengthArray<example::foo_1_0, decltype(alloc)> vla{alloc};
monotonic_buffer_resource mr{&foo_storage_[0], sizeof(FooStorageType::type) * foo_count_};
polymorphic_allocator<example::foo_1_0> alloc(&mr);
cetl::VariableLengthArray<example::foo_1_0, decltype(alloc)> vla{alloc};

// You'll note that CETL's PMR extends the C++ standard to support max_size so this next line would
// not work if you were using C++17's standard library:
std::cout << "We have storage for " << vla.max_size() << " example::foo_1_0 objects." << std::endl;
// You'll note that CETL's PMR extends the C++ standard to support max_size so this next line would
// not work if you were using C++17's standard library:
std::cout << "We have storage for " << vla.max_size() << " example::foo_1_0 objects." << std::endl;

vla.reserve(1);
vla.reserve(1);

std::cout << "We have capacity for " << vla.capacity() << " objects." << std::endl;
std::cout << "We have capacity for " << vla.capacity() << " objects." << std::endl;

vla.emplace_back(example::foo_1_0{});
vla.emplace_back(example::foo_1_0{});

// This is all kinds of badness. We need to support byte instead of uint8 (e.g. some DSP's have 16 bit bytes)
// and we need to support CETL span, and we need to allow uninitialized memory regions to get passed in without
// needing reinterpret_cast by the caller, etc.
nunavut::support::bitspan fake_input_buffer{reinterpret_cast<std::uint8_t*>(input_buffer_), dsdl_traits<example::foo_1_0>::extent(), 0U};
if (example::serialize(vla[0], fake_input_buffer))
{
std::cout << "Cool. You know have an in-memory representation of your foo object!" << std::endl;
}
else
{
std::cout << "Hmmmmm." << std::endl;
}
// This is all kinds of badness. We need to support byte instead of uint8 (e.g. some DSP's have 16 bit bytes)
// and we need to support CETL span, and we need to allow uninitialized memory regions to get passed in without
// needing reinterpret_cast by the caller, etc.
nunavut::support::bitspan fake_input_buffer{reinterpret_cast<std::uint8_t*>(input_buffer_),
dsdl_traits<example::foo_1_0>::extent(), 0U}; if (example::serialize(vla[0], fake_input_buffer))
{
std::cout << "Cool. You know have an in-memory representation of your foo object!" << std::endl;
}
else
{
std::cout << "Hmmmmm." << std::endl;
}

//! [snippit_0]
//! [snippit_0]

*/
*/
}
Loading
Loading