Liking cljdoc? Tell your friends :D

cark.behavior-tree.base-nodes

Some utility function with usefull defaults for the broad node types

Some utility function with usefull defaults for the broad node types
raw docstring

cark.behavior-tree.context

The context map contain all the (live and static) data of a behavior tree.

It has a notably flat structure, where database, static tree and dynamic extent are merged into it. So that the context also is the database and the tree, as well as other keys merged into these.

This means that functions from the db and tree namespaces can be called on a context map.

Wherever a node has a function parameter, the context map is always the first (and often only) parameter passed to it.

The context map contain all the (live and static) data of a behavior tree.

It has a notably flat structure, where database, static tree and dynamic extent are
merged into it. So that the context also is the database and the tree, as well as other keys 
merged into these. 

This means that functions from the db and tree namespaces can be called on a context map.

Wherever a node has a function parameter, the context map is always the first (and often only) parameter passed to it.
raw docstring

cark.behavior-tree.db

The database map contains all the live data for a behavior tree. In addition to the keys specific to this namespace, it also has the keys from the event namespace. So that the event namespace functions may be called on a database. The all important blackboard is a key of this database map.

The database map contains all the live data for a behavior tree.
In addition to the keys specific to this namespace, it also has the keys from the event namespace.
So that the event namespace functions may be called on a database.
The all important blackboard is a key of this database map.
raw docstring

cark.behavior-tree.dynamic-extent

The dynamic extent stores the transient vars that were bound by nodes like :bind

The dynamic extent stores the transient vars that were bound by
nodes like :bind
raw docstring

cark.behavior-tree.event

The event maps keep the events coming in from the outside world and going out to it. We made the choice of raising errors if some events in are left unconsumed.

The event maps keep the events coming in from the outside world and going out to it.
We made the choice of raising errors if some events in are left unconsumed.
raw docstring

cark.behavior-tree.hiccup

Provides the services for parsing and compiling the hiccup notation to a static tree.

Provides the services for parsing and compiling the hiccup notation to
a static tree.
raw docstring

cark.behavior-tree.hiccup.spec

This is the spec for the hiccup dsl of a behavior tree

This is the spec for the hiccup dsl of a behavior tree
raw docstring

cark.behavior-tree.node-defs.always-failure

The :always-failure node has no specific parameter. It ticks its child and responds to the result in this way :

  • Child is :running -> always-failure is :running
  • Child is :success -> always-failure is :failure
  • Child is :failure -> alway-failure is :failure
The :always-failure node has no specific parameter.
It ticks its child and responds to the result in this way :
- Child is :running -> always-failure is :running
- Child is :success -> always-failure is :failure
- Child is :failure -> alway-failure is :failure
raw docstring

cark.behavior-tree.node-defs.always-success

The :always-success node has no specific parameter. It ticks its child and responds to the result in this way :

  • Child is :running -> always-success is :running
  • Child is :success -> always-success is :success
  • Child is :failure -> alway-success is :success
The :always-success node has no specific parameter.
It ticks its child and responds to the result in this way :
- Child is :running -> always-success is :running
- Child is :success -> always-success is :success
- Child is :failure -> alway-success is :success
raw docstring

cark.behavior-tree.node-defs.bind

The :bind node establishes a dynamic context, storing some data in the defined variables while it executes its child subtree.

It has a single parameter :let which, just like clojure's let is a vector of variable names (a keyword) and variable values (a value or a context funtion).

[:bind {:let [:one 1 
              :two (bt/bb-getter-in [:some-bb-key])]}
  [send-event {:event :hello :arg (bt/var-getter :two)}]]
The :bind node establishes a dynamic context, storing some data in
the defined variables while it executes its child subtree.

It has a single parameter :let which, just like clojure's let is a vector of
variable names (a keyword) and variable values (a value or a context funtion).

```clojure
[:bind {:let [:one 1 
              :two (bt/bb-getter-in [:some-bb-key])]}
  [send-event {:event :hello :arg (bt/var-getter :two)}]]
```
raw docstring

cark.behavior-tree.node-defs.consume-event

The :consume-event node consumes an event if it is found in the inbound event list. -If the event was found, the node succeeds. -If the event was not found, the node fails, or stays running if the :wait? parameter is true.

