> 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/build.md).

# build

The mr\_bt project allows users to define behavior trees as JSON files. Each node in the behavior tree is a JSON dictionary object, for example:

```
{
    "name":"goal_pid",
    "type":"Multitasker",
    "children":[
        
        {
            "name":"Calculate angular velocity necessary to face towards the position",
            "type":"PathCorrection",
            "correction_var_name":"angular_goal_pid",
            "goal_value_var_name":"goal_rotation",
            "current_value_var_name":"rotation",
            "max_vel":1.5
          },
          {
            "name":"Calculate linear velocity to get to position",
            "type":"PathCorrection",
            "correction_var_name":"linear_goal_pid",
            "goal_value_var_name":"dist",
            "current_value_var_name":"dummy_current_value",
            "max_vel":0.1,
            "offset":0
          }
    ],
    "blackboard":{
        "angular_goal_pid":null,
        "linear_goal_pid":null,
        "dummy_current_value":0,
        "dist":null
    },
    "blackbox":true
}
```

## Folder structure

When building a new project create a new folder with the name of your project in `mr_bt/src/tree_jsons`.

Each behavior tree project must have a root JSON file named `root.json`. This file will define the root node of your behavior tree and must be unique in your project folder. For example if you want to make a new project named `my_new_bt_project`, your folder structure should look something like this:

```
mr_bt/src/tree_jsons/
  my_new_bt_project/
    root.json
    action1.json
    action2.json
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
