15#ifndef SEMANTIC_COMPONENTS__SEMANTIC_COMPONENT_INTERFACE_HPP_
16#define SEMANTIC_COMPONENTS__SEMANTIC_COMPONENT_INTERFACE_HPP_
21#include "controller_interface/helpers.hpp"
22#include "hardware_interface/loaned_state_interface.hpp"
24namespace semantic_components
26template <
typename MessageReturnType>
33 interface_names_.reserve(size);
34 state_interfaces_.reserve(size);
46 std::vector<hardware_interface::LoanedStateInterface> & state_interfaces)
48 return controller_interface::get_ordered_interfaces(
49 state_interfaces, interface_names_,
"", state_interfaces_);
66 if (interface_names_.empty())
68 for (
auto i = 0u; i < interface_names_.capacity(); ++i)
70 interface_names_.emplace_back(name_ +
"/" + std::to_string(i + 1));
73 return interface_names_;
83 if (values.capacity() != state_interfaces_.size())
88 for (
size_t i = 0; i < state_interfaces_.size(); ++i)
90 values.emplace_back(state_interfaces_[i].get().get_value());
103 std::vector<std::string> interface_names_;
104 std::vector<std::reference_wrapper<hardware_interface::LoanedStateInterface>> state_interfaces_;
Definition semantic_component_interface.hpp:28
bool get_values(std::vector< double > &values) const
Return all values.
Definition semantic_component_interface.hpp:80
bool assign_loaned_state_interfaces(std::vector< hardware_interface::LoanedStateInterface > &state_interfaces)
Assign loaned state interfaces from the hardware.
Definition semantic_component_interface.hpp:45
bool get_values_as_message(MessageReturnType &)
Return values as MessageReturnType.
Definition semantic_component_interface.hpp:99
virtual std::vector< std::string > get_state_interface_names()
Definition of state interface names for the component.
Definition semantic_component_interface.hpp:64
void release_interfaces()
Release loaned interfaces from the hardware.
Definition semantic_component_interface.hpp:53