Nav2 BT Editor: a VS Code extension for editing and previewing Nav2 behavior trees

Dear ROS community,

As I have been using ROS 2 behavior trees more and more, especially with Nav2, I found myself in a slightly awkward workflow.

For small changes or quick previews, opening Groot often felt heavier than what I needed. But once the behavior trees started growing, editing them directly in XML also became harder to reason about. I often just wanted a quick visual way to inspect the tree, tune a few attributes, move nodes around, and keep working.

Over the last couple of weeks I built a VS Code extension to help with exactly that workflow:

Nav2 BT Editor

It is a visual editor for BehaviorTree.CPP / Nav2 XML behavior trees inside VS Code. The focus is on small tuning changes, quick previews, and editing existing BT XML files without leaving the editor.

nav_bt_editor

After using it myself quite a bit, and after showing it to a few colleagues who also found it useful in their workflow, I decided to open source and publish it.

Important note: this is only a preview/editor tool. It does not tick the tree, execute behavior trees, connect to ROS directly, or replace runtime validation in Nav2.

Some of the current functionality:

  • Visualize Nav2 / BehaviorTree.CPP XML trees as an editable graph
  • Edit node attributes and write changes back to XML
  • Add nodes from imported TreeNodesModel definitions
  • Import TreeNodesModel files from local files or URLs
  • Import external behavior trees as reusable SubTree templates
  • Add, delete, copy, cut, and paste nodes
  • Drag and drop nodes to reorder or move them between valid parents
  • Navigate SubTrees one tree at a time, or expand them inline
  • Change a node to another compatible type
  • Highlight the selected graph node in the XML editor
  • Basic malformed XML detection for common cases that otherwise make the tree preview misleading

The extension is published on the VS Code Marketplace as:

Nav2 BT Editor

davidg-develop.vscode-nav2-bt-editor

GitHub repo:

I would be happy if people working with Nav2 behavior trees tried it out and gave feedback. In particular, I am interested in whether the editing workflow fits how others structure and tune their Nav2 trees, and whether there are common Nav2 / BehaviorTree.CPP patterns that should be better supported.

Happy coding!

3 Likes