Skip to content

Commit

Permalink
Support loading of both the ROS2 and DDS plugins on all supported pla…
Browse files Browse the repository at this point in the history
…tforms (#324)
  • Loading branch information
gmartin82 authored Dec 16, 2024
1 parent 04c7884 commit a75fd79
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
if: startsWith(matrix.os,'ubuntu')
run: sudo apt-get -y install libacl1-dev

- name: Install LLVM toolchain
if: startsWith(matrix.os,'macos')
run: |
brew install llvm@19
ls /opt/homebrew/opt/llvm@19/bin
echo "/opt/homebrew/opt/llvm@19/bin" >> $GITHUB_PATH
- name: Install Rust toolchain
run: |
rustup show
Expand All @@ -46,23 +53,35 @@ jobs:
- name: Code format check
run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate"
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- --deny warnings
run: cargo clippy --workspace --all-targets --features stats,dynamic_plugin,dds_shm -- --deny warnings

- name: Build zenoh-plugin-ros2dds
run: cargo build -p zenoh-plugin-ros2dds --verbose --all-targets

- name: Build zenoh-plugin-ros2dds (with dds_shm)
run: cargo build -p zenoh-plugin-ros2dds --features dds_shm --verbose --all-targets

- name: Build zenoh-plugin-ros2dds (with prefix_symbols)
run: cargo build -p zenoh-plugin-ros2dds --features prefix_symbols --verbose --all-targets

- name: Build zenoh-bridge-ros2dds
run: cargo build -p zenoh-bridge-ros2dds --verbose --all-targets

- name: Build zenoh-bridge-ros2dds (with dds_shm)
run: cargo build -p zenoh-bridge-ros2dds --features dds_shm --verbose --all-targets

- name: Build zenoh-bridge-ros2dds (with prefix_symbols)
run: cargo build -p zenoh-bridge-ros2dds --features prefix_symbols --verbose --all-targets

- name: Run tests
run: cargo test --verbose

- name: Run tests (with dds_shm)
run: cargo test --features dds_shm --verbose

- name: Run tests (with prefix_symbols)
run: cargo test --features prefix_symbols --verbose

system_tests_with_ros2_humble:
name: System tests with ROS 2 Humble
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async-trait = "0.1.66"
bincode = "1.3.3"
cdr = "0.2.4"
clap = "4.4.11"
cyclors = "=0.2.3"
cyclors = "=0.2.5"
derivative = "2.2.0"
flume = "0.11.0"
futures = "0.3.26"
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ cargo build --release
The standalone executable binary `zenoh-bridge-ros2dds` and a plugin shared library (`*.so` on Linux, `*.dylib` on Mac OS, `*.dll` on Windows)
to be dynamically loaded by the zenoh router `zenohd` will be generated in the `target/release` subdirectory.

### DDS Library Symbol Prefixing

DDS support is provided by the [cyclors crate](https://crates.io/crates/cyclors). As this crate contains C code, symbol clashes may occur when loading the plugin statically with other plugins which use a different version of the ```cyclors``` crate (e.g. the ```zenoh-plugin-dds``` plugin).

To allow multiple versions of the ```cyclors``` crate to be loaded at the same time the symbols within the crate can be prefixed with the crate version. The optional ```prefix_symbols``` feature can be used to build the ROS2 plugin with prefixed DDS library symbols. e.g.

```bash
$ cargo build --features prefix_symbols
```

**Note:** The ```prefix_symbols``` feature cannot be used at the same time as the ```dds_shm``` feature.

## ROS 2 package

You can also build `zenoh-bridge-ros2dds` as a ROS package running:
Expand Down
1 change: 1 addition & 0 deletions zenoh-bridge-ros2dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ publish = false

[features]
dds_shm = ["zenoh-plugin-ros2dds/dds_shm"]
prefix_symbols = ["zenoh-plugin-ros2dds/prefix_symbols"]

[dependencies]
async-liveliness-monitor = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions zenoh-plugin-ros2dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ default = ["dynamic_plugin"]
stats = ["zenoh/stats"]
dynamic_plugin = []
dds_shm = ["cyclors/iceoryx"]
prefix_symbols = ["cyclors/prefix_symbols"]

[dependencies]
async-trait = { workspace = true }
Expand Down

0 comments on commit a75fd79

Please sign in to comment.