Parameters: -:event : A keyword, or keyword returning context function. The name of the event to be consumed. -:pick? : A context function with two parameters. first the tree context, then the event argument being considered. This acts as an additional filter when considering incoming events to be consumed. The event will be consumed if this function returns a truthy value. -:wait? : A boolean, or boolean returning context function. When true the node will stay :running until the event is consumed. -:with-arg : A context function with two parameters, first the tree context, then the consumed event argument. This must return a possibly updated tree context.

The :consume-event node consumes an event if it is found in the inbound event list. 
-If the event was found, the node succeeds.
-If the event was not found, the node fails, or stays running if the :wait? parameter is true.

Parameters:
-:event : A keyword, or keyword returning context function. The name of the event to be consumed.
-:pick? : A context function with two parameters. first the tree context, then the event argument being considered. This acts as an additional filter when considering incoming events to be consumed. The event will be consumed if this function returns a truthy value.
-:wait? : A boolean, or boolean returning context function. When true the node will stay :running until the event is consumed.
-:with-arg : A context function with two parameters, first the tree context, then the consumed event argument. This must return a possibly updated tree context.
raw docstring

cark.behavior-tree.node-defs.failure-leaf

The :failure-leaf is a simple node that always fails

The :failure-leaf is a simple node that always fails
raw docstring

cark.behavior-tree.node-defs.guard

The :guard node is a special kind of branch node that can only have two children. The first child is called the predicate node, the second child is the payload node.

It is usefull for possibly interrupting a running subtree based on the predicate result.

Each time the :guard node is executed, that is when it is :fresh or :running, the predicate node will be re-run (refreshing it if it was in a :success or :failure state)

  • If the predicate succeeds, the payload node is then executed, and its result state assigned to the :guard node.
  • If the predicate fails, the payload node is not executed, or is interrupted when running, and the :guard node is set as :failure.

The predicate node must succeed or fail in a single tick.

The :guard node is a special kind of branch node that can only have two children.
The first child is called the predicate node, the second child is the payload node.

It is usefull for possibly interrupting a running subtree based on the predicate result.

Each time the :guard node is executed, that is when it is :fresh or :running, the
predicate node will be re-run (refreshing it if it was in a :success or :failure state)

- If the predicate succeeds, the payload node is then executed, and its result state assigned to the :guard node.
- If the predicate fails, the payload node is not executed, or is interrupted when running, and the :guard node is set as :failure.

The predicate node must succeed or fail in a single tick.
raw docstring

cark.behavior-tree.node-defs.guard-selector

The :guard-selector node may only have :guard children. Each time it is run, it will refresh and check each of its children's predicates until it finds one that succeeds. It will then run the child's payload, possibly interrupting any other previously running child payload.

The :guard-selector node will succeed when any of its children succeeds, and fail when either the running child fails, or all the predicates fail.

The :guard-selector node may only have :guard children.
Each time it is run, it will refresh and check each of its children's predicates until it finds one that succeeds.
It will then run the child's payload, possibly interrupting any other previously running child payload.

The :guard-selector node will succeed when any of its children succeeds, and fail
when either the running child fails, or all the predicates fail.
raw docstring

cark.behavior-tree.node-defs.inverter

The :inverter node succeeds when its child fails, and fails when its child succeeds.

The :inverter node succeeds when its child fails, and fails when its child succeeds.
raw docstring

cark.behavior-tree.node-defs.map

The :map node loops over a sequence, re-running its child with each item of the sequence being bound to a var. parameters:

  • :seq : a sequence, or sequence returning context function
  • :bind-item : the keyword name of the var to which each item will be bound

When the child succeeds :

  • if there are more items in the sequence, the child will be refreshed and rerun with the next item being bound.
  • if there are no more items, the :map node will succeed When the child fails, the :map node will fail

The sequence content is determined when the :map node is :fresh

The :map node loops over a sequence, re-running its child with each item of the sequence being bound to a var.
parameters:
- :seq : a sequence, or sequence returning context function
- :bind-item : the keyword name of the var to which each item will be bound

When the child succeeds :
- if there are more items in the sequence, the child will be refreshed and rerun with the next item being bound.
- if there are no more items, the :map node will succeed
When the child fails, the :map node will fail

The sequence content is determined when the :map node is :fresh
raw docstring

cark.behavior-tree.node-defs.on-cancel

The :on-cancel node has exactly two children. The first one is the cancel node and the second one is the payload node. It executes its payload node in a transparent manner. If the node is cancelled, that is when it goes from the :running state to the :fresh state, the cancel node is then executed.

