add expand_action_name APIs to action client and server #2601
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that ROS 2 action clients and servers don't have an API equivalent to
get_topic_name
orget_service_name
that you can find in publishers, subscriptions, etc.I often needed this API in my applications and I always end up with some ugly thing that would be better handled by the client library.
So I went to try to implement it... but I quickly discovered that the logic that we normally use for topics and services is not directly applicable to actions.
rcl actions don't store such name, moreover it looks like actions ignore remapping rules?
Looking at the RCL code I see that we don't have a remapping type for actions (only for namespaces, nodes, topics and services).
I guess that users could try to remap the underlying topics and services individually, but that seems the most error prone and ugly thing to do.
I tried to solve this issue at the rclcpp level, by providing an API that at least expands the namespace.
The API is named differently from its topics and services counterpart and has a different return type, to denote that it works differently.
It's not just a lookup, it's doing string manipulations with a non-negligible performance impact.
Let me know what you think