Skip to content

Conversation

corot
Copy link
Contributor

@corot corot commented Oct 3, 2025

Retry a failed main task after attempting one or more recovery behaviors.

This is similar to the recovery node implemented in Nav2.

I know @stonier is more in the purist side and won't like this so much, but I tried to implement the same behavior with existing components, but it's much harder than it sounds.

⚠️ This is a though one. I didn't go deep into the internals of py_trees, so I relied heavily on cGPT. Thus, I ask for a thorough and interactive review to improve and fix any issue. Particularly I have no idea about how .dot works. The file I add is at cGPT created it. I guess we need to tune somehow so this composite appears with its own color in the viewer.

Thanks!

@corot corot force-pushed the add_Recovery_composite branch 4 times, most recently from 9f6177c to b2719fd Compare October 3, 2025 17:32
@corot corot force-pushed the add_Recovery_composite branch from b2719fd to 866d9ae Compare October 3, 2025 17:38
@corot
Copy link
Contributor Author

corot commented Oct 9, 2025

Hi @sea-bass , sorry for asking you for help directly. On this PR I'm waiting for your support (or any other maintainer, but you look like the only one active). What I ask

  • green / red light to proceed or not with the change
  • help on integrating in the GUI (and decide a new color)
  • thorough review
  • some guiding for updating the documentation

Thanks!

@sea-bass
Copy link
Member

sea-bass commented Oct 10, 2025

Hi @corot, my high-level though is: Instead of being a special case for the GUI etc., is there a way to treat it as another of the composites?

I guess this is where my BehaviorTree.CPP comes out, in that there the colors of the GUI correspond go leaf nodes, control nodes, and decorators only.

So maybe what we should do here is pick a new color to correspond to "other" (custom) control nodes and go that way? This would make it easy to later integrate more custom control nodes. How about purple? Really, any color that is not here

Otherwise, looks fine to me to add the new functionality.

@alisys-robotics
Copy link

alisys-robotics commented Oct 11, 2025

😆 green
But cannot see why not to add a color for Recovery,,,, as all other composites have their own 🤔
I don't expect other "official" composites to get added to py_trees repos. I guess most other particular needs will be addressed with private implementations. I PR Recovery because I found the same limitation consistently across 3 different BT implementations!

Nice — since your Recover composite sounds like a safety or fallback mechanism (something that activates after failure), the color should suggest recovery, stability, and alertness — but still stand out from the rest.

Here are a few good options:

Color Hex Meaning
🟩 Emerald Green #2ECC71 Suggests recovery, health, and successful restoration — fits the “recover” semantics perfectly.
🟦 Steel Blue #4682B4 Conveys calm control, reliability, and system stability — great for a composite that restores order.
🟪 Slate Purple #9370DB Distinct yet not alarming; visually differentiates recovery logic from functional composites.
🟧 Amber #FFBF00 A transition color between orange (sequence) and yellow (parallel), suggesting “in-between recovery mode.”

Recommended choice:

'Recover': '#2ECC71'  # Emerald green for restoration/success

It’s visually distinct from your existing set and semantically intuitive (green = recover / OK).

@sea-bass
Copy link
Member

Aren't red, green, and blue used to denote success/failure/running in the lines? I'm kinda still thinking purple for that reason. But some visuals of a real tree ticking may help us decide.

@alisys-robotics
Copy link

alisys-robotics commented Oct 11, 2025

Aren't red, green, and blue used to denote success/failure/running in the lines? I'm kinda still thinking purple for that reason. But some visuals of a real tree ticking may help us decide.

Ah, true. Let's try purple then

Adding the color there is the only required change?

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.

3 participants