From dd17a0ef8b3ac20983c8ac543a975eaf255eddad Mon Sep 17 00:00:00 2001 From: mhubii Date: Thu, 9 May 2024 21:07:25 +0100 Subject: [PATCH] init catch --- lbr_ros2_control/src/system_interface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lbr_ros2_control/src/system_interface.cpp b/lbr_ros2_control/src/system_interface.cpp index 2ce132ac..92ca85df 100644 --- a/lbr_ros2_control/src/system_interface.cpp +++ b/lbr_ros2_control/src/system_interface.cpp @@ -292,6 +292,10 @@ SystemInterface::on_deactivate(const rclcpp_lifecycle::State &) { hardware_interface::return_type SystemInterface::read(const rclcpp::Time & /*time*/, const rclcpp::Duration &period) { + if (!async_client_ptr_->get_state_interface().is_initialized()) { + return hardware_interface::return_type::OK; + } + hw_lbr_state_ = async_client_ptr_->get_state_interface().get_state(); if (period.seconds() - hw_lbr_state_.sample_time * 0.2 > hw_lbr_state_.sample_time) {