[#1742] Add mapping implementations for ROS 2 tunnel#1822
Conversation
8567965 to
b0161c2
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
c945c35 to
233e55b
Compare
233e55b to
44d3573
Compare
elBoberido
left a comment
There was a problem hiding this comment.
Reviewed everything but the tests. They will follow soon. Just that you already get some feedback.
| let path = std::env::args() | ||
| .nth(1) | ||
| .unwrap_or_else(|| DEFAULT_MAPPING_FILE.to_string()); | ||
|
|
There was a problem hiding this comment.
Food for thought. We already use clap in other examples. What do you think about also using it here too?
There was a problem hiding this comment.
There's no clap in this workspace yet. Were you asking for consistency or e.g. you think the automatic --help output is useful?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Added to tracking issue: #1761
The examples get an overhaul in 1-2 PRs from this one, so I will add it in then.
| /// Matches `RMW_DURATION_INFINITE`. Represents unbounded. | ||
| const INFINITE: rmw_time_s = rmw_time_s { | ||
| sec: 9223372036, | ||
| nsec: 854775807, | ||
| }; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
|
||
| let topic_description = self.topic_description(topic, type_name)?; | ||
| let Some(service_description) = self.mapping.local::<S>(&topic_description) else { | ||
| return Ok(()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I added it to #1761
Will tackle it in a small follow-up.
elBoberido
left a comment
There was a problem hiding this comment.
Looks good. Just some minor thing in general.
…es default rmw qos
elBoberido
left a comment
There was a problem hiding this comment.
Looks good. Just some documentation that could be added but that can also be done in a follow up.
Notes for Reviewer
Adds the following
Mappingimplementations:PrefixMapping- dynamic mapping of services with the prefixros2://topics/to ROS 2 topicsStaticMapping- static mapping of services to topics explicitly specified by configurationPre-Review Checklist for the PR Author
Convert to draft)iox2-123-introduce-posix-ipc-example)[#123] Add posix ipc example)Changelog updated in the unreleased section including API breaking changesPR Reviewer Reminders
References
Relates #1742