From 3156cba9a8a87fd3cd82bdcfb99ee6a48b0e4b31 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 29 Aug 2024 16:02:41 -0300 Subject: [PATCH] in existPredicate check if derived predicate is satisfied --- .../src/plansys2_problem_expert/ProblemExpert.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plansys2_problem_expert/src/plansys2_problem_expert/ProblemExpert.cpp b/plansys2_problem_expert/src/plansys2_problem_expert/ProblemExpert.cpp index 80e83d31..c50a5076 100644 --- a/plansys2_problem_expert/src/plansys2_problem_expert/ProblemExpert.cpp +++ b/plansys2_problem_expert/src/plansys2_problem_expert/ProblemExpert.cpp @@ -448,6 +448,20 @@ ProblemExpert::existPredicate(const plansys2::Predicate & predicate) i++; } + if (!found) + { + std::vector parameters_names; + std::for_each (predicate.parameters.begin(), predicate.parameters.end(), + [&](auto p){parameters_names.push_back(p.name);}); + auto derived_predicates = domain_expert_->getDerivedPredicate(predicate.name, parameters_names); + for(auto derived : derived_predicates){ + if(check(derived.preconditions, predicates_, functions_)){ + found = true; + break; + } + } + } + return found; }