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

[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
0

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;
 qos.keep_last(*queueSize);
 int queueSize = 10;
 auto sub = node->create_subscription<MessageType>("topicName", qos, callbackfn);

References: - https://index.ros.org/doc/ros2/Concep... - http://docs.ros2.org/dashing/api/rclc...

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 903 times

Last updated: Oct 05 '20