Skip to content

Commit

Permalink
Add doc-string warnings for destroy methods for services. (#1205)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya authored Dec 6, 2023
1 parent f57efa5 commit 995bbed
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rclpy/rclpy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,10 @@ def service_name(self) -> str:
return self.__client.service_name

def destroy(self):
"""
Destroy a container for a ROS service client.
.. warning:: Users should not destroy a service client with this destructor, instead they
should call :meth:`.Node.destroy_client`.
"""
self.__client.destroy_when_not_in_use()
2 changes: 1 addition & 1 deletion rclpy/rclpy/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
"""
Create a container for a ROS publisher.
.. warning:: Users should not create a publisher with this constuctor, instead they should
.. warning:: Users should not create a publisher with this constructor, instead they should
call :meth:`.Node.create_publisher`.
A publisher is used as a primary means of communication in a ROS system by publishing
Expand Down
8 changes: 7 additions & 1 deletion rclpy/rclpy/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
"""
Create a container for a ROS service server.
.. warning:: Users should not create a service server with this constuctor, instead they
.. warning:: Users should not create a service server with this constructor, instead they
should call :meth:`.Node.create_service`.
:param service_impl: :class:`_rclpy.Service` wrapping the underlying ``rcl_service_t``
Expand Down Expand Up @@ -108,4 +108,10 @@ def service_name(self) -> str:
return self.__service.name

def destroy(self):
"""
Destroy a container for a ROS service server.
.. warning:: Users should not destroy a service server with this destructor, instead they
should call :meth:`.Node.destroy_service`.
"""
self.__service.destroy_when_not_in_use()

0 comments on commit 995bbed

Please sign in to comment.