Skip to content

Add live visualization of Behavior Tree from nav2_msgs/msg/BehaviorTreeLog message - #2

Merged
zeerekahmad merged 4 commits into
polymathrobotics:mainfrom
mindThomas:live-visualization
Aug 18, 2026
Merged

Add live visualization of Behavior Tree from nav2_msgs/msg/BehaviorTreeLog message#2
zeerekahmad merged 4 commits into
polymathrobotics:mainfrom
mindThomas:live-visualization

Conversation

@mindThomas

Copy link
Copy Markdown
Contributor

Summary

Adds live runtime state visualization to the Behavior Tree Foxglove panel using nav2_msgs/msg/BehaviorTreeLog messages alongside the existing BehaviorTree.CPP XML tree visualization.

peek_1

What changed

  • Added support for selecting and subscribing to a Behavior Tree Logs Topic with schema nav2_msgs/msg/BehaviorTreeLog.
  • Added live node-status state handling for BehaviorTree.CPP transition logs:
    • Extracts XML from raw or std_msgs/msg/String-shaped messages.
    • Extracts behavior tree logs from raw or wrapped message payloads.
    • Normalizes supported node statuses: IDLE, RUNNING, SUCCESS, FAILURE, and SKIPPED.
    • Applies log events incrementally while retaining prior node state.
  • Matches runtime status events to graph nodes by BehaviorTree.CPP _uid, with a unique-node-name fallback when UID data is unavailable.
  • Updates graph rendering to display live status colors and status labels on nodes:
    • Gray: IDLE
    • Amber / pulsing: RUNNING
    • Green: SUCCESS
    • Red: FAILURE
    • Slate: SKIPPED
  • Animates edges leading into currently running nodes.
  • Clears accumulated live state when:
    • Foxglove playback seeks.
    • The selected XML or log topic changes.
    • A different behavior tree XML document replaces the loaded tree.
  • Added unit tests for live state extraction, normalization, application, ordering, fallback behavior, and invalid input handling.
  • Updated README usage instructions and changelog entries for live visualization.

Why

Previously, the panel visualized only the static BehaviorTree.CPP XML structure. This change enables users to inspect recorded or live Nav2 behavior tree execution directly in Foxglove by overlaying runtime status transitions onto the graph.

Fixes #1

Testing

  • Ran behavior-tree unit tests:
cd behavior-tree
npm run vitest

Compiled, installed and tested the extension with Foxglove:

cd behavior-tree
npm run build
npm run local-install

@troygibb troygibb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@mindThomas

Copy link
Copy Markdown
Contributor Author

@troygibb We need a reviewer with write permissions such that this PR can be merged.

@mindThomas

Copy link
Copy Markdown
Contributor Author

@troygibb This has still not been sufficiently approved.

@mindThomas

Copy link
Copy Markdown
Contributor Author

@troygibb Any updates here?

@zeerekahmad

Copy link
Copy Markdown

@troygibb Any updates here?

Sorry for the delay @mindThomas!

@zeerekahmad
zeerekahmad merged commit 2434bfa into polymathrobotics:main Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

visualization of BehaviorTree.CPP

3 participants