-
Notifications
You must be signed in to change notification settings - Fork 163
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
Public API for remap_rule_t / node_option_t::arguments::remap_rules? #998
Comments
Friendly ping. Would a PR which adds the described access/functionality be considered for inclusion into |
@gavanderhoorn IMO, i am thinking
besides, we do not need to break the userspace to modify the interfaces if that is hidden in the implementation? CC: @ros2/team |
I don't believe so, no. And it looks like at least initially #254 seemed to be going in the direction of what I wrote in the OP, but only the " |
I think this is totally reasonable. Though if we're worried about someone using CRUD operations to get the That's all to say, I think adding CRUD is fine and I would review such a pr, but I'd also be fine with a single new function that allows us to initialize the data structure once programmatically. I agree that creating fake arguments just to initialize the structure is not necessary. |
For what it's worth, I always wanted this separation up to the nodes too, e.g. I wanted the |
Coming back to this after (quite) some time, I've investigated what exactly I would need for my application (a bit selfish, I know, but that's how it is unfortunately). Context: I have a list of remap rules in a Currently, I iterate over those and construct the faux To do this without the rcl_ret_t
rcl_arguments_add_remap_rule(
rcl_arguments_t * arguments,
rcl_remap_t * remap_rule,
rcl_allocator_t allocator); and make rcl_ret_t
rcl_arguments_add_remap_rule(
rcl_arguments_t * arguments,
const char * remap_str,
rcl_allocator_t allocator); This would not require making Both of these options would allow 'injecting' I fully admit this is less well-rounded than what I believe @wjwwood described in his comment(s), and I'm also unsure as to whether it's a nice enough addition to be merged here (ie: does it fit style-wise, as it would seem to introduce (quite some) asymmetry, given only Refactoring the current implementation to work with intermediary representations of arguments and then adding CRUD functionality for those data structs would be nice(r), but would also be much more work than I need right now. Would something like this be acceptable? |
Feature request
Feature description
tl;dr: provide API to CRUD
rcl_remap_t
types and access/populatenode_options_t::arguments::remap_rules
without having to go throughrcl_parse_arguments(..)
(with a 'fake'argv
).longer:
The current implementation of
node_options_t
and related functions completely hide all CRUD operations onrcl_remap_t
types. Additionally,node_options_t::rcl_arguments_t
contains a list ofrcl_remap_t
instances which is also inaccessible (due to the use ofrcl_arguments_impl_t
).For 'normal' implementations of client libraries, this seems to make sense: all they have to do is call
rcl_parse_arguments(argc, argv, ...)
and they'll get a correctly initialised and populatednode_options_t
which they can then pass to functions likerclc_node_init_with_options(..)
.On systems that do not have command lines, or don't allow or can't give access to command lines, this implementation seems to make things more complex than it appears to have to be.
An example of this is
rclcpp::ComponentManager
, which as part ofComponentManager::on_load_node(..)
callsComponentManager::create_node_options(..)
which essentially constructs a fauxargv
-- based on the incoming service request fields -- which it then passes to rclcpp::NodeOptions(..) which basically usesrcl_parse_arguments(..)
again.Similar to
rclcpp::ComponentManager
, my system also already has remap tuples in a list, which I could use to populate node_options_t::arguments::remap_rules instead of doing whatComponentManager::create_node_options(..)
does.The current implementation doesn't appear to support that however.
Allowing access to this could simplify code in
rclcpp
as well as make it much more straightforward for systems which do not get their 'arguments' from a command line to initialise anode_options_t
structure.Implementation considerations
My assumption is that this is currently not supported (and
rcl_parse_arguments(..)
the only entry-point) to guarantee correct parsing and initialisation of remap rules and other parameters.A potential implementation which would allow access to
node_options_t::arguments::remap_rules
could still use the current code -- and thus keep all checks and safe-guards in place -- it would just not be completely hidden behindrcl_parse_arguments(..)
. Doing-the-right-thing(s) (ie: in the right order) would then be the responsibility of callers of the new API. That would not be different from how other APIs in RCL are designed.There is already rcl/remap.h, but this appears to provide access to the actual remapping functionality (ie: it consumes the results of
rcl_parse_arguments(..)
).Perhaps some additional functions could be added which allow CRUD operations on
node_options_t::arguments::remap_rules
in an instance ofnode_options_t::arguments
?Edit: initially I thought/hoped #254 made already did this, but it looks like that's changing the consuming side (ie: in
rcl_remap.h
).The text was updated successfully, but these errors were encountered: