---
name: bt-condition-nodes-nav2
description: 'Use Nav2 BT condition nodes. Use when checking GoalReached, GoalUpdated, IsBatteryLow, TimeExpired, or IsPathValid conditions.'
---
# Nav2 Built-in Condition BT Nodes
Condition nodes are leaf nodes that return **SUCCESS** or **FAILURE** only—never RUNNING. They inspect the world state and are typically placed as the first child of a `ReactiveSequence` or `ReactiveFallback` to gate action execution.
## GoalUpdated
**The most critical condition node for replanning behavior trees.** Returns SUCCESS if the navigation goal has been updated since the last tick. Used in recovery sub-trees to short-circuit recovery when a new goal arrives.
```xml
```
No ports. Reads from the internal goal tracking in the BT navigator. This node is essential inside recovery fallbacks:
```xml
```
When `GoalUpdated` returns SUCCESS, the ReactiveFallback immediately returns SUCCESS without executing any recovery actions, allowing the main navigation branch to re-plan with the new goal.
## GoalReached
Returns SUCCESS if the robot is within tolerance of the current goal. Uses the goal checker plugin's tolerance values:
```xml
```
| Port | Direction | Type | Description |
|---------------|-----------|-------------|--------------------------|
| goal | input | PoseStamped | Goal to check against |
| server_name | input | string | Navigator server |
| server_timeout| input | int (ms) | Timeout |
Typically used to terminate navigation loops early.
## IsBatteryLow
Subscribes to a `sensor_msgs/msg/BatteryState` topic and returns SUCCESS when the battery percentage is below a threshold:
```xml
```
| Port | Direction | Type | Description |
|----------------|-----------|--------|--------------------------------------------------|
| battery_topic | input | string | Topic publishing BatteryState |
| min_battery | input | double | Threshold (0.0–1.0 for percentage, or voltage) |
| is_voltage | input | bool | If true, compare against voltage instead of % |
Returns SUCCESS when battery is LOW (below threshold). This is a condition to trigger charging behavior:
```xml
```
**Note the inversion**: SUCCESS means the battery IS low. To use it as a "battery OK" guard, wrap it in an Inverter:
```xml
```
## IsPathValid
Checks if a stored path is still traversable by querying the costmap. Returns FAILURE if any point on the path is now in collision:
```xml
```
| Port | Direction | Type | Description |
|---------------|-----------|------|--------------------------------|
| path | input | Path | Path to validate |
| server_name | input | string | Planner server for validation |
| server_timeout| input | int | Timeout |
Used in a ReactiveSequence to detect when obstacles invalidate the current path, triggering replanning:
```xml
```
If an obstacle appears on the path, `IsPathValid` returns FAILURE, halting `FollowPath` and propagating failure up the tree where a recovery or replanning branch handles it.
## DistanceTraveled
Returns SUCCESS when the robot has moved at least `distance` meters since this node was last reset. Used to trigger periodic replanning:
```xml
```
| Port | Direction | Type | Description |
|-------------------|-----------|--------|------------------------------|
| distance | input | double | Distance threshold in meters |
| global_frame | input | string | Global reference frame |
| robot_base_frame | input | string | Robot base frame |
Common pattern—replan every 2 meters:
```xml
```
## TimeExpired
Returns SUCCESS when `seconds` have elapsed since this node was first ticked:
```xml
```
Use for periodic operations. Note: the timer resets when the parent node resets this child (e.g., after the enclosing Sequence restarts).
## TransformAvailable
Returns SUCCESS if a TF transform between two frames is available:
```xml
```
Use in startup sequences to wait for localization to initialize before attempting navigation.
## InitialPoseReceived
Returns SUCCESS once an initial pose has been set (e.g., via RViz or the `/initialpose` topic). Useful for gating navigation until localization is bootstrapped:
```xml
```
## IsBatteryCharging
Returns SUCCESS when the robot is currently charging. Subscribes to the same `BatteryState` topic:
```xml
```
Use to hold the robot at the charging station:
```xml
```
## Custom Condition Patterns
### GlobalUpdatedGoal
A custom condition (not built-in) that detects if the global goal has changed from an external replanning request versus user input. Implement by comparing the current goal blackboard entry against a cached value:
```xml
```
### PathExpiringTimer
A custom condition that tracks path age and triggers replanning:
```xml
```
## Usage Pattern Summary
The typical condition placement in Nav2 trees follows this hierarchy:
```xml
```
Conditions placed earlier in a ReactiveSequence have **higher priority**—they are checked first on every tick and can preempt later children.