Skip to content

[#1742] Add mapping implementations for ROS 2 tunnel#1822

Merged
orecham merged 29 commits into
eclipse-iceoryx:mainfrom
ekxide:iox2-1742-add-mapping-implementations-for-ros2
Jul 22, 2026
Merged

[#1742] Add mapping implementations for ROS 2 tunnel#1822
orecham merged 29 commits into
eclipse-iceoryx:mainfrom
ekxide:iox2-1742-add-mapping-implementations-for-ros2

Conversation

@orecham

@orecham orecham commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Notes for Reviewer

Adds the following Mapping implementations:

  • PrefixMapping - dynamic mapping of services with the prefix ros2://topics/ to ROS 2 topics
  • StaticMapping - static mapping of services to topics explicitly specified by configuration

Pre-Review Checklist for the PR Author

  • Add sensible notes for the reviewer
  • PR title is short, expressive and meaningful
  • Consider switching the PR to a draft (Convert to draft)
    • as draft PR, the CI will be skipped for pushes
  • Relevant issues are linked in the References section
  • Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  • Commits messages are according to this guideline
    • Commit messages have the issue ID ([#123] Add posix ipc example)
    • Keep in mind to use the same email that was used to sign the Eclipse Contributor Agreement
  • Tests follow the best practice for testing
  • Changelog updated in the unreleased section including API breaking changes

PR Reviewer Reminders

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

References

Relates #1742

@orecham
orecham force-pushed the iox2-1742-add-mapping-implementations-for-ros2 branch from 8567965 to b0161c2 Compare July 14, 2026 11:26
@orecham orecham self-assigned this Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.29032% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.25%. Comparing base (7744cae) to head (44d3573).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
...es/tunnel-backend/src/types/service_description.rs 62.96% 10 Missing ⚠️
iceoryx2-services/tunnel/src/ports/event.rs 50.00% 1 Missing ⚠️
...yx2-services/tunnel/src/ports/publish_subscribe.rs 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #1822    +/-   ##
========================================
  Coverage   76.24%   76.25%            
========================================
  Files         439      440     +1     
  Lines       43928    44047   +119     
  Branches     1359     1359            
========================================
+ Hits        33493    33588    +95     
- Misses       9316     9340    +24     
  Partials     1119     1119            
Flag Coverage Δ
CPP 62.96% <ø> (ø)
Rust 76.14% <61.29%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
iceoryx2-services/tunnel/src/ports/event.rs 73.07% <50.00%> (ø)
...yx2-services/tunnel/src/ports/publish_subscribe.rs 77.34% <50.00%> (ø)
...es/tunnel-backend/src/types/service_description.rs 92.00% <62.96%> (-4.02%) ⬇️

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@orecham
orecham force-pushed the iox2-1742-add-mapping-implementations-for-ros2 branch 3 times, most recently from c945c35 to 233e55b Compare July 15, 2026 10:40
@orecham
orecham force-pushed the iox2-1742-add-mapping-implementations-for-ros2 branch from 233e55b to 44d3573 Compare July 15, 2026 14:48
@orecham
orecham requested a review from elfenpiff July 15, 2026 14:48
@orecham orecham changed the title [WIP][#1742] Add mapping implementations for ROS 2 tunnel [#1742] Add mapping implementations for ROS 2 tunnel Jul 15, 2026

@elBoberido elBoberido left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed everything but the tests. They will follow soon. Just that you already get some feedback.

Comment on lines +35 to +38
let path = std::env::args()
.nth(1)
.unwrap_or_else(|| DEFAULT_MAPPING_FILE.to_string());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Food for thought. We already use clap in other examples. What do you think about also using it here too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no clap in this workspace yet. Were you asking for consistency or e.g. you think the automatic --help output is useful?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for consistency. Since this has a default value, one does not need to know the parameter to just run the example. No need to action.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to tracking issue: #1761

The examples get an overhaul in 1-2 PRs from this one, so I will add it in then.

Comment on lines +22 to +26
/// Matches `RMW_DURATION_INFINITE`. Represents unbounded.
const INFINITE: rmw_time_s = rmw_time_s {
sec: 9223372036,
nsec: 854775807,
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note that this weird numbers originate from i64::MAX which is 9223372036854775807 and the nsecs are the lower 9 decimal digits and the secs the remaining decimal digits, making infinite representable as i64::MAX in nanoseconds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is news to me (I did not look further into it), the value was taken from the RMW (which I point to in the existing comment): https://github.com/ros2/rmw/blob/rolling/rmw/include/rmw/time.h#L54

I can add the extra information if it would be useful. What was the reason you had in mind?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess just my OCD. I was wondering if these numbers are indeed infinity in RMW or maybe some copy & paste error. Having the explanation right there would help everybody who is asking this question in the future.

Comment thread integrations/ros2/tunnel-backend/src/rcl/qos.rs
Comment thread integrations/ros2/tunnel-backend/src/qos.rs
Comment thread integrations/ros2/tunnel-backend/src/testing.rs
Comment thread integrations/ros2/tunnel-backend/src/testing.rs Outdated

let topic_description = self.topic_description(topic, type_name)?;
let Some(service_description) = self.mapping.local::<S>(&topic_description) else {
return Ok(());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand why Ok is returned. Although this is a private function, it would help to have a small description to understand what the function is supposed to do or at least a comment why Ok is returned here, since the behavior is a bit unexpected.

@elBoberido elBoberido Jul 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments still do not shed some light on Ok(()) equals skip and that returning Ok(()) is not a programming error and an Err should be returned instead?

The reason I'm asking is that, depending on the viewpoint, the current behavior is a silent error if e.g. someone has a typo in a topic name. It is okay if this is the intention but I cannot derive this conclusion from the current code and documentation.

@orecham orecham Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it depends on the mapping whether or not this is an error. For instance, for the prefix mapping it deliberately wants to skip any service names not following its convention, which is not an error.

We could add a log to the StaticMapping, but that could annoying when deliberately excluding some topics since they would all noisily log that they are not mapped.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is whether the return value should then be a Ok(()) or a Ok(Foo) with Foo either being a bool that tells that the discovery found the topic or not. Or an enum like

enum DiscoveryResult {
    Found,
    NotFound,
}

But maybe I'm overthinking this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to #1761

Will tackle it in a small follow-up.

Comment thread integrations/ros2/tunnel-backend/src/mapping/static_mapping/mod.rs
Comment thread integrations/ros2/tunnel-backend/src/mapping/prefix_mapping.rs Outdated

@elBoberido elBoberido left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some minor thing in general.

Comment thread integrations/ros2/tunnel-backend/tests/prefix_mapping_tests.rs
Comment thread integrations/ros2/tunnel-backend/tests/prefix_mapping_tests.rs Outdated
Comment thread integrations/ros2/tunnel-backend/tests/static_mapping_tests.rs
Comment thread integrations/ros2/tunnel-backend/src/mapping/prefix_mapping.rs Outdated
elBoberido
elBoberido previously approved these changes Jul 22, 2026

@elBoberido elBoberido left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some documentation that could be added but that can also be done in a follow up.

@orecham
orecham merged commit 5797fbd into eclipse-iceoryx:main Jul 22, 2026
55 checks passed
@orecham
orecham deleted the iox2-1742-add-mapping-implementations-for-ros2 branch July 22, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants