1#ifndef MRS_LIB_INTERNAL_COROUTINE_CALLBACK_HELPERS_HPP_
2#define MRS_LIB_INTERNAL_COROUTINE_CALLBACK_HELPERS_HPP_
5#include <rclcpp/callback_group.hpp>
8namespace mrs_lib::internal
21 inline bool is_callback_group_coro_compatible(
const std::shared_ptr<rclcpp::CallbackGroup>& callback_group)
23 return callback_group->type() == rclcpp::CallbackGroupType::Reentrant;
36 inline void require_callback_group_coro_compatible(
const std::shared_ptr<rclcpp::CallbackGroup>& callback_group)
38 if (callback_group ==
nullptr || callback_group->type() != rclcpp::CallbackGroupType::Reentrant)
40 std::string msg =
"Coroutine callbacks must be used with reentrant callback group.";
41 RCLCPP_ERROR(rclcpp::get_logger(
"mrs_lib"),
"%s", msg.c_str());
42 throw std::logic_error(msg);