Skip to content

Comments

Implement BehaviourTrees for forall and imply#345

Closed
eshan-savla wants to merge 22 commits intoPlanSys2:humble-develfrom
eshan-savla:humble-devel
Closed

Implement BehaviourTrees for forall and imply#345
eshan-savla wants to merge 22 commits intoPlanSys2:humble-develfrom
eshan-savla:humble-devel

Conversation

@eshan-savla
Copy link
Contributor

Changes:

This pull request introduces several changes to the plansys2_domain_expert, plansys2_problem_expert, plansys2_pddl_parser and plansys2_executor packages, primarily to enhance the handling of durative actions by introducing new PDDL functionality using forall and imply and corresponding tests.

Parser updates:

  • Corrected parsing method to match intended functionality of imply key in Imply.cpp.
  • Implemented getTree methods for both forall and imply. Respective changes in Forall.cpp and Imply.cpp.
  • Added optional instances_map field to pure virtual method in Condition.h and respective derived classes to allow forall to supplement action params with instances from typed lists.

Domain expert updates:

  • To support BT creation for forall and its child trees, instances are now provided to the getDurativeAction method to supply the necessary instances to the forall getTree method.
  • Updated pure virtual method DomainExpertInterface::getDurativeAction and its overrides to optionally accept a plansys2_msgs::msg::Param vector of instances.
  • DomainExpert::getDurativeAction converts this vector into a map of format instance-type : instances and supplies this to all three precondition types. Effects are excluded at this point, as POPF support for forall in effects is limited. Extending support for forall in effects is simply a matter of providing these instances to the AtStart and AtEnd effects.

Updates to executor nodes:

  • All instances are requested from the problem expert when a request to execute is recieved.
  • All calls to the getDurativeAction method of the domain client are supplied with these instances in ExecutorNode.cpp and BTBuilder.cpp.

Updates to problem expert:

  • New cases for forall and imply are are added to the evaluate method in Utils.cpp.
  • As imply can only be used in preconditions, no logic for effect application is implemented for its case.

New PDDL functionality and tests:

  • A new test case is added to bt_node_test.cpp within the executor package with the appropriate pddl domain to test the new functionalities implemented.

@eshan-savla
Copy link
Contributor Author

This also solves my comment in #283 as well as the issue I opened #344

@fmrico
Copy link
Contributor

fmrico commented Mar 4, 2025

Hi @eshan-savla

All the new developments should go to the rolling branch. Other branches are only for creating binary packages and only receive bug fixes. Please, start changing the target branch to merge in, and I suppose you have to start from the current rolling or, at least, rebase this PR. As soon as you do it, I will start reviewing.

Thanks for your contributions

@eshan-savla
Copy link
Contributor Author

Hi @fmrico,

Thanks for the clarification! I worked on the humble branch because I needed the functionality for that version. I have however rebased the changes onto rolling and tested everything. Here's the corresponding PR: #347. Thank you for your prompt response!

We could also close this pull request if you don't wish to include these changes into the humble branch

@fmrico
Copy link
Contributor

fmrico commented May 24, 2025

Closing then

@fmrico fmrico closed this May 24, 2025
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