diff --git a/rclcpp/include/rclcpp/exceptions/exceptions.hpp b/rclcpp/include/rclcpp/exceptions/exceptions.hpp index d501acd71c..233b4b67ba 100644 --- a/rclcpp/include/rclcpp/exceptions/exceptions.hpp +++ b/rclcpp/include/rclcpp/exceptions/exceptions.hpp @@ -100,6 +100,15 @@ class InvalidServiceNameError : public NameValidationError {} }; +class UnimplementedError : public std::runtime_error +{ +public: + UnimplementedError() + : std::runtime_error("This code is unimplemented.") {} + explicit UnimplementedError(const std::string & msg) + : std::runtime_error(msg) {} +}; + /// Throw a C++ std::exception which was created based on an rcl error. /** * Passing nullptr for reset_error is safe and will avoid calling any function diff --git a/rclcpp/include/rclcpp/executors/static_single_threaded_executor.hpp b/rclcpp/include/rclcpp/executors/static_single_threaded_executor.hpp index 9d39ba8e90..49baaff4d0 100644 --- a/rclcpp/include/rclcpp/executors/static_single_threaded_executor.hpp +++ b/rclcpp/include/rclcpp/executors/static_single_threaded_executor.hpp @@ -190,6 +190,28 @@ class StaticSingleThreadedExecutor : public rclcpp::Executor return rclcpp::FutureReturnCode::INTERRUPTED; } + /// Not yet implemented, see https://github.com/ros2/rclcpp/issues/1219 for tracking + RCLCPP_PUBLIC + void + spin_some(std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0)) override + { + (void)max_duration; + throw rclcpp::exceptions::UnimplementedError( + "spin_some is not implemented for StaticSingleThreadedExecutor, use spin or " + "spin_until_future_complete"); + } + + /// Not yet implemented, see https://github.com/ros2/rclcpp/issues/1219 for tracking + RCLCPP_PUBLIC + void + spin_once(std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1)) override + { + (void)timeout; + throw rclcpp::exceptions::UnimplementedError( + "spin_once is not implemented for StaticSingleThreadedExecutor, use spin or " + "spin_until_future_complete"); + } + protected: /// Check which executables in ExecutableList struct are ready from wait_set and execute them. /**