-
Notifications
You must be signed in to change notification settings - Fork 425
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
Conversation
@@ -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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
7751255
to
fbafe2a
Compare
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; |
There was a problem hiding this comment.
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.
394c23d
to
53e6a6c
Compare
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)) |
There was a problem hiding this comment.
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.
LGTM |
+1 |
1 similar comment
+1 |
+1 should squash |
53e6a6c
to
3829c94
Compare
Pass timeout duration to invocation of rmw_wait
…s-merge-master Merged master on irobot/add-rmw-listener-apis
Connects to ros2/ros2#73