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.
Merge pull request #16 from brown-ccv/integrate-action-library
initial action_library integration
- Loading branch information
Showing
6 changed files
with
324 additions
and
71 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import py_trees | ||
|
||
class CustomBehavior(py_trees.behaviours.Dummy): | ||
def __init__(self, name, id_, nickname): | ||
super().__init__(name) | ||
self.id_ = id_ | ||
self.nickname = nickname | ||
|
||
|
||
|
||
# id of the behavior within the behavior library (persists) | ||
# but also the unique id for the behavior within the tree (in case there are multiple instances of | ||
# the behavior in one tree) | ||
|
||
|
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" | ||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.