MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.ROS2 / main

Function main

btcpp_ros2_samples/src/sample_bt_executor.cpp:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59};
60
61int main(int argc, char* argv[])
62{
63 rclcpp::init(argc, argv);
64
65 rclcpp::NodeOptions options;
66 auto action_server = std::make_shared<MyActionServer>(options);
67
68 // TODO: This workaround is for a bug in MultiThreadedExecutor where it can deadlock when spinning without a timeout.
69 // Deadlock is caused when Publishers or Subscribers are dynamically removed as the node is spinning.
70 rclcpp::executors::MultiThreadedExecutor exec(rclcpp::ExecutorOptions(), 0, false,
71 std::chrono::milliseconds(250));
72 exec.add_node(action_server->node());
73 exec.spin();
74 exec.remove_node(action_server->node());
75
76 rclcpp::shutdown();
77}

Callers

nothing calls this directly

Calls 1

nodeMethod · 0.80

Tested by

no test coverage detected