17#ifndef FAKE_COMPONENTS__GENERIC_SYSTEM_HPP_
18#define FAKE_COMPONENTS__GENERIC_SYSTEM_HPP_
23#include "hardware_interface/base_interface.hpp"
24#include "hardware_interface/handle.hpp"
25#include "hardware_interface/hardware_info.hpp"
26#include "hardware_interface/system_interface.hpp"
27#include "hardware_interface/types/hardware_interface_return_values.hpp"
28#include "hardware_interface/types/hardware_interface_status_values.hpp"
29#include "hardware_interface/types/hardware_interface_type_values.hpp"
31using hardware_interface::return_type;
33namespace fake_components
47 status_ = hardware_interface::status::STARTED;
48 return return_type::OK;
51 return_type
stop()
override
53 status_ = hardware_interface::status::STOPPED;
54 return return_type::OK;
57 return_type read()
override;
59 return_type
write()
override {
return return_type::OK; }
70 hardware_interface::HW_IF_POSITION, hardware_interface::HW_IF_VELOCITY,
71 hardware_interface::HW_IF_ACCELERATION, hardware_interface::HW_IF_EFFORT};
73 const size_t POSITION_INTERFACE_INDEX = 0;
77 std::size_t joint_index;
78 std::size_t mimicked_joint_index;
79 double multiplier = 1.0;
81 std::vector<MimicJoint> mimic_joints_;
85 std::vector<std::vector<double>> joint_states_;
87 std::vector<std::string> other_interfaces_;
90 std::vector<std::vector<double>> other_states_;
92 std::vector<std::string> sensor_interfaces_;
95 std::vector<std::vector<double>> sensor_states_;
98 template <
typename HandleType>
100 const std::string & name,
const std::vector<std::string> & interface_list,
101 const std::string & interface_name,
const size_t vector_index,
102 std::vector<std::vector<double>> & values, std::vector<HandleType> & interfaces);
104 void initialize_storage_vectors(
105 std::vector<std::vector<double>> & commands, std::vector<std::vector<double>> & states,
106 const std::vector<std::string> & interfaces);
108 bool fake_sensor_command_interfaces_;
109 double position_state_following_offset_;
110 std::string custom_interface_with_following_offset_;
111 size_t index_custom_interface_with_following_offset_;
Definition generic_system.hpp:37
return_type stop() override
Stop exchange data with the hardware.
Definition generic_system.hpp:51
std::vector< std::vector< double > > other_commands_
The size of this vector is (other_interfaces_.size() x nr_joints).
Definition generic_system.hpp:89
return_type write() override
Write the current command values to the actuator within the system.
Definition generic_system.hpp:59
std::vector< hardware_interface::StateInterface > export_state_interfaces() override
Exports all state interfaces for this system.
Definition generic_system.cpp:187
const std::vector< std::string > standard_interfaces_
Use standard interfaces for joints because they are relevant for dynamic behaviour.
Definition generic_system.hpp:69
return_type configure(const hardware_interface::HardwareInfo &info) override
Configuration of the system from data parsed from the robot's URDF.
Definition generic_system.cpp:31
std::vector< std::vector< double > > joint_commands_
The size of this vector is (standard_interfaces_.size() x nr_joints).
Definition generic_system.hpp:84
std::vector< hardware_interface::CommandInterface > export_command_interfaces() override
Exports all command interfaces for this system.
Definition generic_system.cpp:231
std::vector< std::vector< double > > sensor_fake_commands_
The size of this vector is (other_interfaces_.size() x nr_joints).
Definition generic_system.hpp:94
return_type start() override
Start exchange data with the hardware.
Definition generic_system.hpp:45
Definition base_interface.hpp:28
Definition generic_system.hpp:76
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:103