Skip to content

Commit

Permalink
add params to getDerivedPredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
Rezenders committed Aug 29, 2024
1 parent 4145011 commit bf175c6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class DomainExpert : public DomainExpertInterface
* \return A Derived object containing the predicate name, its parameters (name and type), and preconditions.
* If the predicate does not exist, the value returned has not value.
*/
std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(const std::string & predicate);
std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(
const std::string & predicate,
const std::vector<std::string> & params = {});

/// Get the regular actions existing in the domain.
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ class DomainExpertClient : public DomainExpertInterface
* \return A Derived object containing the predicate name, its parameters (name and type), and preconditions.
* If the predicate does not exist, the value returned has not value.
*/
std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(const std::string & predicate);
std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(
const std::string & predicate,
const std::vector<std::string> & params = {});

/// Get the regular actions existing in the domain.
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class DomainExpertInterface
* \return A Derived object containing the predicate name, its parameters (name and type), and preconditions.
* If the predicate does not exist, the value returned has not value.
*/
virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(const std::string & predicate) = 0;
virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(
const std::string & predicate,
const std::vector<std::string> & params = {}) = 0;

/// Get the regular actions existing in the domain.
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ DomainExpert::getDerivedPredicates(){
}

std::vector<plansys2_msgs::msg::Derived>
DomainExpert::getDerivedPredicate(const std::string & predicate){
DomainExpert::getDerivedPredicate(const std::string & predicate, const std::vector<std::string> & params){
std::vector<plansys2_msgs::msg::Derived> ret;

std::string predicate_search = predicate;
Expand All @@ -206,7 +206,7 @@ DomainExpert::getDerivedPredicate(const std::string & predicate){

// Preconditions
if (domain_->derived[i]->cond) {
domain_->derived[i]->cond->getTree(derived.preconditions, *domain_);
domain_->derived[i]->cond->getTree(derived.preconditions, *domain_, params);
}

ret.push_back(derived);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ DomainExpertClient::getDerivedPredicates()
}

std::vector<plansys2_msgs::msg::Derived>
DomainExpertClient::getDerivedPredicate(const std::string & predicate)
DomainExpertClient::getDerivedPredicate(const std::string & predicate, const std::vector<std::string> & params)
{
while (!get_derived_predicate_details_client_->wait_for_service(std::chrono::seconds(1))) {
if (!rclcpp::ok()) {
Expand Down

0 comments on commit bf175c6

Please sign in to comment.