Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about Groot2 #897

Open
Motues opened this issue Dec 12, 2024 · 2 comments
Open

A question about Groot2 #897

Motues opened this issue Dec 12, 2024 · 2 comments

Comments

@Motues
Copy link

Motues commented Dec 12, 2024

When I import logs inside groot2, the following message appears
image

codes:

BT::FileLogger2 logger(tree, logFilePath);
tree.tickWhileRunning();

Behavior tree works fine.

@facontidavide
Copy link
Collaborator

the code looks correct to me.

If you can provide a simple application / unit test that replicate the issue, I will look into it

@Motues
Copy link
Author

Motues commented Dec 13, 2024

There is a simple test.

#include <behaviortree_cpp/bt_factory.h>
#include <behaviortree_cpp/action_node.h>
#include <behaviortree_cpp/condition_node.h>
#include "behaviortree_cpp/loggers/bt_file_logger_v2.h"

using namespace BT;

class SimpleAction : public SyncActionNode {
public:
    SimpleAction(const std::string& name) : SyncActionNode(name, {}) {}
    NodeStatus tick() override {
        std::cout << "SimpleAction is running..." << std::endl;
        return NodeStatus::SUCCESS;
    }
};

class SimpleCondition : public ConditionNode {
public:
    SimpleCondition(const std::string& name) : ConditionNode(name, {}) {}
    NodeStatus tick() override {
        std::cout << "SimpleCondition is checking..." << std::endl;
        return NodeStatus::SUCCESS;
    }
};

int main() {
    BehaviorTreeFactory factory;

    factory.registerNodeType<SimpleAction>("SimpleAction");
    factory.registerNodeType<SimpleCondition>("SimpleCondition");

    std::filesystem::path logFilePath = "../../Groot/Log/test.btlog";

    auto tree = factory.createTreeFromFile("../../Scripts/mytree.xml");
    FileLogger2 logger(tree, logFilePath);

    tree.tickWhileRunning();

    return 0;
}

The compilation environment is

  • Ubuntu24.04
  • g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  • BehaviorTree.cpp v4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants