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