-
Notifications
You must be signed in to change notification settings - Fork 237
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
Add wait_for_all_acked support #793
Add wait_for_all_acked support #793
Conversation
false. | ||
""" | ||
with self.handle: | ||
return self.__publisher.wait_for_all_acked(timeout._duration_handle) |
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.
it should use try&except
statement? Publisher::wait_for_all_acked would throw RCLError exception.
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.
After check other codes, I find it also doesn't deal with RCLError.
e.g.
rclpy/rclpy/rclpy/publisher.py
Lines 59 to 73 in 714f69e
def publish(self, msg: Union[MsgType, bytes]) -> None: | |
""" | |
Send a message to the topic for the publisher. | |
:param msg: The ROS message to publish. | |
:raises: TypeError if the type of the passed message isn't an instance | |
of the provided type when the publisher was constructed. | |
""" | |
with self.handle: | |
if isinstance(msg, self.msg_type): | |
self.__publisher.publish(msg) | |
elif isinstance(msg, bytes): | |
self.__publisher.publish_raw(msg) | |
else: | |
raise TypeError('Expected {}, got {}'.format(self.msg_type, type(msg))) |
Not catch exception
The underlying code may throw exception
rclpy/rclpy/src/rclpy/publisher.cpp
Lines 121 to 133 in 714f69e
void | |
Publisher::publish(py::object pymsg) | |
{ | |
auto raw_ros_message = convert_from_py(pymsg); | |
if (!raw_ros_message) { | |
throw py::error_already_set(); | |
} | |
rcl_ret_t ret = rcl_publish(rcl_publisher_.get(), raw_ros_message.get(), NULL); | |
if (RCL_RET_OK != ret) { | |
throw RCLError("Failed to publish"); | |
} | |
} |
rclpy/test/test_publisher.py
Outdated
@@ -75,6 +76,26 @@ def do_test_topic_name(cls, test_topics, node): | |||
assert publisher.topic_name == target_topic | |||
publisher.destroy() | |||
|
|||
@classmethod | |||
def do_test_wait_for_all_acked(cls, test_topic, node): | |||
pub = node.create_publisher(BasicTypes, test_topic, 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.
QoS Reliable setting would be nice to check too.
Friendly ping @fujitatomoya. Please look at my comments and I supplement tests. |
CC: @ivanpauno @wjwwood friendly ping. |
85c8ac1
to
4cd0524
Compare
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.
LGTM, since it's been a while I made some changes pushed it to your branch directly
I would like it to be reviewed by once more by someone who hasn't edited this PR
rclpy/test/test_publisher.py
Outdated
|
||
# Publisher is reliable and subscription is best effort | ||
pub_qos.reliability = rclpy.qos.QoSReliabilityPolicy.RELIABLE | ||
TestPublisher.do_test_wait_for_all_acked(TEST_TOPIC, self.node, pub_qos, sub_qos) |
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 don't think there's a need for trying the different QoS options - it seems unrelated to the feature being tested.
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.
Signed-off-by: Barry Xu <barry.xu@sony.com>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Barry Xu <barry.xu@sony.com>
2efbaa3
to
e1c6ca2
Compare
Do rebase. |
rcl package isn't updated (ros2/rcl#913 isn't included). So CI failed.
|
Released rcl (ros/rosdistro#30681), the Rpr checker should start passing in some hours. |
@ros-pull-request-builder retest this please |
@Barry-Xu-2018 @fujitatomoya can you run ci? |
@@ -103,6 +105,29 @@ def test_topic_name_remapping(self): | |||
] | |||
TestPublisher.do_test_topic_name(test_topics, self.node) | |||
|
|||
def test_wait_for_all_acked(self): |
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.
This test is failing with Connext #824
Related to ros2/rmw#295