17#ifndef FAKE_COMPONENTS__GENERIC_SYSTEM_HPP_
18#define FAKE_COMPONENTS__GENERIC_SYSTEM_HPP_
23#include "hardware_interface/handle.hpp"
24#include "hardware_interface/hardware_info.hpp"
25#include "hardware_interface/system_interface.hpp"
26#include "hardware_interface/types/hardware_interface_return_values.hpp"
27#include "hardware_interface/types/hardware_interface_type_values.hpp"
29using hardware_interface::return_type;
31namespace fake_components
38 std::vector<hardware_interface::StateInterface> export_state_interfaces()
override;
40 std::vector<hardware_interface::CommandInterface> export_command_interfaces()
override;
42 return_type read()
override;
44 return_type
write()
override {
return return_type::OK; }
54 const std::vector<std::string> standard_interfaces_ = {
58 const size_t POSITION_INTERFACE_INDEX = 0;
62 std::size_t joint_index;
63 std::size_t mimicked_joint_index;
64 double multiplier = 1.0;
66 std::vector<MimicJoint> mimic_joints_;
70 std::vector<std::vector<double>> joint_states_;
72 std::vector<std::string> other_interfaces_;
75 std::vector<std::vector<double>> other_states_;
77 std::vector<std::string> sensor_interfaces_;
80 std::vector<std::vector<double>> sensor_states_;
82 std::vector<std::string> gpio_interfaces_;
85 std::vector<std::vector<double>> gpio_commands_;
86 std::vector<std::vector<double>> gpio_states_;
89 template <
typename HandleType>
91 const std::string & name,
const std::vector<std::string> & interface_list,
92 const std::string & interface_name,
const size_t vector_index,
93 std::vector<std::vector<double>> & values, std::vector<HandleType> & interfaces);
95 void initialize_storage_vectors(
96 std::vector<std::vector<double>> & commands, std::vector<std::vector<double>> & states,
97 const std::vector<std::string> & interfaces);
99 void populate_gpio_interfaces();
101 bool fake_gpio_command_interfaces_;
102 bool fake_sensor_command_interfaces_;
103 double position_state_following_offset_;
104 std::string custom_interface_with_following_offset_;
105 size_t index_custom_interface_with_following_offset_;
Definition generic_system.hpp:34
std::vector< std::vector< double > > other_commands_
The size of this vector is (other_interfaces_.size() x nr_joints)
Definition generic_system.hpp:74
return_type write() override
Write the current command values to the actuator.
Definition generic_system.hpp:44
std::vector< std::vector< double > > gpio_fake_commands_
The size of this vector is (gpio_interfaces_.size() x nr_joints)
Definition generic_system.hpp:84
std::vector< std::vector< double > > joint_commands_
The size of this vector is (standard_interfaces_.size() x nr_joints)
Definition generic_system.hpp:69
std::vector< std::vector< double > > sensor_fake_commands_
The size of this vector is (sensor_interfaces_.size() x nr_joints)
Definition generic_system.hpp:79
Virtual Class to implement when integrating a complex system into ros2_control.
Definition system_interface.hpp:68
constexpr char HW_IF_EFFORT[]
Constant defining effort interface.
Definition hardware_interface_type_values.hpp:27
constexpr char HW_IF_ACCELERATION[]
Constant defining acceleration interface.
Definition hardware_interface_type_values.hpp:25
constexpr char HW_IF_VELOCITY[]
Constant defining velocity interface.
Definition hardware_interface_type_values.hpp:23
constexpr char HW_IF_POSITION[]
Constant defining position interface.
Definition hardware_interface_type_values.hpp:21
Definition generic_system.hpp:61
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:101