generated from pypa/sampleproject
-
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.
move starting behavior_tree and behavior_tree into import file approach
- Loading branch information
Showing
6 changed files
with
215 additions
and
161 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
class BehaviorLibrary: | ||
def __init__(self, behaviors): | ||
self.behaviors = behaviors | ||
|
||
def get_behavior_by_nickname(self, nickname): | ||
return self.behaviors.get(nickname) | ||
|
||
def get_behavior_by_id(self, id_): | ||
for behavior in self.behaviors.values(): | ||
if behavior.id == id_: | ||
return behavior | ||
return None |
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
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,104 @@ | ||
{ | ||
"behavior_tree": { | ||
"name": "Sequence A", | ||
"type": "Sequence", | ||
"children": [ | ||
{ | ||
"name": "Behavior A", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Behavior B", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Sequence B", | ||
"type": "Sequence", | ||
"children": [ | ||
{ | ||
"name": "Behavior C", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Behavior D", | ||
"type": "Behavior", | ||
"children": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Sequence C", | ||
"type": "Sequence", | ||
"children": [ | ||
{ | ||
"name": "Behavior E", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Behavior F", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Behavior G", | ||
"type": "Behavior", | ||
"children": [] | ||
}, | ||
{ | ||
"name": "Behavior H", | ||
"type": "Behavior", | ||
"children": [] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"behavior_library": | ||
{ | ||
"Behavior A": { | ||
"id": "001", | ||
"nickname": "Behavior A", | ||
"type": "Dummy" | ||
}, | ||
"Behavior B": { | ||
"id": "002", | ||
"nickname": "Behavior B", | ||
"type": "Dummy" | ||
}, | ||
"Behavior C": { | ||
"id": "003", | ||
"nickname": "Behavior C", | ||
"type": "Dummy" | ||
}, | ||
"Behavior D": { | ||
"id": "004", | ||
"nickname": "Behavior D", | ||
"type": "Dummy" | ||
}, | ||
"Behavior E": { | ||
"id": "005", | ||
"nickname": "Behavior E", | ||
"type": "Dummy" | ||
}, | ||
"Behavior F": { | ||
"id": "006", | ||
"nickname": "Behavior F", | ||
"type": "Dummy" | ||
}, | ||
"Behavior G": { | ||
"id": "007", | ||
"nickname": "Behavior G", | ||
"type": "Dummy" | ||
}, | ||
"Behavior H": { | ||
"id": "008", | ||
"nickname": "Behavior H", | ||
"type": "Dummy" | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.