-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/other/behaviour_tree/include/behaviour_tree/node/blackboard/BlackboardLeaf.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef BEHAVIOUR_TREE_BLACKBOARD_LEAF_HPP | ||
#define BEHAVIOUR_TREE_BLACKBOARD_LEAF_HPP | ||
|
||
#pragma once | ||
|
||
#include "../Node.hpp" | ||
|
||
namespace behaviour_tree::node::blackboard | ||
{ | ||
class BlackboardLeaf : public Node | ||
{ | ||
public: | ||
BlackboardLeaf(const std::string& name) : Node(name) | ||
{ | ||
} | ||
}; | ||
} | ||
|
||
#endif |
36 changes: 36 additions & 0 deletions
36
app/other/behaviour_tree/include/behaviour_tree/node/blackboard/ChangeInteger.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef BEHAVIOUR_TREE_CHANGE_INTEGER_HPP | ||
#define BEHAVIOUR_TREE_CHANGE_INTEGER_HPP | ||
|
||
#pragma once | ||
|
||
#include "BlackboardLeaf.hpp" | ||
|
||
#include "enum/IntegerChangeType.hpp" | ||
|
||
namespace behaviour_tree::node::blackboard | ||
{ | ||
class ChangeInteger final : public BlackboardLeaf | ||
{ | ||
public: | ||
ChangeInteger(const std::string &name) : BlackboardLeaf(name) {} | ||
|
||
const Status run(const int tick_count, std::shared_ptr<Context> context) final override | ||
{ | ||
} | ||
|
||
const std::string toString() const final override | ||
{ | ||
const std::string &name = this->getName(); | ||
if (name != "") | ||
return fmt::format(R"(<Blackboard:ChangeInteger name='{}' type='{}'/>)", name, out); | ||
else | ||
return fmt::format(R"(<Blackboard:ChangeInteger type='{}'/>)", out); | ||
} | ||
|
||
private: | ||
std::string variable_name; | ||
int value; | ||
}; | ||
} | ||
|
||
#endif |
37 changes: 37 additions & 0 deletions
37
app/other/behaviour_tree/include/behaviour_tree/node/blackboard/IntegerCondition.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef BEHAVIOUR_TREE_CHANGE_INTEGER_HPP | ||
#define BEHAVIOUR_TREE_CHANGE_INTEGER_HPP | ||
|
||
#pragma once | ||
|
||
#include "BlackboardLeaf.hpp" | ||
|
||
#include "enum/ConditionOperatorType.hpp" | ||
|
||
namespace behaviour_tree::node::blackboard | ||
{ | ||
class IntegerCondition final : public BlackboardLeaf | ||
{ | ||
public: | ||
IntegerCondition(const std::string &name) : BlackboardLeaf(name) {} | ||
|
||
const Status run(const int tick_count, std::shared_ptr<Context> context) final override | ||
{ | ||
} | ||
|
||
const std::string toString() const final override | ||
{ | ||
const std::string &name = this->getName(); | ||
if (name != "") | ||
return fmt::format(R"(<Blackboard:IntegerCondition name='{}' operator='{}'/>)", name, out); | ||
else | ||
return fmt::format(R"(<Blackboard:IntegerCondition operator='{}'/>)", out); | ||
} | ||
|
||
private: | ||
std::string variable_name; | ||
ConditionOperatorType operator; | ||
int value; | ||
}; | ||
} | ||
|
||
#endif |
19 changes: 19 additions & 0 deletions
19
...ther/behaviour_tree/include/behaviour_tree/node/blackboard/enum/ConditionOperatorType.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef BEHAVIOUR_TREE_CONDITION_OPERATOR_TYPE_HPP | ||
#define BEHAVIOUR_TREE_CONDITION_OPERATOR_TYPE_HPP | ||
|
||
#pragma once | ||
|
||
namespace behaviour_tree::node::blackboard | ||
{ | ||
enum class ConditionOperatorType | ||
{ | ||
Equal, | ||
NotEqual, | ||
GreaterThan, | ||
GreaterThanOrEqual, | ||
LessThan, | ||
LessThanOrEqual, | ||
}; | ||
} | ||
|
||
#endif |
18 changes: 18 additions & 0 deletions
18
app/other/behaviour_tree/include/behaviour_tree/node/blackboard/enum/IntegerChangeType.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef BEHAVIOUR_TREE_INTEGER_CHANGE_TYPE_HPP | ||
#define BEHAVIOUR_TREE_INTEGER_CHANGE_TYPE_HPP | ||
|
||
#pragma once | ||
|
||
namespace behaviour_tree::node::blackboard | ||
{ | ||
enum class IntegerChangeType | ||
{ | ||
Set, | ||
Add, | ||
Subtract, | ||
Multiply, | ||
Divide, | ||
}; | ||
} | ||
|
||
#endif |