Skip to content

Add max_duration to spin_some()#558

Merged
sloretz merged 1 commit intomasterfrom
rviz2_tf_lag
Sep 17, 2018
Merged

Add max_duration to spin_some()#558
sloretz merged 1 commit intomasterfrom
rviz2_tf_lag

Conversation

@sloretz
Copy link
Copy Markdown
Contributor

@sloretz sloretz commented Sep 15, 2018

This adds a parameter to spin_some() for the maximum duration to spend executing work. It prevents spin_some() from blocking forever if there are always callbacks ready. The reason for adding it is to allow rviz to execute all callbacks without being limited by the gui or blocking it.

connects to ros2/ros1_bridge#133
Blocks ros2/rviz#354

CI ros2/rviz#354 (comment)

With max_duration spin_some will execute work until it has spent more
time than the elapsed duration.
@sloretz sloretz added enhancement New feature or request in review Waiting for review (Kanban column) labels Sep 15, 2018
@sloretz sloretz self-assigned this Sep 15, 2018
@sloretz sloretz merged commit b860b89 into master Sep 17, 2018
@sloretz sloretz deleted the rviz2_tf_lag branch September 17, 2018 22:51
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Sep 17, 2018
RCLCPP_PUBLIC
virtual void
spin_some();
spin_some(std::chrono::nanoseconds max_duration = std::chrono::nanoseconds(0));
Copy link
Copy Markdown
Member

@dirk-thomas dirk-thomas Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would timeout match existing naming better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the behavior is different. I would expect timeout to mean the function blocks until that amount of time elapses, but this function will return immediately when no work is available regardless of max_duration.

nnmm pushed a commit to ApexAI/rclcpp that referenced this pull request Jul 9, 2022
Signed-off-by: Miaofei <miaofei@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants