Class DomainExpert

Inheritance Relationships

Base Type

Class Documentation

class DomainExpert : public plansys2::DomainExpertInterface

DomainExpert is in charge of managing the internal structure of a domain.

Public Functions

explicit DomainExpert(const std::string &domain)

Create a new DomainExpert with the content of a domain.

Parameters:

node_name[in] The content of a PDDL domain.

void extendDomain(const std::string &domain)

Extend the content of aDomainExpert with the content of another domain.

Parameters:

node_name[in] The content of a PDDL domain.

virtual std::string getName()

Get the domain name.

Returns:

A string containing the domain name.

virtual std::vector<std::string> getTypes()

Get the types existing in the domain.

Returns:

The vector containing the names of the types.

virtual std::vector<std::string> getConstants(const std::string &type)

Get the details of a constants existing for a type.

Parameters:

predicate[in] The name of the type.

Returns:

A list of constants names for the passed type

virtual std::vector<plansys2::Predicate> getPredicates()

Get the predicates existing in the domain.

Returns:

The vector containing the name of the predicates.

virtual std::optional<plansys2::Predicate> getPredicate(const std::string &predicate)

Get the details of a predicate existing in the domain.

Parameters:

predicate[in] The name of the predicate.

Returns:

A Predicate object containing the predicate name and its parameters (name and type). If the predicate does not exist, the value returned has not value.

virtual std::vector<plansys2::Function> getFunctions()

Get the functions existing in the domain.

Returns:

The vector containing the name of the functions.

virtual std::optional<plansys2::Function> getFunction(const std::string &function)

Get the details of a function existing in the domain.

Parameters:

function[in] The name of the function.

Returns:

A Function object containing the function name and its parameters (name and type). If the function does not exist, the value returned has not value.

virtual std::vector<plansys2::Predicate> getDerivedPredicates()

Get the derived predicates existing in the domain.

Returns:

The vector containing the derived predicates.

virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(const std::string &predicate, const std::vector<std::string> &params = {})

Get the details of a derived predicate existing in the domain.

Parameters:

predicate[in] The name of the predicate.

Returns:

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<std::string> getActions()

Get the regular actions existing in the domain.

Returns:

The vector containing the names of the actions.

virtual plansys2_msgs::msg::Action::SharedPtr getAction(const std::string &action, const std::vector<std::string> &params = {})

Get the details of an regular action existing in the domain.

Parameters:

action[in] The name of the action.

Returns:

An Action object containing the action name, parameters, requirements and effects. If the action does not exist, the value returned has not value.

virtual std::vector<std::string> getDurativeActions()

Get the temporal actions existing in the domain.

Returns:

The vector containing the names of the actions.

virtual plansys2_msgs::msg::DurativeAction::SharedPtr getDurativeAction(const std::string &action, const std::vector<std::string> &params = {})

Get the details of an durative action existing in the domain.

Parameters:

action[in] The name of the action.

Returns:

A Durative Action object containing the action name, parameters, requirements and effects. If the action does not exist, the value returned has not value.

virtual std::string getDomain()

Get the current domain, ready to be saved to file, or to initialize another domain.

Returns:

A string containing the domain.

bool existDomain(const std::string &domain_name)

Determine if a particular domain exists.

Parameters:

domain[in] The name of the domain.

Returns:

true if the domain exists.