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

[rclcpp] How do you specify Subscriber queue_size?

asked 2020-10-05 13:22:33 -0500

How do you specify the buffered message count in the construction of a subscription object? Looks like there isn't any create_subscription overload with a queue_size parameter.

 int queueSize = 10;
 auto sub = node->create_subscription<MessageType>("topicName", queueSize, callbackfn);  // ERROR
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-10-05 14:08:27 -0500

The old queue_size parameter not in the create_subscription method. Now it is integrated inside the rclcpp::Qos data structure as "depth" field.

There are a few built-in quality of services policies that you may want to use. These have some predefined values for its fields. For example, SensorDataQoS defines depth=10. Nonetheless, you could override this value using the Qos::keep_last(depth) method.

For example:

 rclcpp::SensorDataQoS qos;
 int queueSize = 10;
 auto sub = node->create_subscription<MessageType>("topicName", qos, callbackfn);

References: - -

edit flag offensive delete link more

Question Tools



Asked: 2020-10-05 13:22:33 -0500

Seen: 934 times

Last updated: Oct 05 '20