15 #ifndef CONTROLLER_INTERFACE__CHAINABLE_CONTROLLER_INTERFACE_HPP_
16 #define CONTROLLER_INTERFACE__CHAINABLE_CONTROLLER_INTERFACE_HPP_
20 #include <unordered_map>
23 #include "controller_interface/controller_interface_base.hpp"
24 #include "controller_interface/visibility_control.h"
25 #include "hardware_interface/handle.hpp"
27 namespace controller_interface
40 CONTROLLER_INTERFACE_PUBLIC
43 CONTROLLER_INTERFACE_PUBLIC
55 CONTROLLER_INTERFACE_PUBLIC
56 return_type
update(
const rclcpp::Time & time,
const rclcpp::Duration & period)
final;
58 CONTROLLER_INTERFACE_PUBLIC
61 CONTROLLER_INTERFACE_PUBLIC
64 CONTROLLER_INTERFACE_PUBLIC
67 CONTROLLER_INTERFACE_PUBLIC
70 CONTROLLER_INTERFACE_PUBLIC
118 const rclcpp::Time & time,
const rclcpp::Duration & period) = 0;
132 const rclcpp::Time & time,
const rclcpp::Duration & period) = 0;
136 std::vector<hardware_interface::StateInterface::SharedPtr> ordered_exported_state_interfaces_;
137 std::unordered_map<std::string, hardware_interface::StateInterface::SharedPtr>
138 exported_state_interfaces_;
140 std::vector<double> state_interfaces_values_;
146 std::vector<double> reference_interfaces_;
148 std::vector<hardware_interface::CommandInterface::SharedPtr>
149 ordered_exported_reference_interfaces_;
150 std::unordered_map<std::string, hardware_interface::CommandInterface::SharedPtr>
151 exported_reference_interfaces_;
155 bool in_chained_mode_ =
false;
Definition: chainable_controller_interface.hpp:38
virtual return_type update_and_write_commands(const rclcpp::Time &time, const rclcpp::Duration &period)=0
Execute calculations of the controller and update command interfaces.
virtual return_type update_reference_from_subscribers(const rclcpp::Time &time, const rclcpp::Duration &period)=0
Update reference from input topics when not in chained mode.
virtual std::vector< hardware_interface::CommandInterface > on_export_reference_interfaces()
Definition: chainable_controller_interface.cpp:237
std::vector< std::string > exported_reference_interface_names_
Storage of values for reference interfaces.
Definition: chainable_controller_interface.hpp:144
virtual bool on_set_chained_mode(bool chained_mode)
Virtual method that each chainable controller should implement to switch chained mode.
Definition: chainable_controller_interface.cpp:221
CONTROLLER_INTERFACE_PUBLIC bool is_in_chained_mode() const final
Get information if a controller is currently in chained mode.
Definition: chainable_controller_interface.cpp:219
CONTROLLER_INTERFACE_PUBLIC return_type update(const rclcpp::Time &time, const rclcpp::Duration &period) final
Definition: chainable_controller_interface.cpp:29
virtual std::vector< hardware_interface::StateInterface > on_export_state_interfaces()
Definition: chainable_controller_interface.cpp:224
std::vector< std::string > exported_state_interface_names_
Storage of values for state interfaces.
Definition: chainable_controller_interface.hpp:135
CONTROLLER_INTERFACE_PUBLIC bool set_chained_mode(bool chained_mode) final
Definition: chainable_controller_interface.cpp:193
CONTROLLER_INTERFACE_PUBLIC bool is_chainable() const final
Get information if a controller is chainable.
Definition: chainable_controller_interface.cpp:27
CONTROLLER_INTERFACE_PUBLIC std::vector< hardware_interface::CommandInterface::SharedPtr > export_reference_interfaces() final
Definition: chainable_controller_interface.cpp:113
CONTROLLER_INTERFACE_PUBLIC std::vector< hardware_interface::StateInterface::ConstSharedPtr > export_state_interfaces() final
Definition: chainable_controller_interface.cpp:49
Definition: controller_interface_base.hpp:99