Please note that the cancel node must succeed or fail in a single behavior tree tick.

This node is particularly usefull for releasing previously aquired resources, like a network socket for instance.

[:on-cancel [:send-event {:event :release-the-socket}]
  use-socket-sub-tree]
The :on-cancel node has exactly two children. 
The first one is the cancel node and the second one is the payload node.
It executes its payload node in a transparent manner. If the node is cancelled, that is
when it goes from the :running state to the :fresh state, the cancel node is then executed.

Please note that the cancel node must succeed or fail in a single behavior tree tick.

This node is particularly usefull for releasing previously aquired resources, like a network socket for instance.

```clojure
[:on-cancel [:send-event {:event :release-the-socket}]
  use-socket-sub-tree]
```
raw docstring

cark.behavior-tree.node-defs.on-event

The :on-event node acts in the same way as the :consume-event node, but it binds the event argument to a var and execute its child.

Parameters: -:event : A keyword, or keyword returning context function. The name of the event to be consumed. -:pick? : A context function with two parameters. first the tree context, then the event argument being considered. This acts as an additional filter when considering incoming events to be consumed. The event will be consumed if this function returns a truthy value. -:wait? : A boolean, or boolean returning context function. When true the node will stay :running until the event is consumed. -:bind-arg : the keyword name of the var to which the event argument will be bound.

The :on-event node acts in the same way as the :consume-event node, but it binds
the event argument to a var and execute its child.

Parameters:
-:event : A keyword, or keyword returning context function. The name of the event to be consumed.
-:pick? : A context function with two parameters. first the tree context, then the event argument being considered. This acts as an additional filter when considering incoming events to be consumed. The event will be consumed if this function returns a truthy value.
-:wait? : A boolean, or boolean returning context function. When true the node will stay :running until the event is consumed.
-:bind-arg : the keyword name of the var to which the event argument will be bound.
raw docstring

cark.behavior-tree.node-defs.parallel

The :parallel node executes its children in parallel, until it succeeds or fails according to its policy parameter.

parameters :

  • :rerun-children : (default to false) The :success and :failure children are refreshed and rerun while this node is :running
  • :policy : (defaults to :sequence) the policy can be :
    • :sequence : the node will succeed when all children succeed, fail when any fails
    • :select : the node will succeed when any child succeeds, fail when all fail
    • a map of the form {:success <value> :failure <value>} : each value can be
      • :every : every node must have the :success or :failure status
      • :some : some node must have the :success or :failure status
      • an integer : the specified number of children must have this status

Every child node is run before their result is checked against the policy

The :parallel node executes its children in parallel, until it
succeeds or fails according to its policy parameter.

parameters :
- :rerun-children : (default to false) The :success and :failure children are refreshed and rerun while this node is :running
- :policy : (defaults to :sequence) the policy can be :
  - :sequence : the node will succeed when all children succeed, fail when any fails
  - :select : the node will succeed when any child succeeds, fail when all fail
  - a map of the form {:success <value> :failure <value>} : each value can be
     - :every : every node must have the :success or :failure status
     - :some  : some node must have the :success or :failure status
     - an integer : the specified number of children must have this status

Every child node is run before their result is checked against the policy
raw docstring

cark.behavior-tree.node-defs.predicate

The :predicate node succeeds or fail depending on its pred parameter. parameters:

  • :func : This context function will extract data from the tree context, before passing it to the :pred function.
  • :pred : (defaults to identity) This function will be passed the result of the :func call. The node will succeed if this returns a truthy value, fail otherwise.
  • :wait? : The node will stay in the :running state until the predicate is met.
The :predicate node succeeds or fail depending on its pred parameter.
parameters:
- :func : This context function will extract data from the tree context, before passing it to the :pred function.
- :pred : (defaults to identity) This function will be passed the result of the :func call. The node will succeed if this returns a truthy value, fail otherwise.
- :wait? : The node will stay in the :running state until the predicate is met.
raw docstring

cark.behavior-tree.node-defs.repeat

The :repeat node will refresh and repeat its child. parameters :

  • :count : An integer, or integer returning context function. Once the count is reached, that is when the child succeeded or failed "count" times, the node succeeds.
  • :while : A predicate context function that is called on each iteration, the node succeeds as soon as this returns a falsy value
The :repeat node will refresh and repeat its child.
parameters :
- :count : An integer, or integer returning context function. Once the count is reached, that is when the child succeeded or failed "count" times, the node succeeds.
- :while : A predicate context function that is called on each iteration, the node succeeds as soon as this returns a falsy value
raw docstring

