From 8dc4ed291420ed5c26b5360f458ef7c51acefdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=A0togl?= Date: Tue, 6 Dec 2022 21:06:03 +0100 Subject: [PATCH] Update hardware templates. (#86) --- .../dummy_package_namespace/robot_hardware_interface.hpp | 4 ++++ .../ros2_control/hardware/robot_hardware_interface.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/templates/ros2_control/hardware/dummy_package_namespace/robot_hardware_interface.hpp b/templates/ros2_control/hardware/dummy_package_namespace/robot_hardware_interface.hpp index be0c275c..e020882d 100644 --- a/templates/ros2_control/hardware/dummy_package_namespace/robot_hardware_interface.hpp +++ b/templates/ros2_control/hardware/dummy_package_namespace/robot_hardware_interface.hpp @@ -35,6 +35,10 @@ class DummyClassName : public hardware_interface::Dummy_Interface_TypeInterface hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; + TEMPLATES__ROS2_CONTROL__VISIBILITY_PUBLIC + hardware_interface::CallbackReturn on_configure( + const rclcpp_lifecycle::State & previous_state) override; + TEMPLATES__ROS2_CONTROL__VISIBILITY_PUBLIC std::vector export_state_interfaces() override; diff --git a/templates/ros2_control/hardware/robot_hardware_interface.cpp b/templates/ros2_control/hardware/robot_hardware_interface.cpp index 359d5954..263c63a0 100644 --- a/templates/ros2_control/hardware/robot_hardware_interface.cpp +++ b/templates/ros2_control/hardware/robot_hardware_interface.cpp @@ -35,6 +35,14 @@ hardware_interface::CallbackReturn DummyClassName::on_init( return CallbackReturn::SUCCESS; } +hardware_interface::CallbackReturn DummyClassName::on_configure( + const rclcpp_lifecycle::State & /*previous_state*/) +{ + // TODO(anyone): prepare the robot to be ready for read calls and write calls of some interfaces + + return CallbackReturn::SUCCESS; +} + std::vector DummyClassName::export_state_interfaces() { std::vector state_interfaces;