ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think the intened way is something like this:

#include <rmw/qos_profiles.h>
#include <rclcpp/qos.hpp>

// [...]
auto qos = rclcpp::QoS(rclcpp::KeepLast(1), rmw_qos_profile_sensor_data);

Where all the standard profiles are defined in here https://github.com/ros2/rmw/blob/master/rmw/include/rmw/qos_profiles.h

You may also use the convenience constructor for rclcpp::QoS (https://docs.ros2.org/foxy/api/rclcpp/classrclcpp_1_1QoS.html#ad7e932d8e2f636c80eff674546ec3963) and simply modify the policy via the setting modification functions:

auto qos = rclcpp::QoS(1); // or rclcpp::KeepAll();
qos.<modifier>();

References

https://docs.ros2.org/foxy/api/rclcpp/classrclcpp_1_1QoS.html#a98fb6b31d7c5cbd4788412663fd38cfb https://docs.ros2.org/foxy/api/rclcpp/structrclcpp_1_1KeepLast.html https://docs.ros2.org/foxy/api/rclcpp/structrclcpp_1_1QoSInitialization.html#details