From d33d67b5069f70e6af5635bcefa7e74aee084fbb Mon Sep 17 00:00:00 2001 From: Manuel M Date: Fri, 15 Dec 2023 09:22:16 +0100 Subject: [PATCH] add export_of_description and creation of loans for system --- .../include/hardware_interface/actuator.hpp | 8 + .../hardware_interface/actuator_interface.hpp | 20 ++ .../include/hardware_interface/sensor.hpp | 4 + .../hardware_interface/sensor_interface.hpp | 12 + .../include/hardware_interface/system.hpp | 8 + .../hardware_interface/system_interface.hpp | 16 +- hardware_interface/src/actuator.cpp | 10 + hardware_interface/src/resource_manager.cpp | 219 +++++++++++++----- hardware_interface/src/sensor.cpp | 5 + hardware_interface/src/system.cpp | 10 + 10 files changed, 258 insertions(+), 54 deletions(-) diff --git a/hardware_interface/include/hardware_interface/actuator.hpp b/hardware_interface/include/hardware_interface/actuator.hpp index 4082863370..f5de610117 100644 --- a/hardware_interface/include/hardware_interface/actuator.hpp +++ b/hardware_interface/include/hardware_interface/actuator.hpp @@ -21,6 +21,8 @@ #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_command_interface.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/visibility_control.h" #include "rclcpp/duration.hpp" @@ -70,6 +72,12 @@ class Actuator final HARDWARE_INTERFACE_PUBLIC std::vector export_command_interfaces(); + HARDWARE_INTERFACE_PUBLIC + LoanedCommandInterface create_loaned_command_interface(const std::string & interface_name); + + HARDWARE_INTERFACE_PUBLIC + LoanedStateInterface create_loaned_state_interface(const std::string & interface_name); + HARDWARE_INTERFACE_PUBLIC return_type prepare_command_mode_switch( const std::vector & start_interfaces, diff --git a/hardware_interface/include/hardware_interface/actuator_interface.hpp b/hardware_interface/include/hardware_interface/actuator_interface.hpp index abfd8eb45a..0716cdd4b2 100644 --- a/hardware_interface/include/hardware_interface/actuator_interface.hpp +++ b/hardware_interface/include/hardware_interface/actuator_interface.hpp @@ -15,12 +15,15 @@ #ifndef HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_ #define HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_ +#include #include #include #include #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_command_interface.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" @@ -122,6 +125,16 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod */ virtual std::vector export_command_interfaces() = 0; + virtual LoanedCommandInterface create_loaned_command_interface(const std::string & interface_name) + { + return LoanedCommandInterface(joint_commands_.at(interface_name)); + } + + virtual LoanedStateInterface create_loaned_state_interface(const std::string & interface_name) + { + return LoanedStateInterface(joint_states_.at(interface_name)); + } + /// Prepare for a new command interface switch. /** * Prepare for any mode-switching required by the new command interface combination. @@ -204,6 +217,13 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod protected: HardwareInfo info_; + std::vector joint_states_descriptions_; + std::vector joint_commands_descriptions_; + +private: + std::map joint_states_; + std::map joint_commands_; + rclcpp_lifecycle::State lifecycle_state_; }; diff --git a/hardware_interface/include/hardware_interface/sensor.hpp b/hardware_interface/include/hardware_interface/sensor.hpp index 5d0677c587..c9384c5246 100644 --- a/hardware_interface/include/hardware_interface/sensor.hpp +++ b/hardware_interface/include/hardware_interface/sensor.hpp @@ -22,6 +22,7 @@ #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/visibility_control.h" #include "rclcpp/duration.hpp" @@ -68,6 +69,9 @@ class Sensor final HARDWARE_INTERFACE_PUBLIC std::vector export_state_interfaces(); + HARDWARE_INTERFACE_PUBLIC + LoanedStateInterface create_loaned_state_interface(const std::string & interface_name); + HARDWARE_INTERFACE_PUBLIC std::string get_name() const; diff --git a/hardware_interface/include/hardware_interface/sensor_interface.hpp b/hardware_interface/include/hardware_interface/sensor_interface.hpp index 14a59e4588..a3d45c6dfe 100644 --- a/hardware_interface/include/hardware_interface/sensor_interface.hpp +++ b/hardware_interface/include/hardware_interface/sensor_interface.hpp @@ -15,12 +15,14 @@ #ifndef HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_ #define HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_ +#include #include #include #include #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/types/lifecycle_state_names.hpp" #include "lifecycle_msgs/msg/state.hpp" @@ -111,6 +113,11 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI */ virtual std::vector export_state_interfaces() = 0; + virtual LoanedStateInterface create_loaned_state_interface(const std::string & interface_name) + { + return LoanedStateInterface(sensor_states_.at(interface_name)); + } + /// Read the current state values from the actuator. /** * The data readings from the physical hardware has to be updated @@ -143,6 +150,11 @@ class SensorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI protected: HardwareInfo info_; + std::vector sensor_states_descriptions_; + +private: + std::map sensor_states_; + rclcpp_lifecycle::State lifecycle_state_; }; diff --git a/hardware_interface/include/hardware_interface/system.hpp b/hardware_interface/include/hardware_interface/system.hpp index aebdfe952d..85eea550d4 100644 --- a/hardware_interface/include/hardware_interface/system.hpp +++ b/hardware_interface/include/hardware_interface/system.hpp @@ -22,6 +22,8 @@ #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_command_interface.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/visibility_control.h" #include "rclcpp/duration.hpp" @@ -77,6 +79,12 @@ class System final HARDWARE_INTERFACE_PUBLIC std::vector export_command_interface_descriptions(); + HARDWARE_INTERFACE_PUBLIC + LoanedCommandInterface create_loaned_command_interface(const std::string & interface_name); + + HARDWARE_INTERFACE_PUBLIC + LoanedStateInterface create_loaned_state_interface(const std::string & interface_name); + HARDWARE_INTERFACE_PUBLIC return_type prepare_command_mode_switch( const std::vector & start_interfaces, diff --git a/hardware_interface/include/hardware_interface/system_interface.hpp b/hardware_interface/include/hardware_interface/system_interface.hpp index 72563aafaf..7b54495a81 100644 --- a/hardware_interface/include/hardware_interface/system_interface.hpp +++ b/hardware_interface/include/hardware_interface/system_interface.hpp @@ -25,6 +25,8 @@ #include "hardware_interface/component_parser.hpp" #include "hardware_interface/handle.hpp" #include "hardware_interface/hardware_info.hpp" +#include "hardware_interface/loaned_command_interface.hpp" +#include "hardware_interface/loaned_state_interface.hpp" #include "hardware_interface/types/hardware_component_type_values.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "hardware_interface/types/hardware_interface_type_values.hpp" @@ -161,7 +163,7 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI * * \return vector of InterfaceDescription */ - virtual std::vector export_state_interface_descriptions() + virtual std::vector export_state_interface_descriptions() const { std::vector state_interface_descriptions; state_interface_descriptions.reserve( @@ -189,7 +191,7 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI * * \return vector of InterfaceDescription */ - virtual std::vector export_command_interface_descriptions() + virtual std::vector export_command_interface_descriptions() const { std::vector command_interface_descriptions; command_interface_descriptions.reserve( @@ -265,6 +267,16 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI return command_interfaces; } + virtual LoanedCommandInterface create_loaned_command_interface(const std::string & interface_name) + { + return LoanedCommandInterface(joint_commands_.at(interface_name)); + } + + virtual LoanedStateInterface create_loaned_state_interface(const std::string & interface_name) + { + return LoanedStateInterface(joint_states_.at(interface_name)); + } + /// Prepare for a new command interface switch. /** * Prepare for any mode-switching required by the new command interface combination. diff --git a/hardware_interface/src/actuator.cpp b/hardware_interface/src/actuator.cpp index 694e92355e..bfde7d92b5 100644 --- a/hardware_interface/src/actuator.cpp +++ b/hardware_interface/src/actuator.cpp @@ -198,6 +198,16 @@ std::vector Actuator::export_command_interfaces() return impl_->export_command_interfaces(); } +LoanedCommandInterface Actuator::create_loaned_command_interface(const std::string & interface_name) +{ + return impl_->create_loaned_command_interface(interface_name); +} + +LoanedStateInterface Actuator::create_loaned_state_interface(const std::string & interface_name) +{ + return impl_->create_loaned_state_interface(interface_name); +} + return_type Actuator::prepare_command_mode_switch( const std::vector & start_interfaces, const std::vector & stop_interfaces) diff --git a/hardware_interface/src/resource_manager.cpp b/hardware_interface/src/resource_manager.cpp index 7cfdfc238e..b267890334 100644 --- a/hardware_interface/src/resource_manager.cpp +++ b/hardware_interface/src/resource_manager.cpp @@ -89,10 +89,11 @@ class ResourceStorage { } + // TODO(Manuel): review regarding simplifications and checking for duplicates template - void load_hardware( + std::string load_hardware( const HardwareInfo & hardware_info, pluginlib::ClassLoader & loader, - std::vector & container) + std::map & container) { RCUTILS_LOG_INFO_NAMED( "resource_manager", "Loading hardware '%s' ", hardware_info.name.c_str()); @@ -100,17 +101,21 @@ class ResourceStorage auto interface = std::unique_ptr( loader.createUnmanagedInstance(hardware_info.hardware_plugin_name)); HardwareT hardware(std::move(interface)); - container.emplace_back(std::move(hardware)); // initialize static data about hardware component to reduce later calls HardwareComponentInfo component_info; component_info.name = hardware_info.name; component_info.type = hardware_info.type; component_info.plugin_name = hardware_info.hardware_plugin_name; component_info.is_async = hardware_info.is_async; - hardware_info_map_.insert(std::make_pair(component_info.name, component_info)); hardware_used_by_controllers_.insert( std::make_pair(component_info.name, std::vector())); + + // TODO(Manuel): review regarding simplifications and checking for duplicates + std::string hw_name = hardware.get_name(); + assert(hw_name == component_info.name); + container.insert(std::make_pair(hw_name, std::move(hardware))); + return hw_name; } template @@ -446,16 +451,17 @@ class ResourceStorage available_state_interfaces_.capacity() + interface_names.size()); } - template - void import_state_interface_descriptions(HardwareT & hardware) + void import_system_state_interface_descriptions(System & hardware) { auto interface_descriptions = hardware.export_state_interface_descriptions(); std::vector interface_names; interface_names.reserve(interface_descriptions.size()); + std::string hw_name = hardware.get_name(); for (auto & description : interface_descriptions) { auto key = description.get_name(); - state_interface_descriptions_map_.emplace(std::make_pair(key, description)); + state_interface_descriptions_.emplace(std::make_pair(key, description)); + state_interface_to_component_name_.emplace(std::make_pair(key, hw_name)); interface_names.push_back(key); } hardware_info_map_[hardware.get_name()].state_interfaces = interface_names; @@ -514,7 +520,7 @@ class ResourceStorage for (auto & description : interface_descriptions) { auto key = description.get_name(); - command_interface_descriptions_map_.emplace(std::make_pair(key, description)); + command_interface_descriptions_.emplace(std::make_pair(key, description)); claimed_command_interface_map_.emplace(std::make_pair(key, false)); interface_names.push_back(key); } @@ -551,16 +557,18 @@ class ResourceStorage } // TODO(destogl): Propagate "false" up, if happens in initialize_hardware + // TODO(Manuel): review regarding simplifications and checking for duplicates void load_and_initialize_actuator(const HardwareInfo & hardware_info) { auto load_and_init_actuators = [&](auto & container) { check_for_duplicates(hardware_info); - load_hardware(hardware_info, actuator_loader_, container); - if (initialize_hardware(hardware_info, container.back())) + std::string loaded_hw = + load_hardware(hardware_info, actuator_loader_, container); + if (initialize_hardware(hardware_info, container.at(loaded_hw))) { - import_state_interfaces(container.back()); - import_command_interfaces(container.back()); + import_state_interfaces(container.at(loaded_hw)); + import_command_interfaces(container.at(loaded_hw)); } else { @@ -581,15 +589,17 @@ class ResourceStorage } } + // TODO(Manuel): review regarding simplifications and checking for duplicates void load_and_initialize_sensor(const HardwareInfo & hardware_info) { auto load_and_init_sensors = [&](auto & container) { check_for_duplicates(hardware_info); - load_hardware(hardware_info, sensor_loader_, container); - if (initialize_hardware(hardware_info, container.back())) + std::string loaded_hw = + load_hardware(hardware_info, sensor_loader_, container); + if (initialize_hardware(hardware_info, container.at(loaded_hw))) { - import_state_interfaces(container.back()); + import_state_interfaces(container.at(loaded_hw)); } else { @@ -610,16 +620,18 @@ class ResourceStorage } } + // TODO(Manuel): review regarding simplifications and checking for duplicates void load_and_initialize_system(const HardwareInfo & hardware_info) { auto load_and_init_systems = [&](auto & container) { check_for_duplicates(hardware_info); - load_hardware(hardware_info, system_loader_, container); - if (initialize_hardware(hardware_info, container.back())) + std::string loaded_hw = + load_hardware(hardware_info, system_loader_, container); + if (initialize_hardware(hardware_info, container.at(loaded_hw))) { - import_state_interface_descriptions(container.back()); - import_command_interface_descriptions(container.back()); + import_system_state_interface_descriptions(container.at(loaded_hw)); + import_command_interface_descriptions(container.at(loaded_hw)); } else { @@ -640,16 +652,19 @@ class ResourceStorage } } + // TODO(Manuel): review regarding simplifications and checking for duplicates void initialize_actuator( std::unique_ptr actuator, const HardwareInfo & hardware_info) { auto init_actuators = [&](auto & container) { - container.emplace_back(Actuator(std::move(actuator))); - if (initialize_hardware(hardware_info, container.back())) + Actuator act(std::move(actuator)); + std::string hw_name = act.get_name(); + container.insert(std::make_pair(hw_name, std::move(act))); + if (initialize_hardware(hardware_info, container.at(hw_name))) { - import_state_interfaces(container.back()); - import_command_interfaces(container.back()); + import_state_interfaces(container.at(hw_name)); + import_command_interfaces(container.at(hw_name)); } else { @@ -675,10 +690,12 @@ class ResourceStorage { auto init_sensors = [&](auto & container) { - container.emplace_back(Sensor(std::move(sensor))); - if (initialize_hardware(hardware_info, container.back())) + Sensor sens(std::move(sensor)); + std::string hw_name = sens.get_name(); + container.insert(std::make_pair(hw_name, std::move(sens))); + if (initialize_hardware(hardware_info, container.at(hw_name))) { - import_state_interfaces(container.back()); + import_state_interfaces(container.at(hw_name)); } else { @@ -704,11 +721,13 @@ class ResourceStorage { auto init_systems = [&](auto & container) { - container.emplace_back(System(std::move(system))); - if (initialize_hardware(hardware_info, container.back())) + System sys(std::move(system)); + std::string hw_name = sys.get_name(); + container.insert(std::make_pair(hw_name, std::move(sys))); + if (initialize_hardware(hardware_info, container.at(hw_name))) { - import_state_interface_descriptions(container.back()); - import_command_interface_descriptions(container.back()); + import_system_state_interface_descriptions(container.at(hw_name)); + import_command_interface_descriptions(container.at(hw_name)); } else { @@ -729,18 +748,114 @@ class ResourceStorage } } + template + std::pair find_component( + const std::string & state_interface_name, Container & components) + { + auto found_component_it = components.find(state_interface_name); + return {found_component_it != components.end(), found_component_it}; + } + + template + std::pair find_component_name_for_interface( + const std::string & interface_name, Container & components) + { + auto component_name_it = components.find(interface_name); + if (component_name_it != components.end()) + { + return {true, component_name_it->second}; + } + return {false, ""}; + } + + LoanedStateInterface get_loand_state_interface(const std::string state_interface_name) + { + auto [found, component_name] = + find_component_name_for_interface(state_interface_name, state_interface_to_component_name_); + if (!found) + { + // TODO(Manuel) we should probably throw + } + + auto [found_act, actutator] = find_component(component_name, actuators_); + if (found_act) + { + return actutator->second.create_loaned_state_interface(state_interface_name); + } + auto [found_sens, sensor] = find_component(component_name, sensors_); + if (found_sens) + { + return sensor->second.create_loaned_state_interface(state_interface_name); + } + auto [found_sys, system] = find_component(component_name, systems_); + if (found_sys) + { + return system->second.create_loaned_state_interface(state_interface_name); + } + auto [found_async_act, async_acturator] = find_component(component_name, async_actuators_); + if (found_async_act) + { + return async_acturator->second.create_loaned_state_interface(state_interface_name); + } + auto [found_async_sens, asysnc_sensor] = find_component(component_name, async_sensors_); + if (found_async_sens) + { + return asysnc_sensor->second.create_loaned_state_interface(state_interface_name); + } + auto [found_async_sys, async_sys] = find_component(component_name, async_systems_); + // Inverted so that compiler is not complaining that we don't return anything... + if (!found_async_sys) + { + // TODO(Manuel) we should probably throw here something + } + return async_sys->second.create_loaned_state_interface(state_interface_name); + } + + LoanedCommandInterface get_loaned_command_interface(const std::string command_interface_name) + { + auto [found, component_name] = find_component_name_for_interface( + command_interface_name, command_interface_to_component_name_); + if (!found) + { + // TODO(Manuel) we should probably throw + } + + auto [found_act, actutator] = find_component(component_name, actuators_); + if (found_act) + { + return actutator->second.create_loaned_command_interface(command_interface_name); + } + auto [found_sys, system] = find_component(component_name, systems_); + if (found_sys) + { + return system->second.create_loaned_command_interface(command_interface_name); + } + auto [found_async_act, async_acturator] = find_component(component_name, async_actuators_); + if (found_async_act) + { + return async_acturator->second.create_loaned_command_interface(command_interface_name); + } + auto [found_async_sys, async_sys] = find_component(component_name, async_systems_); + // Inverted so that compiler is not complaining that we don't return anything... + if (!found_async_sys) + { + // TODO(Manuel) we should probably throw here something + } + return async_sys->second.create_loaned_command_interface(command_interface_name); + } + // hardware plugins pluginlib::ClassLoader actuator_loader_; pluginlib::ClassLoader sensor_loader_; pluginlib::ClassLoader system_loader_; - std::vector actuators_; - std::vector sensors_; - std::vector systems_; + std::map actuators_; + std::map sensors_; + std::map systems_; - std::vector async_actuators_; - std::vector async_sensors_; - std::vector async_systems_; + std::map async_actuators_; + std::map async_sensors_; + std::map async_systems_; std::unordered_map hardware_info_map_; @@ -752,10 +867,12 @@ class ResourceStorage /// Storage of all available state interfaces std::map state_interface_map_; - std::map state_interface_descriptions_map_; + std::map state_interface_descriptions_; + std::map state_interface_to_component_name_; /// Storage of all available command interfaces std::map command_interface_map_; - std::map command_interface_descriptions_map_; + std::map command_interface_descriptions_; + std::map command_interface_to_component_name_; /// Vectors with interfaces available to controllers (depending on hardware component state) std::vector available_state_interfaces_; @@ -844,8 +961,8 @@ bool ResourceManager::is_urdf_already_loaded() const { return is_urdf_loaded__; bool ResourceManager::component_creates_loaned_state(const std::string & key) { std::lock_guard guard(resource_interfaces_lock_); - return resource_storage_->state_interface_descriptions_map_.find(key) != - resource_storage_->state_interface_descriptions_map_.end(); + return resource_storage_->state_interface_descriptions_.find(key) != + resource_storage_->state_interface_descriptions_.end(); } // CM API: Called in "update"-thread @@ -861,7 +978,7 @@ LoanedStateInterface ResourceManager::claim_state_interface(const std::string & // the loans. if (component_creates_loaned_state(key)) { - // TOD(Manuel) implement exporting of loans by components + return resource_storage_->get_loand_state_interface(key); } return LoanedStateInterface(resource_storage_->state_interface_map_.at(key)); } @@ -1109,7 +1226,7 @@ std::unordered_map ResourceManager::get_comp { auto loop_and_get_state = [&](auto & container) { - for (auto & component : container) + for (const auto & [key, component] : container) { resource_storage_->hardware_info_map_[component.get_name()].state = component.get_state(); } @@ -1148,7 +1265,7 @@ bool ResourceManager::prepare_command_mode_switch( return ss.str(); }; - for (auto & component : resource_storage_->actuators_) + for (auto & [key, component] : resource_storage_->actuators_) { if (return_type::OK != component.prepare_command_mode_switch(start_interfaces, stop_interfaces)) { @@ -1158,7 +1275,7 @@ bool ResourceManager::prepare_command_mode_switch( return false; } } - for (auto & component : resource_storage_->systems_) + for (auto & [key, component] : resource_storage_->systems_) { if (return_type::OK != component.prepare_command_mode_switch(start_interfaces, stop_interfaces)) { @@ -1176,7 +1293,7 @@ bool ResourceManager::perform_command_mode_switch( const std::vector & start_interfaces, const std::vector & stop_interfaces) { - for (auto & component : resource_storage_->actuators_) + for (auto & [key, component] : resource_storage_->actuators_) { if (return_type::OK != component.perform_command_mode_switch(start_interfaces, stop_interfaces)) { @@ -1186,7 +1303,7 @@ bool ResourceManager::perform_command_mode_switch( return false; } } - for (auto & component : resource_storage_->systems_) + for (auto & [key, component] : resource_storage_->systems_) { if (return_type::OK != component.perform_command_mode_switch(start_interfaces, stop_interfaces)) { @@ -1245,13 +1362,11 @@ return_type ResourceManager::set_component_state( auto find_set_component_state = [&](auto action, auto & components) { - auto found_component_it = std::find_if( - components.begin(), components.end(), - [&](const auto & component) { return component.get_name() == component_name; }); + auto found_component_it = components.find(component_name); if (found_component_it != components.end()) { - if (action(*found_component_it, target_state)) + if (action(found_component_it->second, target_state)) { result = return_type::OK; } @@ -1311,7 +1426,7 @@ HardwareReadWriteStatus ResourceManager::read( auto read_components = [&](auto & components) { - for (auto & component : components) + for (auto & [key, component] : components) { auto ret_val = component.read(time, period); if (ret_val == return_type::ERROR) @@ -1351,7 +1466,7 @@ HardwareReadWriteStatus ResourceManager::write( auto write_components = [&](auto & components) { - for (auto & component : components) + for (auto & [key, component] : components) { auto ret_val = component.write(time, period); if (ret_val == return_type::ERROR) diff --git a/hardware_interface/src/sensor.cpp b/hardware_interface/src/sensor.cpp index ade9b8781a..72ee37d5f1 100644 --- a/hardware_interface/src/sensor.cpp +++ b/hardware_interface/src/sensor.cpp @@ -189,6 +189,11 @@ std::vector Sensor::export_state_interfaces() return impl_->export_state_interfaces(); } +LoanedStateInterface Sensor::create_loaned_state_interface(const std::string & interface_name) +{ + return impl_->create_loaned_state_interface(interface_name); +} + std::string Sensor::get_name() const { return impl_->get_name(); } const rclcpp_lifecycle::State & Sensor::get_state() const { return impl_->get_state(); } diff --git a/hardware_interface/src/system.cpp b/hardware_interface/src/system.cpp index aff18c32b6..f9a27c5bd4 100644 --- a/hardware_interface/src/system.cpp +++ b/hardware_interface/src/system.cpp @@ -204,6 +204,16 @@ std::vector System::export_command_interfaces() return impl_->export_command_interfaces(); } +LoanedCommandInterface System::create_loaned_command_interface(const std::string & interface_name) +{ + return impl_->create_loaned_command_interface(interface_name); +} + +LoanedStateInterface System::create_loaned_state_interface(const std::string & interface_name) +{ + return impl_->create_loaned_state_interface(interface_name); +} + return_type System::prepare_command_mode_switch( const std::vector & start_interfaces, const std::vector & stop_interfaces)