Skip to content

Commit 5b88b68

Browse files
committed
expose get_data_type method in loaned interfaces (#2351)
1 parent 2a03e11 commit 5b88b68

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

hardware_interface/include/hardware_interface/actuator_interface.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod
559559
return opt_value.value();
560560
}
561561

562-
void set_command(const std::string & interface_name, const double & value)
562+
template <typename T>
563+
void set_command(const std::string & interface_name, const T & value)
563564
{
564565
auto it = actuator_commands_.find(interface_name);
565566
if (it == actuator_commands_.end())

hardware_interface/include/hardware_interface/loaned_command_interface.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ class LoanedCommandInterface
209209
return false;
210210
}
211211

212+
/**
213+
* @brief Get the data type of the command interface.
214+
* @return The data type of the command interface.
215+
*/
216+
HandleDataType get_data_type() const { return command_interface_.get_data_type(); }
217+
212218
protected:
213219
CommandInterface & command_interface_;
214220
Deleter deleter_;

hardware_interface/include/hardware_interface/loaned_state_interface.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ class LoanedStateInterface
169169
return false;
170170
}
171171

172+
/**
173+
* @brief Get the data type of the state interface.
174+
* @return The data type of the state interface.
175+
*/
176+
HandleDataType get_data_type() const { return state_interface_.get_data_type(); }
177+
172178
protected:
173179
const StateInterface & state_interface_;
174180
Deleter deleter_;

hardware_interface/include/hardware_interface/system_interface.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI
589589
return opt_value.value();
590590
}
591591

592-
void set_command(const std::string & interface_name, const double & value)
592+
template <typename T>
593+
void set_command(const std::string & interface_name, const T & value)
593594
{
594595
auto it = system_commands_.find(interface_name);
595596
if (it == system_commands_.end())

0 commit comments

Comments
 (0)