> For the complete documentation index, see [llms.txt](https://campus-rover.gitbook.io/lab-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://campus-rover.gitbook.io/lab-notebook/fiiva/our-ros-packages/behavior_trees/nodes.md).

# Nodes

A behavior tree is a tree-shaped data structure consisting of nodes, each of which contain a logical method which executes code. The behavor tree is evaluated recursively starting at the root node. Each node has the abilility to execute code which will either run a script, or execute all of its children. Each node will also return one of 3 outputs to its parent: "success", "failure", or "running". There are two main types of nodes: the control-flow (parent nodes) nodes and the leaf nodes.

## Control-Flow Nodes

* Selector
  * The Selector executes its children sequentially from left to right.
  * If one of its children returns either "success" or "running", it will halt execution of its children and it will return the result of the child it stopped on.
  * If all of its children return "failure", the Selector will also return "failure".
* Sequencer
  * The Sequencer executes its children sequentially from left to right.
  * The Sequencer will not halt execution of its children unless one of them returns "failure" or "running", in which case it will also return "failure" or "running".
  * If all children return "success" the Sequencer will return "success"
* Multitasker
  * The Multitasker runs all of its children concurrently, each in a separate thread.
  * The Multitasker will return "success" only if all of it's children return "success".
  * If any of its children return "running" but none return "failure", the Multitasker will return "running".
  * If any of its children return "failure", the Multitasker will return "failure".

## Leaf Nodes

* Action Nodes
  * Action nodes send ROS topic messages from the behavior tree to the robot.
  * Often the type of message sent from an Action node is a cmd\_vel message which encodes movement instructions for the robot.
* Update Nodes
  * Update nodes are designated for updating data in the blackboard.
  * Often times the types of data updates performed by Update nodes include preprocessing or processing of message data from the robot.
* Conditional Nodes
  * Conditional nodes will return either "success" or "failure", corresponding to the boolean values "true" and "false" respectively
  * Conditional nodes will access data in the blackboard and return one of the two values listed above based on if a particular condition is met within the data.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://campus-rover.gitbook.io/lab-notebook/fiiva/our-ros-packages/behavior_trees/nodes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
