Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass timeout duration to invocation of rmw_wait #66

Merged
merged 1 commit into from
Aug 5, 2015

Conversation

jacquelinekay
Copy link
Contributor

Connects to ros2/ros2#73

@jacquelinekay jacquelinekay added the in progress Actively being worked on (Kanban column) label Jul 24, 2015
@@ -107,11 +109,13 @@ class Executor
}
}

void spin_node_once(rclcpp::node::Node::SharedPtr & node, bool nonblocking = false)
template<typename Rep = int64_t, typename Period = std::milli>
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to offer templated variations of the timeout?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be nice to do so, but as I was just talking with @jacquelinekay off-line I suggested templating it on a single typename, like DurationT.

@jacquelinekay jacquelinekay force-pushed the wait_timeout branch 2 times, most recently from 7751255 to fbafe2a Compare July 29, 2015 19:51
auto timeout_sec = std::chrono::duration_cast<std::chrono::seconds>(timeout);
rmw_timeout.sec = timeout_sec.count();
rmw_timeout.nsec = std::chrono::duration_cast<std::chrono::nanoseconds>(timeout).count() %
SEC_TO_NSEC;
Copy link
Member

Choose a reason for hiding this comment

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

SEC_TO_NSEC implies a function with some behavior. I would suggest to just use (1000 * 1000 * 1000) here instead.

void spin_node_once(rclcpp::node::Node::SharedPtr & node, bool nonblocking = false)
template<typename T = std::milli>
void spin_node_once(rclcpp::node::Node::SharedPtr & node,
std::chrono::duration<int64_t, T> timeout = std::chrono::duration<int64_t, T>(-1))
Copy link
Member

Choose a reason for hiding this comment

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

We might want some typedefs for these durations. And may be a default value for -1.

@dirk-thomas
Copy link
Member

LGTM

@wjwwood
Copy link
Member

wjwwood commented Aug 4, 2015

+1

1 similar comment
@esteve
Copy link
Member

esteve commented Aug 4, 2015

+1

@tfoote
Copy link
Contributor

tfoote commented Aug 4, 2015

+1 should squash

jacquelinekay added a commit that referenced this pull request Aug 5, 2015
Pass timeout duration to invocation of rmw_wait
@jacquelinekay jacquelinekay merged commit 2418947 into master Aug 5, 2015
@jacquelinekay jacquelinekay removed the in progress Actively being worked on (Kanban column) label Aug 5, 2015
@jacquelinekay jacquelinekay deleted the wait_timeout branch August 5, 2015 02:25
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request May 26, 2021
…s-merge-master

Merged master on irobot/add-rmw-listener-apis
DensoADAS pushed a commit to DensoADAS/rclcpp that referenced this pull request Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants