[ROS2] How to set QoS policy for topic in cpp script
How do I set QoS policy when initializing a publisher or subscriber in rclcpp?
In micro-ROS I only need to do, e.g rclc_publisher_init_best_effort()
to set the best effort policy for a publisher.
I'm currently able to set the queue depth like this:
sub_ = this->create_subscription<std_msgs::msg::string>( "topic", rclcpp::QoS(QUEUE_DEPTH), std::bind(&Node::callback, this, std::placeholders::_1));
But what do I write to set the QoS policy? Is it possible to only change the policy like this without needing to create a whole QoS profile?