File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -169,10 +169,16 @@ class Executor
169169 * \param[in] max_duration The maximum amount of time to spend executing work, or 0 for no limit.
170170 * Note that spin_some() may take longer than this time as it only returns once max_duration has
171171 * been exceeded.
172+ * \param[in] exhaustive When true, it will try to collect entities again after executing executables
173+ * until there is no more ready entities or the specified duration has been reached.
174+ * When there are subscriptions/clients with long history queues, this will ensure all messages/requestes
175+ * available are handled.
172176 */
173177 RCLCPP_PUBLIC
174178 virtual void
175- spin_some (std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0 ));
179+ spin_some (
180+ std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0 ),
181+ bool exhaustive = false );
176182
177183 RCLCPP_PUBLIC
178184 virtual void
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ Executor::spin_node_some(std::shared_ptr<rclcpp::Node> node)
213213}
214214
215215void
216- Executor::spin_some (std::chrono::nanoseconds max_duration)
216+ Executor::spin_some (std::chrono::nanoseconds max_duration, bool exhaustive )
217217{
218218 auto start = std::chrono::steady_clock::now ();
219219 auto max_duration_not_elapsed = [max_duration, start]() {
@@ -242,7 +242,7 @@ Executor::spin_some(std::chrono::nanoseconds max_duration)
242242 execute_any_executable (any_exec);
243243 work_available = true ;
244244 } else {
245- if (!work_available) {
245+ if (!work_available || !exhaustive ) {
246246 break ;
247247 }
248248 work_available = false ;
You can’t perform that action at this time.
0 commit comments