diff --git a/controller_interface/include/controller_interface/controller_interface_base.hpp b/controller_interface/include/controller_interface/controller_interface_base.hpp index 85a3bf3428..c4a19fd8e3 100644 --- a/controller_interface/include/controller_interface/controller_interface_base.hpp +++ b/controller_interface/include/controller_interface/controller_interface_base.hpp @@ -104,11 +104,24 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy CONTROLLER_INTERFACE_PUBLIC virtual InterfaceConfiguration state_interface_configuration() const = 0; + /// Method that assigns the Loaned interfaces to the controller. + /** + * Method used by the controller_manager to assign the interfaces to the controller. + * \note When this method is overridden, the user has to also implement the `release_interfaces` + * method by overriding it to release the interfaces. + * + * \param[in] command_interfaces vector of command interfaces to be assigned to the controller. + * \param[in] state_interfaces vector of state interfaces to be assigned to the controller. + */ CONTROLLER_INTERFACE_PUBLIC virtual void assign_interfaces( std::vector && command_interfaces, std::vector && state_interfaces); + /// Method that releases the Loaned interfaces from the controller. + /** + * Method used by the controller_manager to release the interfaces from the controller. + */ CONTROLLER_INTERFACE_PUBLIC virtual void release_interfaces(); diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 097ab208b0..6402af6932 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -24,6 +24,7 @@ For details see the controller_manager section. * All chainable controllers must implement the method ``export_state_interfaces`` to export the state interfaces, similar to ``export_reference_interfaces`` method that is exporting the reference interfaces. * The controllers will now set ``use_global_arguments`` from `NodeOptions `__ to false, to avoid getting influenced by global arguments (Issue : `#1684 `_) (`#1694 `_). From now on, in order to set the parameters to the controller, the ``--param-file`` option from spawner should be used. * With (`#1683 `_) the ``rclcpp_lifecycle::State & get_state()`` and ``void set_state(const rclcpp_lifecycle::State & new_state)`` are replaced by ``rclcpp_lifecycle::State & get_lifecycle_state()`` and ``void set_lifecycle_state(const rclcpp_lifecycle::State & new_state)``. This change affects controllers and hardware. This is related to (`#1240 `_) as variant support introduces ``get_state`` and ``set_state`` methods for setting/getting state of handles. +* The ``assign_interfaces`` and ``release_interfaces`` methods are now virtual, so that the user can override them to store the interfaces into custom variable types, so that the user can have the flexibility to take the ownership of the loaned interfaces to the controller (`#1743 `_) controller_manager ******************