Skip to content

Commit

Permalink
fix: Adds missed updates from dev branches
Browse files Browse the repository at this point in the history
  • Loading branch information
cvilas committed Jul 13, 2024
1 parent f273d5e commit 465c7ff
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ It's also a hobby project that demonstrates [principles](https://github.com/cvil
- A stubbornly strict [command line parser](./modules/common/conio/include/grape/conio/program_options.h)
- A scalable [message-passing backend](./modules/common/ipc/README.md)
- Minimal external dependencies
- Dependence on the bleeding edge for development tools:
- Latest C++ language version
- Latest release of compilers (Clang and GCC) and build tools (CMake)
- Uses newest available C++ language features

## Getting Started

Expand Down
13 changes: 5 additions & 8 deletions docs/02_roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@
- zenoh video capture/display: https://github.com/eclipse-zenoh/zenoh-demos/tree/master/computer-vision/zcam
- HW accelerated 3D graphics
- Select scene description format: [USD](https://developer.nvidia.com/usd#nvidia), glTF with [physics extensions](https://github.com/eoineoineoin/glTF_Physics)
- Select a rendering backend: vsg, ogre, raylib, something else
- Select a scenegraph engine: vsg, ogre, raylib, something else
- Implement a basic scenegraph example and check performance in MacOS and Linux VM
- Implement scenegraph in our scripting language and have it render by the backend
- Pin zenoh version to 1.0.0
- Review zenohc and zenohcxx installation steps are correct in external/CMakeLists.txt.
- Make sure static libs are built and installed when requested.
- Pin SDL3 version to 3.x
- Implement new zenoh features as examples
- matched pub/sub discovery
- Other new features: https://zenoh.io/blog/2024-04-30-zenoh-electrode/
- Demonstrate hard realtime capability with Ubuntu 24.04 on X86 and RaspberryPi
- Implement new zenoh features as examples
- Document how to configure Raspberry Pi5 with Ubuntu realtime kernel for low latency
- https://ubuntu.com/blog/real-time-kernel-tuning

## Phase 4 - Refactor
Expand All @@ -47,8 +44,6 @@
- Study Quill to understand how to reduce overhead even more
- Refactor thread class out of realtime and put it in 'grape'
- Insert logging to capture timer overruns in the loop
- Study [SPSC FIFO](https://youtu.be/K3P_Lmq6pw0) and review [implementation](https://github.com/CharlesFrasch/cppcon2023)
- Benchmark `FIFOBuffer` against [SPSC fifo](https://github.com/CharlesFrasch/cppcon2023) and improve performance where possible
- `reinterpret_cast<uintptr_t>` from `const T*` and then modifying it later is undefined behaviour. Fix `probe::PinConfig::pin`. Consider `std::start_lifetime_as` instead.

## Phase 5 - CI
Expand All @@ -75,6 +70,8 @@
- enum to string: Copy the general idea from here: <https://godbolt.org/z/6MxYznfbf>
- consider magic_enum and other options and choose one
- refactor existing `toString()` functions
- Implement shared memory
- Implement SPMC queue using externally provided memory (heap or shared memory)
- HW IO
- CANopen
- joystick
Expand Down
5 changes: 3 additions & 2 deletions docs/03_modern_cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
- Designated initialisers (C++20)
- 3-way comparison (spaceship) operator (C++20)
- Concepts (C++20)
- std::expected (C++23)
- std::print (C++23)
- std::format (C++20)
- std::span (C++20)
- std::source_location (C++20)
- std::ranges (C++20)
- std::expected (C++23)
- std::print (C++23)
12 changes: 12 additions & 0 deletions external/third_party_versions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# =================================================================================================
# Copyright (C) 2024 GRAPE Contributors
# =================================================================================================

# List of all third-party dependency versions

set(CATCH2_VERSION_REQUIRED 3.6.0)
set(BENCHMARK_VERSION_REQUIRED 1.8.4)
set(ZENOH_VERSION_REQUIRED 0.11.0)
set(ZENOHC_VERSION_REQUIRED ${ZENOH_VERSION_REQUIRED})
set(ZENOHCXX_VERSION_REQUIRED ${ZENOH_VERSION_REQUIRED})
set(GLFW3_VERSION_REQUIRED 3.4)
2 changes: 1 addition & 1 deletion modules/common/ipc/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ define_module_example(
NAME zenoh_attachment_sub
SOURCES zenoh_attachment_sub.cpp examples_utils.h
PUBLIC_INCLUDE_PATHS $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC_LINK_LIBS grape::conio)
PUBLIC_LINK_LIBS grape::conio)
7 changes: 3 additions & 4 deletions modules/common/realtime/tests/fifo_buffer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ TEST_CASE("Writes and reads are in FIFO order", "[FIFOBuffer]") {
// write
for (std::size_t i = 0; i < CONFIG.num_frames; ++i) {
const auto test_data = std::vector<std::byte>(CONFIG.frame_length, static_cast<std::byte>(i));
REQUIRE(buffer.visitToWrite([&test_data](std::span<std::byte> frame) {
std::copy(test_data.begin(), test_data.end(), frame.begin());
}));
REQUIRE(buffer.visitToWrite(
[&test_data](std::span<std::byte> frame) { std::ranges::copy(test_data, frame.begin()); }));
REQUIRE(buffer.count() == i + 1);
}

// read
for (std::size_t i = 0; i < CONFIG.num_frames; ++i) {
std::vector<std::byte> read_data(CONFIG.frame_length, static_cast<std::byte>(0xff));
REQUIRE(buffer.visitToRead([&read_data](std::span<const std::byte> frame) {
std::copy(frame.begin(), frame.end(), read_data.begin());
std::ranges::copy(frame, read_data.begin());
}));
REQUIRE(buffer.count() == CONFIG.num_frames - i - 1);
REQUIRE(std::vector<std::byte>(CONFIG.frame_length, static_cast<std::byte>(i)) == read_data);
Expand Down
6 changes: 3 additions & 3 deletions modules/probe/controller/src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ auto PinConfig::sort() -> std::vector<Signal>::const_iterator {
};

// sort for locality and faster access to signals later on
std::sort(signals_.begin(), signals_.end(), sort_by_role_and_address);
std::ranges::sort(signals_, sort_by_role_and_address);

// return the location of first controllable
return std::find_if(signals_.begin(), signals_.end(),
[](const Signal& s) { return s.role == Signal::Role::Control; });
return std::ranges::find_if(signals_,
[](const Signal& s) { return s.role == Signal::Role::Control; });
}

//-------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modules/probe/controller/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST_CASE("[Controller is configured correctly]", "[controller]") {
return ((a.role == b.role) ? (a.address < b.address) : (a.role == Signal::Role::Watch));
};

CHECK(std::is_sorted(signals.begin(), signals.end(), sort_predicate));
CHECK(std::ranges::is_sorted(signals, sort_predicate));
CHECK(std::all_of(controllables_start, signals.end(),
[r = Role::Control](const auto& s) { return s.role == r; }));
CHECK(std::all_of(signals.begin(), controllables_start,
Expand Down

0 comments on commit 465c7ff

Please sign in to comment.