Function rclcpp::shutdown

Function Documentation

bool rclcpp::shutdown(rclcpp::Context::SharedPtr context = nullptr, const std::string &reason = "user called rclcpp::shutdown()")

Shutdown rclcpp context, invalidating it for derived entities.

If nullptr is given for the context, then the global context is used, i.e. the context initialized by rclcpp::init().

If the global context is used, then the signal handlers are also uninstalled.

This will also cause the “on_shutdown” callbacks to be called.

Parameters:
  • context[in] Optional to be shutdown

  • reason[in] Optional string passed to the context shutdown method

Returns:

true if shutdown was successful, false if context was already shutdown