orocos/rtt_ros2_integration

Reconsider service names

Closed this issue · 0 comments

We probably need to reconsider the service names again, which is required to load an RTT service provided by a plugin into a component via the PluginLoader or the loadService() operation of the deployer. The service name is not necessarily the same as the package name (which is used to first import all components, typekits and plugins provided by a package). It is also not necessarily the same as the name of the service instance after it has been loaded into a TaskContext.

Of course the same applies to rtt_ros2_node and the ros2-node service it provides, and other services that will be added soon for ROS service support, ROS actions, tf etc.

Suggestion:

  • package name: rtt_ros2_params (unchanged)
  • plugin name: params
    • for loadService("component", "params") or .provide params in the TaskBrowser
  • service instance name: params
    • for RTT::Service("params") or this->provides("params") in C++
    • for params.getParameter(...) and other operations in Orocos scripting or in the TaskBrowser
  • The global service ros also provides the params service, but only the getParameter() and setParameter() operations. Using that global service requires that the global, process-wide node has been initialized, too.
  • Likewise for rtt_ros2_node (plugin and service name lower-case node instead of Node)

Discussion:

  • Other services in RTT/OCL (e.g. scripting, marshalling, os, print) also do not have names that starts with a capital.
  • Typically components have names in CamelCase notation.
  • Service name Node was chosen for rtt_ros2_node to match the corresponding C++ class name it represent.
  • Just params (and node) mights be too generic and does not indicate that this is about ROS parameters. Risk of conflicts? Prefix with ros_ or ros2_?
  • I think for RTT::TaskContext::getProvider<ServiceType>(name) to work properly the plugin and service instance names need to match, e.g.
    • this->getProvider<rtt_ros2_params::Params>("params"), where rtt_ros2_params::Params needs to be a subclass of RTT::ServiceRequester, while the service class itself should be renamed to ParamsService.
    • Using a ServiceRequester has the advantage that other components or services can use ROS parameters without linking to a library provided by rtt_ros2_params or even rclcpp.

Originally posted by @meyerj in https://github.com/orocos/rtt_ros2_integration/pull/7/files