Skip to content

Commit

Permalink
[Controller Interface] Make assign and release interfaces virtual (#1743
Browse files Browse the repository at this point in the history
)
  • Loading branch information
saikishor authored Sep 11, 2024
1 parent 4472287 commit eb4c19d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,26 @@ 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
void assign_interfaces(
virtual void assign_interfaces(
std::vector<hardware_interface::LoanedCommandInterface> && command_interfaces,
std::vector<hardware_interface::LoanedStateInterface> && 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
void release_interfaces();
virtual void release_interfaces();

CONTROLLER_INTERFACE_PUBLIC
return_type init(
Expand Down
1 change: 1 addition & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://docs.ros.org/en/rolling/p/rclcpp/generated/classrclcpp_1_1NodeOptions.html#_CPPv4N6rclcpp11NodeOptions20use_global_argumentsEb>`__ to false, to avoid getting influenced by global arguments (Issue : `#1684 <https://github.com/ros-controls/ros2_control/issues/1684>`_) (`#1694 <https://github.com/ros-controls/ros2_control/pull/1694>`_). From now on, in order to set the parameters to the controller, the ``--param-file`` option from spawner should be used.
* With (`#1683 <https://github.com/ros-controls/ros2_control/pull/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 <https://github.com/ros-controls/ros2_control/pull/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 <https://github.com/ros-controls/ros2_control/pull/1743>`_)

controller_manager
******************
Expand Down

0 comments on commit eb4c19d

Please sign in to comment.