#include #include // #include // #include class RbsBtExecutor : public BT::TreeExecutionServer { public: RbsBtExecutor(const rclcpp::NodeOptions &options) : TreeExecutionServer(options) {} void onTreeCreated(BT::Tree &tree) override { logger_cout_ = std::make_shared(tree); } std::optional onTreeExecutionCompleted(BT::NodeStatus status, bool was_cancelled) override { // RCLCPP_INFO(logger_cout_, "Tree completed with code: %d", status ); logger_cout_.reset(); return std::nullopt; } private: std::shared_ptr logger_cout_; // rclcpp::Subscription::SharedPtr sub_; }; int main(int argc, char *argv[]) { rclcpp::init(argc, argv); rclcpp::NodeOptions options; auto action_server = std::make_shared(options); rclcpp::executors::MultiThreadedExecutor exec( rclcpp::ExecutorOptions(), 0, false, std::chrono::milliseconds(250)); exec.add_node(action_server->node()); exec.spin(); exec.remove_node(action_server->node()); rclcpp::shutdown(); }