Skip to content

Commit

Permalink
Move lifecycle interfaces to be public, also add rclcpp::shutdown() t…
Browse files Browse the repository at this point in the history
…o finish cleanly the node when shutting down
  • Loading branch information
sergigraum committed Jan 29, 2024
1 parent 26e5043 commit 5ed628b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion psdk_wrapper/include/psdk_wrapper/psdk_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ class PSDKWrapper : public rclcpp_lifecycle::LifecycleNode
*/
~PSDKWrapper();

protected:
/**
* @brief Configures member variable and sets the environment
* @param state Reference to Lifecycle state
Expand Down
5 changes: 4 additions & 1 deletion psdk_wrapper/src/psdk_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ namespace psdk_ros2
{
PSDKWrapper::PSDKWrapper(const std::string &node_name)
: rclcpp_lifecycle::LifecycleNode(
node_name, "", rclcpp::NodeOptions().use_intra_process_comms(true))
node_name, "", rclcpp::NodeOptions().use_intra_process_comms(true).arguments(
{"--ros-args", "-r",
node_name + ":" + std::string("__node:=") + node_name}))
{
RCLCPP_INFO(get_logger(), "Creating Constructor PSDKWrapper");
declare_parameter("app_name", rclcpp::ParameterValue(""));
Expand Down Expand Up @@ -152,6 +154,7 @@ PSDKWrapper::on_shutdown(const rclcpp_lifecycle::State &state)

global_ptr_.reset();
RCLCPP_INFO(get_logger(), "Shutting down PSDKWrapper");
rclcpp::shutdown();
return CallbackReturn::SUCCESS;
}

Expand Down

0 comments on commit 5ed628b

Please sign in to comment.