cark.behavior-tree.node-defs.select

The :select node succeeds when any of its children succeeds, and fails when every child fails

The :select node succeeds when any of its children succeeds, and fails when every child fails
raw docstring

cark.behavior-tree.node-defs.send-event

The :send-event node sends an event to the outside world. It may later be picked buy their core/get-events function.

parameters:

  • :event : a keyword or keyword returning function. The event name.
  • :arg : an optional function returning the for this event
The :send-event node sends an event to the outside world. It may later be picked buy their
core/get-events function.

parameters:
- :event : a keyword or keyword returning function. The event name.
- :arg : an optional function returning the for this event
raw docstring

cark.behavior-tree.node-defs.sequence

The :sequence function succeeds when all its children succeed and fails when any of these fails.

The :sequence function succeeds when all its children succeed and fails when any of these fails.
raw docstring

cark.behavior-tree.node-defs.success-leaf

The :success-leaf always succeeds

The :success-leaf always succeeds
raw docstring

cark.behavior-tree.node-defs.tick-eater

The :tick-eater node stays :running for a number of ticks, and then succeeds. parameters:

  • :count : An integer, or integer returning function. The number of ticks before succeeding.
The :tick-eater node stays :running for a number of ticks, and then succeeds.
parameters:
- :count : An integer, or integer returning function. The number of ticks before succeeding.
raw docstring

cark.behavior-tree.node-defs.timer

The :timer node stays :running until a certain duration (in milliseconds) has elapsed. parameters:

  • :timer : an optional keyword or keyword returning context function. The name of this timer.
  • :duration : an integer or integer returning context function. The numebr of milliseconds this node stays :running before succeeding.

This node has two modes of operation.

  • named timer : when the :timer parameter is set, the :timer node will start counting time based on the last completed timer with the same name (or now if none were found)
  • free timer : The duration starts counting when the :timer node passes from :fresh to :running

Although they're not always necessary, named timers are the most precise as their combined durations do not depend on the tick invokation times.

The :timer node stays :running until a certain duration (in milliseconds) has elapsed.
parameters:
- :timer : an optional keyword or keyword returning context function. The name of this timer.
- :duration : an integer or integer returning context function. The numebr of milliseconds this node stays :running before succeeding.

This node has two modes of operation.
- named timer :
  when the :timer parameter is set, the :timer node will start counting time based on the last completed timer with the same name (or now if none were found)
- free timer :
  The duration starts counting when the :timer node passes from :fresh to :running

Although they're not always necessary, named timers are the most precise as their combined durations do not depend on the tick invokation times.
raw docstring

cark.behavior-tree.node-defs.trace

The :trace node helps in debugging behavior trees. It will activate tracing on its sub-tree, sending hierarchical logging to the tap.

The :trace node helps in debugging behavior trees.
It will activate tracing on its sub-tree, sending hierarchical logging to the tap.
raw docstring

cark.behavior-tree.node-defs.until-failure

The :until-failure node refreshes and reruns its child node until it fails, and then returns :success

The :until-failure node refreshes and reruns its child node until it fails, and then returns :success
raw docstring

cark.behavior-tree.node-defs.until-success

The :until-success node refreshes and reruns its child node until it succeeds, and then returns :success

The :until-success node refreshes and reruns its child node until it succeeds, and then returns :success
raw docstring

cark.behavior-tree.node-defs.update

The :update node updates the tree context and then succeeds. parameters :

  • :func : a context function that updates the tree context is being passed.
The :update node updates the tree context and then succeeds.
parameters :
- :func : a context function that updates the tree context is being passed.
raw docstring

cark.behavior-tree.state-machine

Provides a state-machine implementation as a client library to the behavior tree library. Some book keeping data will thus be stored in the blackboard.

This merely creates a hiccup tree, that will then need to be compiled and used like a regular behavior tree.

Provides a state-machine implementation as a client library to the
behavior tree library. Some book keeping data will thus be stored in the blackboard.

This merely creates a hiccup tree, that will then need to be compiled and used like a regular
behavior tree.
raw docstring

cark.behavior-tree.tree

The tree map contains the static data of a behavior tree. That's the node themselves with their tick functions and parameters

The tree map contains the static data of a behavior tree.
That's the node themselves with their tick functions and parameters
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close