Robotics StackExchange | Archived questions

[ROS2] How to shutdown service?

In ROS1, a service could be shutdowned by m_svr.shutdown() .

How can I do the same with ros2(C++)?

Asked by roboy on 2022-10-29 03:11:03 UTC

Comments

Answers

Supposing your question if for Python services, The recommended way to create a service is by using Node.create_service(...) and to shut it down Node.destroy_service(...)

Some example can be found at: https://github.com/ros2/examples/blob/b70e515d58cf44eef54706322d05ec0a30479022/rclpy/services/minimal_service/examples_rclpy_minimal_service/service.py#L44

Asked by marguedas on 2022-10-30 07:18:09 UTC

Comments

Thanks for the reply. I'm using C++ and can't find a function equivalent to ' Node.destroy_service(...) ' .

Asked by roboy on 2022-10-30 23:08:16 UTC