Skip to content
osu-uwrtPublic

About

Anything but Groot behavior tree editor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

notgroot

Anything but Groot. notgroot is a keyboard-first editor for BehaviorTree.CPP 4 XML, built for UWRT's riptide_autonomy trees. It reads and writes the same files doTask runs, and it doesn't add anything to them.

notgroot is built on Nereus's stack (C++17, Dear ImGui with docking, GLFW/OpenGL) and uses Nereus's themes and fonts. It follows your Nereus theme, so the two look alike and notgroot can later become a Nereus panel. Its features started from btstudio: btstudio's node colors and variable handling carry over.

Build and run

./build.sh                       # release build in build/release (dev, asan presets: ./build.sh dev)
build/release/app/notgroot ~/osu-uwrt/development/software/src/riptide_autonomy/trees
  • Dependencies: cmake g++ libglfw3-dev libglew-dev libyaml-cpp-dev libfontconfig-dev libpng-dev libtinyxml2-dev libgtest-dev, plus zenity (or kdialog) for File > Open.
  • BehaviorTree.CPP: the first configure downloads BehaviorTree.CPP 4.10.0 (the version the robot runs) and builds it without ROS, for the check below.
  • What opens: notgroot opens a trees folder, a file inside one, or a single loose tree file. Without an argument, it reopens the last folder.
  • Tests: ctest --preset dev (after ./build.sh dev). The tests include a round trip of the real trees when NOTGROOT_TREES_DIR is set.

What it edits

notgroot works on the riptide_autonomy trees layout, written down in docs/contract.md:

  • Missions are the files directly in trees/.
  • Every subtree is one file, trees/lib/<ID>.xml, which <include>s the subtrees it calls.
  • Node ports live in trees/lib/node_models.xml. ros2 run riptide_autonomy2 updateNodeModels regenerates the Action/Condition/Decorator entries; notgroot edits the SubTree port entries.

Files are written in one canonical format. Opening and saving a file without changing it leaves its bytes alone, and saving writes only the files you changed. Includes are recomputed on save, so you never edit them by hand.

The editor

  • Canvas. Layout is automatic, and child order on screen is the order in the file. Dragging a node (or the selection) moves it in the tree: beside another node, or into it.

    • Cards are plain, with a bar down the left for their kind: action slate, condition teal, control orange, decorator purple, subtree taupe. A subtree can have its own color.
    • Nodes that steer the flow have Groot's color and icon on their title: Sequence pink, Fallback blue (reactive ones deeper), Force/AlwaysSuccess green, Force/AlwaysFailure red, other decorators (Inverter, Repeat, Retry, Timeout) yellow, conditions green.
    • Subtree calls have a dashed border.
    • Each port shows IN / OUT / IO, and values that are {keys} are drawn in that key's own color everywhere. A tree's keys are colored together, so no two look alike (up to 20 keys stay well apart in every theme; larger trees get as much spread as the theme's readable colors allow).
    • Above each call, a small count says how many trees call that subtree.
    • Space, or the round button under a call, opens a subtree in place, grayed on a band of its color that takes in the call, because it starts locked; calls inside it open the same way. Its globals sit in a box beside the call. Click the round padlock on the call's corner (or Ctrl+U) to unlock it: the band turns amber, and the subtree and its globals can be edited right there. Locking it, or closing it, also locks every subtree under it. Double-click the call's title, or Ctrl+Enter, to open it in its own tab.
    • Double-click a port's row to edit its value right on the card, or a node's title to name it (Enter keeps, Esc cancels, Tab moves to the next row). The card grows with the text as you type. In a locked subtree, a double-click opens the subtree in its own tab on that node.
    • Zoom with Ctrl+wheel, Ctrl+=/-, or a touchpad pinch (XInput 2.4 gestures, as XWayland and recent X servers send).
    • Selection: Ctrl/Shift+click, Shift+drag for a box, and keys for siblings, a whole branch or every node of one type.
    • Right-click shows only what applies to that node; what can't run right now is grayed, with the reason.
  • Inspector.

    • Edits a node's name and ports.
    • The {} button switches a value between text and a key. A value is a key only when it starts with { and ends with }; a {{key}} is a key named {key}.
    • Typing { suggests the tree's keys.
    • Also adds preconditions and scripts (_skipIf, _onSuccess…).
  • Variables. The open tree's blackboard keys, in three sections:

    • Inputs: the subtree's ports, shown on its root card too.
    • Globals: set before the tree runs, usable anywhere in it, with no nodes on the canvas (one hidden Script, contract section 5). Edit them in place; a value can use other globals and inputs ({object}_frame), and notgroot writes them in the order that needs, refusing globals that use each other in a circle (shown in red). After a {, the rest of the nearest key shows in gray; Tab takes it and closes the brace. Right-click a SetBlackboardV3 or Format and choose Make global to turn it into one.
    • Locals: every key bound while the tree runs (a node's {key}, a setter, a script), with reads and writes, and whether it is never set or never read.
    • Select a key to highlight it on the canvas and list its uses.
    • F2 renames it, at the subtree's call sites too when it is a port.
    • Keys named in script code (Precondition if, _skipIf and the other script attributes, Script) count as reads, or as writes when assigned.
  • Trees panel and palette. Missions and subtrees, and every node model, each with a fuzzy filter. Drag a model onto a card (its middle: inside; its ends: beside), or double-click it, to add it. While dragging, the cards that can take it are ringed, and anywhere it can't go a note says why.

  • Getting started tour. Shown on the first start and from Help: what differs from Groot, each move with the mouse and with its keys.

  • Problems. notgroot checks as you edit, for:

    • unknown nodes and ports, and wrong child counts;
    • SubTree calls to trees that don't exist, and subtrees that call each other in a loop;
    • outputs that store nothing;
    • keys read but never set;
    • text passed to a subtree that BehaviorTree.CPP would type as a number.

    On every save (and on F7), every mission is loaded by BehaviorTree.CPP 4.10 itself, through notgroot-check, and anything it rejects shows up here. You can also run build/release/tools/check/notgroot-check trees/ from a shell or CI.

  • Moving by keyboard. Alt+arrows always move a node. Where its new parent can't hold it, it floats there, drawn dotted, until you move it on; nothing is saved while a node floats.

  • Refactors. Rename a tree (its file follows), rename a key, edit a subtree's ports (calls follow), and extract the selection into a new subtree (ports inferred from the keys it uses). Each refactor is one undo step, however many files it touches.

  • Disk. A file changed on disk reloads by itself. If it also has unsaved edits, notgroot asks which version to keep.

docs/keys.md lists every key and mouse action; F1 shows the same list in the editor. The status bar shows the main ones, and Ctrl+Shift+P lists every command.

Layout of the code

Path What
libraries/core no UI: lossless XML and the canonical writer, node models, the workspace, undo, edits and refactors, variables, validation, layout, fuzzy search, the BehaviorTree.CPP check runner
libraries/ui the panels (ImGui): canvas, inspector, variables, problems, finder, picker, dialogs; the theme loader is Nereus's
app the window, menus, dock layout and preferences (~/.config/notgroot/notgroot.yaml)
tools/check notgroot-check (BehaviorTree.CPP 4.10 with placeholder nodes)
tests GTest suites, including headless ImGui frames driven by key presses

The theme follows Nereus's ~/.config/nereus/viewer.yaml, else timing-board. View > Theme picks another one, or "Follow Nereus" again.

About

Anything but Groot behavior tree editor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages