Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for derived predicates #318

Draft
wants to merge 11 commits into
base: rolling
Choose a base branch
from

Conversation

Rezenders
Copy link
Contributor

@Rezenders Rezenders commented Aug 27, 2024

Add support for derived predicates

Related to #317

@fmrico
Copy link
Contributor

fmrico commented Aug 28, 2024

Hi @Rezenders

Very interesting feature!! But I think it is not only being able to read a pddl file, but have it full functionality that includes:

  • Read structure
  • Show it in the PlanSys2 Terminal
  • Add a getDeriveds() method to DomainExpertInterface.hpp and implement it at DomainExpertNode.hpp and DomainExpertClient.hpp
  • AFAIK, a derived predicate adds a predicate to the problem when the expression is true, right? So, we should make a mechanism that, during the plan execution, for each new predicate, evaluate if a derived predicate can also be added.

Do you think we could use this PR to try to complete this list?

Thanks!!
Francisco

@Rezenders
Copy link
Contributor Author

Hello @fmrico,

Thanks for the input!

Do you think we could use this PR to try to complete this list?

Sure :)

Add a getDeriveds() method to DomainExpertInterface.hpp and implement it at DomainExpertNode.hpp and DomainExpertClient.hpp

What do you think should be the return type of a getDerived method? Should we add a new Derived.msg? Something like:

plansys2_msgs/Node inferred_predicate
plansys2_msgs/Tree preconditions

AFAIK, a derived predicate adds a predicate to the problem when the expression is true, right?

Yeah, I believe that is probably how the planner handles derived predicates. @tobiaswjohn do you have any input on this?

So, we should make a mechanism that, during the plan execution, for each new predicate, evaluate if a derived predicate can also be added.

I am not sure I understood this part

@Rezenders Rezenders marked this pull request as draft August 28, 2024 19:59
@Rezenders
Copy link
Contributor Author

Rezenders commented Aug 28, 2024

Add a getDeriveds() method to DomainExpertInterface.hpp and implement it at DomainExpertNode.hpp and DomainExpertClient.hpp

This is supposed to be done. I still need to figure out a way to test the services.

PS: I had problems when derived predicates had exists conditions. It says it is not supported in PlanSys. I would also be interested in adding support for this, but I guess this can go in a separate issue/PR

plansys2_msgs::msg::Node::SharedPtr Exists::getTree( plansys2_msgs::msg::Tree & tree, const Domain & d, const std::vector<std::string> & replace ) const {
throw UnsupportedConstruct("Exists");
}

@fmrico
Copy link
Contributor

fmrico commented Aug 29, 2024

Hi @Rezenders

So, we should make a mechanism that, during the plan execution, for each new predicate, evaluate if a derived predicate can also be added.

I am not sure I understood this part

I suppose that, during the execution of a plan, if the expression of a derived predicate is true, we should add the predicate (the derived predicate), right? In that case, we should think on a runtime mechanism to do it.

PS: I had problems when derived predicates had exists conditions. It says it is not supported in PlanSys. I would also be interested in adding support for this, but I guess this can go in a separate issue/PR

Yes, it can go in a separate predicate.

Thanks!!! :)

@Rezenders
Copy link
Contributor Author

Rezenders commented Aug 29, 2024

I suppose that, during the execution of a plan, if the expression of a derived predicate is true, we should add the predicate (the derived predicate), right? In that case, we should think on a runtime mechanism to do it.

What if we just check if the derived predicates preconditions are satisfied when existPredicate is called?
Something like:

https://github.com/Rezenders/ros2_planning_system/blob/3156cba9a8a87fd3cd82bdcfb99ee6a48b0e4b31/plansys2_problem_expert/src/plansys2_problem_expert/ProblemExpert.cpp#L451-L463

I still need to test if this actually works.

@Rezenders
Copy link
Contributor Author

Rezenders commented Aug 30, 2024

I still need to test if this actually works.

I can't test with the setup I have because the planner I am using that supports derived predicates doesn't support durative actions. Related to issue #319

@Rezenders Rezenders marked this pull request as ready for review September 2, 2024 17:17
@Rezenders Rezenders marked this pull request as draft September 20, 2024 07:47
@Rezenders
Copy link
Contributor Author

Rezenders commented Sep 20, 2024

I don't think it is ready to merge.
The evaluation is not working when use_state is true.

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.

2 participants