rosidl
rosidl copied to clipboard
Generate low-level action typesupport API
Feature request
Feature description
In order to bundle reusable logic bits within rcl
to support actions, basic access to action ID information on a per message basis is a prerequisite. And since rcl
cannot treat client library specific messages as anything but pointers void of any type, some low-level C access to that information has to be generated and exposed.
Implementation considerations
A potential solution (as suggested initially by @jacobperron) would be to generate conversion functions for the relevant message types. Elaborating on this idea, I believe we could introduce getters and setters in rosidl_action_type_support_t
to help rcl
interact with type erased messages. Generated function count totalizes 10 functions, including:
-
GoalInfo
getters from:- action goal request messages, for the action server to use.
- action goal response messages, for the action client to return.
- action result request messages, for the action server to use.
- action result response messages, for the action client to return
- action feedback messages, for the action client to filter and return.
-
GoalInfo
setters into:- action goal request messages, for the action client to set and track.
- action goal response messages, for the action server to set.
- action result request messages, for the action client to set.
- action result response messages, for the action server to set.
- action feedback messages, for the action server to set.
To this, we add 6 more functions to deal with cancellation and status updates (that use the same types for all actions):
-
GoalInfo
setter into action cancel request messages, for the action client to use. -
GoalInfo
getter from action cancel request messages, for the action client to set. -
GoalInfoArray
setter into action cancel response messages, for the action server to set. -
GoalInfoArray
getter from action cancel response messages, for the action client to track. -
GoalStatusArray
setter into action status messages, for the action server to use. -
GoalStatusArray
getter from action status messages, for the action client to filter and track.
Allocation mechanism for these messages in a type agnostic manner may also be necessary.
This scheme allows us to push most if not all action client and server logic inside rcl
, avoiding duplication in client libraries, while making use of client library specific types to ease introspection and further tinkering. We may also strip some of them and delegate on the client library, tolerating duplication to an extent.
@hidmic @jacobperron Can this be closed?
IIRC this has not been implemented. This issue is about changing typesupport packages to provide API that can help rcl
interact with action-specific fields in type erased action goals, results, and such. Instead, we ended up making most of rcl
's action API just forward type erased messages to the proper pub/sub or service/client API, and re-implemented quite a bit of action server and client functionality in client libraries.
Having said that, I don't know how relevant / likely this is at this point.
Although I think it's a nice idea, I don't foresee us doing this refactor any time soon. I think it's okay to add the "backlog" label or close altogether if you prefer (I don't have a preference).