File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,16 @@ int main(int argc, char * argv[])
2323 // / Component container with a multi-threaded executor.
2424 rclcpp::init (argc, argv);
2525
26- auto exec = std::make_shared< rclcpp::executors::MultiThreadedExecutor>() ;
27- auto node = std::make_shared<rclcpp_components::ComponentManager>();
26+ rclcpp::executors::MultiThreadedExecutor::SharedPtr exec = nullptr ;
27+ const auto node = std::make_shared<rclcpp_components::ComponentManager>();
2828 if (node->has_parameter (" thread_num" )) {
2929 const auto thread_num = node->get_parameter (" thread_num" ).as_int ();
3030 exec = std::make_shared<rclcpp::executors::MultiThreadedExecutor>(
3131 rclcpp::ExecutorOptions{}, thread_num);
32- node->set_executor (exec);
3332 } else {
34- node-> set_executor (exec );
33+ exec = std::make_shared<rclcpp::executors::MultiThreadedExecutor>( );
3534 }
35+ node->set_executor (exec);
3636 exec->add_node (node);
3737 exec->spin ();
3838}
You can’t perform that action at this time.
0 commit comments