Skip to content

Commit

Permalink
Improve runtime checking for behaviour tree and print
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Mar 19, 2024
1 parent 5de72aa commit 00e0057
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ namespace behaviour_tree::node::custom::action

const Status run(const int& tick_count, std::shared_ptr<Context> context) final override
{
#ifndef BEHAVIOUR_TREE_DISABLE_RUN
std::shared_ptr<CarContext> car_context = std::dynamic_pointer_cast<CarContext>(context);
#else
// #ifndef BEHAVIOUR_TREE_DISABLE_RUN
// std::shared_ptr<CarContext> car_context = std::dynamic_pointer_cast<CarContext>(context);
// #else
// std::cout << this->getText();
// #endif
std::cout << this->getText();
#endif
return Status::Success;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ namespace behaviour_tree

void startBehaviourTree()
{
assert(this->behaviour_tree != nullptr);
assert(this->car_system != nullptr);
if (this->behaviour_tree == nullptr) {
spdlog::error("The Behaviour tree has not been set");
return;
}
this->tick_count = 0;
std::shared_ptr<Context> context = std::make_shared<CarContext>(this->behaviour_tree, this->car_system);
this->context = context;
spdlog::info("Starting the behaviour tree");
spdlog::info("Starting the Saved Behaviour tree");
}

void update() final override
Expand Down

0 comments on commit 00e0057

Please sign in to comment.