Metadata-Version: 2.4
Name: bteng-nav2
Version: 0.4.0
Summary: Nav2 behavior tree nodes for the BTEng engine
Author-email: BTEng contributors <mdirzpr@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/BTEng-dev/bteng-nav2
Project-URL: Documentation, https://github.com/BTEng-dev/bteng-nav2/tree/main/docs
Project-URL: Bug Tracker, https://github.com/BTEng-dev/bteng-nav2/issues
Keywords: behavior-tree,robotics,ros2,nav2,navigation,automation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bteng<0.5,>=0.4.0
Requires-Dist: bteng-ros2<0.5,>=0.4.0
Requires-Dist: pyyaml>=5.4
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/BTEng-dev/bteng-nav2/main/docs/images/BTEng-Nav2.webp" alt="bteng-nav2 — Nav2 extension for BTEng" width="720">
</p>

# bteng-nav2

[![PyPI](https://img.shields.io/pypi/v/bteng-nav2)](https://pypi.org/project/bteng-nav2/)
[![Python](https://img.shields.io/badge/python-3.12%2B-blue)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/BTEng-dev/bteng-nav2/blob/main/LICENSE)
[![Version](https://img.shields.io/badge/version-0.4.0-green)](https://github.com/BTEng-dev/bteng-nav2/blob/main/pyproject.toml)
[![bteng](https://img.shields.io/badge/bteng-%3E%3D0.4.0%2C%3C0.5-blue)](https://pypi.org/project/bteng/)
[![bteng-ros2](https://img.shields.io/badge/bteng--ros2-%3E%3D0.4.0%2C%3C0.5-blue)](https://pypi.org/project/bteng-ros2/)

Nav2 behavior tree nodes for the [BTEng](https://pypi.org/project/bteng/) engine.

A pure Python pip library — no ROS 2 workspace, no colcon, no XML behavior trees required.
Every Nav2 action server, service, and common condition is available as a composable BTEng node.

- **One command** — `bteng-nav2 run trees/ -p params.yaml`; a project ships params and XML only
- **13 actions, 8 services, 6 conditions, 2 publishers** — navigation, planning, recovery, docking, costmaps, maps
- **Retargetable endpoints** — a second planner or a per-robot namespace is a tree change, not a subclass
- **`--dry-run` CI gate** — builds every tree and validates every seeded value, no ROS installation needed
- **Offline-testable** — the test suite stubs ROS 2 and Nav2, so plain `pytest` works anywhere

## Install

```bash
source /opt/ros/jazzy/setup.bash   # or kilted / rolling
pip install bteng-nav2
```

Requires Python ≥ 3.12, so ROS 2 **Jazzy onward** — Humble and Iron ship Python 3.10 and are not
supported. `bteng` and `bteng-ros2` are pulled in automatically. Full requirements and troubleshooting:
[Installation](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/getting-started/install.md).

## Quick start

A project needs **no application Python** — a params file, a tree, and one command:

```yaml
# params.yaml
blackboard:
  goal_pose:   {type: pose, frame_id: map, x: 2.0, y: 1.5, yaw: 0.0}
  backup_dist: 0.30
```

```xml
<!-- trees/navigate.xml -->
<root BTEng_format="1.0" main_tree_to_execute="main">
  <BehaviorTree ID="main">
    <Fallback name="navigate_with_recovery">
      <NavigateToPose name="attempt" goal_pose="{goal_pose}" result="{nav_result}" />
      <Sequence name="recover_and_retry">
        <ClearGlobalCostmap name="clear" />
        <BackUp name="back_off" backup_dist="{backup_dist}" />
        <NavigateToPose name="retry" goal_pose="{goal_pose}" />
      </Sequence>
    </Fallback>
  </BehaviorTree>
</root>
```

```bash
bteng-nav2 run trees/ -p params.yaml --dry-run    # parse + build only: CI gate, no robot
bteng-nav2 run trees/ -p params.yaml              # run every tree in the directory
```

Poses are built in the YAML because a BT XML attribute is a string and `NavigateToPose` wants a
`geometry_msgs/PoseStamped`. Exit code is 0 only if every tree succeeded. Prefer to build the tree
in Python? That still works — see
[Building Trees](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/building-trees.md).

## Documentation

Docs live in [`docs/`](https://github.com/BTEng-dev/bteng-nav2/tree/main/docs):

- [Installation](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/getting-started/install.md) — requirements, virtualenv, development install, troubleshooting
- [Quick Start](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/getting-started/quickstart.md) — one goal, from XML and from Python
- [Running from the CLI](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/cli.md) — params file, value types, tag names, `--dry-run`, `--namespace`, flags
- [Retargeting Endpoints](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/endpoints.md) — `action_name` / `service_name` / `topic_name` ports, namespaces
- Node guides, with ports and defaults:
  [Actions](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/actions.md) ·
  [Services](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/services.md) ·
  [Conditions](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/conditions.md) ·
  [Publishers](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/publishers.md)
- [Building Trees](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/building-trees.md) — composing trees in Python, how the nodes are built, custom nodes
- [Testing Without ROS](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/guide/testing.md) — the stub layer and writing node tests
- Examples (sources in [`examples/`](https://github.com/BTEng-dev/bteng-nav2/tree/main/examples)):
  [Navigate to Pose](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/examples/navigate-to-pose.md) ·
  [Compute & Follow](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/examples/compute-and-follow.md) ·
  [Patrol Loop](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/examples/patrol-loop.md) ·
  [Recovery Tree](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/examples/recovery-tree.md) ·
  [Full Autonomy](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/examples/full-autonomy.md)
- API reference:
  [Actions](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/reference/actions.md) ·
  [Services](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/reference/services.md) ·
  [Conditions](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/reference/conditions.md) ·
  [Publishers](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/reference/publishers.md)
- [Changelog](https://github.com/BTEng-dev/bteng-nav2/blob/main/docs/changelog.md)

## License

MIT
