ros2 / rclpy

rclpy (ROS Client Library for Python)
Apache License 2.0
289 stars 224 forks source link

Docstring specifying proper destruction and creation of Rate, Timer and GuardCondition #1286

Closed 2lian closed 3 months ago

2lian commented 4 months ago

This commit stems from my issue and discussion here

I added explanation of how the user should handle the destruction and creation of the object in the docstrings of the:

Subscriber, Publisher and other objects share the same destruction process. However they already had proper warnings in their docstrings. So no changes were required for those. I have kept my new docstring consistent with those.

I have decided to only change .create_rate and .create_guard_condition methods of Node because, those are the most likely objects to be destroyed and had a very short docstrings. Adding the warning in the already long create_publisher, etc, did not seem right.

2lian commented 4 months ago

I wonder if I should also add this to Iron and humble branch?

2lian commented 4 months ago

lgtm, indeed better this way.

2lian commented 4 months ago

Ok I don't know why the tests failed on fd61446, anyway they passed.

sloretz commented 3 months ago

CI (repos file build: --packages-up-to rclpy test: --packages-select rclpy)