24#include <rclcpp/rclcpp.hpp>
29namespace client_behaviors
31using namespace std::chrono_literals;
35template <
typename TMessage>
40 const char * topicname, std::function<
bool(
const TMessage &)> guardFunction =
nullptr)
50 rclcpp::SensorDataQoS qos;
54 getLogger(),
"[CbWaitTopicMessage] waiting message from topic: "
55 <<
topicname_ <<
"[" << demangledTypeName<TMessage>() <<
"]");
62 std::function<void(
typename TMessage::SharedPtr)> fn = [
this](
auto msg)
73 RCLCPP_INFO(
getLogger(),
"[CbWaitTopicMessage] message received.");
81 typename rclcpp::Subscription<TMessage>::SharedPtr
sub_;
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
virtual ~CbWaitTopicMessage()
void onMessageReceived(const typename TMessage::SharedPtr msg)
CbWaitTopicMessage(const char *topicname, std::function< bool(const TMessage &)> guardFunction=nullptr)
std::function< bool(const TMessage &)> guardFn_
rclcpp::Subscription< TMessage >::SharedPtr sub_