From b56df18398c9aa88463c0863d39769b11ec31154 Mon Sep 17 00:00:00 2001 From: Juancho Date: Fri, 31 Jul 2026 17:34:52 +0100 Subject: [PATCH] Improved the exception handling when the watchdog triggers an emergency stop --- src/sas_robot_driver_ros.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sas_robot_driver_ros.cpp b/src/sas_robot_driver_ros.cpp index 4034752..14ccbe9 100644 --- a/src/sas_robot_driver_ros.cpp +++ b/src/sas_robot_driver_ros.cpp @@ -171,7 +171,13 @@ int RobotDriverROS::control_loop() // Any exception from the watchdog thread control loop will be rethrown by check_for_watchdog_exceptions(), and // consequently the main control loop must stop. - robot_driver_->check_for_watchdog_exceptions(); + try { + robot_driver_->check_for_watchdog_exceptions(); + } catch (const std::exception& e) { + RCLCPP_INFO_STREAM_ONCE(node_->get_logger(), "::Watchdog exception: " << e.what()); + RCLCPP_INFO_STREAM_ONCE(node_->get_logger(), "::The shutdown signal was received!"); + shutdown_signaler_->shutdown(); + } }