ControlNode
dendron.control_node.ControlNode
Bases: TreeNode
Base class for a control node.
A control node maintains a list of children that it ticks under some conditions. The node tracks the state of its children as they tick, and decides whether or not to continue based on its internal logic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
`str`
|
The given name of this control node. |
required |
children |
`List[TreeNode]`
|
An optional initial list of children. |
None
|
Source code in src/dendron/control_node.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
add_child(child)
Add a new child node to the end of the list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
child |
`dendron.tree_node.TreeNode`
|
The new child node. |
required |
add_children(children)
Add a list of children to the end of the list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
children |
`List[TreeNode]`
|
The list of |
required |
child(index)
Get the child that is at position index
in the list. Does
not perform bounds checking.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
`int`
|
The index of the child we want. |
required |
Returns:
Type | Description |
---|---|
TreeNode
|
|
Source code in src/dendron/control_node.py
children()
Get the list of children.
Returns:
Type | Description |
---|---|
List[TreeNode]
|
|
children_count()
Get the current number of children.
Returns:
Type | Description |
---|---|
int
|
|
get_node_by_name(name)
Search for a node by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
`str`
|
The name of the node we are looking for. |
required |
Returns:
Type | Description |
---|---|
Optional[TreeNode]
|
|
Optional[TreeNode]
|
or None. |
Source code in src/dendron/control_node.py
halt_node()
node_type()
reset()
set_blackboard(bb)
Set the blackboard for this node, and then forward to the children.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bb |
`dendron.blackboard.Blackboard`
|
The new blackboard to use. |
required |
Source code in src/dendron/control_node.py
set_log_level(new_level)
Set the log level for this node, then forward that level for the children to use.
set_logger(new_logger)
Set the logger for this node, and then forward the logger to the children.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_logger |
`logging.Logger`
|
The Logger to use. |
required |
Source code in src/dendron/control_node.py
set_tree(tree)
Set the tree of this node, and then have each of the children set their tree similarly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tree |
`dendron.behavior_tree.BehaviorTree`
|
The tree that will contain this node. |
required |