Class DomainExpertInterface

Inheritance Relationships

Derived Types

Class Documentation

class DomainExpertInterface

Interface for both DomainExpert and DomainExpertClient classes.

This interface defines the methods for querying and manipulating a PDDL domain, including types, constants, predicates, functions, actions, and durative actions.

Subclassed by plansys2::DomainExpert, plansys2::DomainExpertClient

Public Functions

inline DomainExpertInterface()

Default constructor.

virtual std::string getName() = 0

Get the domain name.

Returns:

std::string The name of the domain.

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

Get the types defined in the domain.

Returns:

std::vector<std::string> The names of the types defined in the domain.

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

Get the constants defined for a given type.

Parameters:

type[in] The name of the type.

Returns:

std::vector<std::string> List of constant names for the specified type.

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

Get the predicates defined in the domain.

Returns:

std::vector<plansys2::Predicate> Vector containing the predicates.

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

Get the details of a predicate defined in the domain.

Parameters:

predicate[in] The name of the predicate.

Returns:

std::optional<plansys2::Predicate> Predicate object containing the predicate name and its parameters (name and type). If the predicate does not exist, the returned value is empty.

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

Get the functions defined in the domain.

Returns:

std::vector<plansys2::Function> Vector containing the functions.

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

Get the details of a function defined in the domain.

Parameters:

function[in] The name of the function.

Returns:

std::optional<plansys2::Function> The function name and its parameters (name and type). If the function does not exist, the returned value is empty.

virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicates() = 0

Get the derived predicates defined in the domain.

Returns:

std::vector<plansys2::Predicate> Vector containing the derived predicates defined in the domain.

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

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

Parameters:
  • predicate[in] The name of the derived predicate.

  • params[in] Optional parameters for the predicate.

Returns:

std::vector<plansys2_msgs::msg::Derived> Vector containing the details of the derived predicate, including its name, parameters (name and type) and preconditions. If the derived predicate does not exist, the returned value is empty.

virtual std::vector<std::string> getActions() = 0

Get the regular actions defined in the domain.

Returns:

std::vector<std::string> Vector containing the names of the actions.

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

Get the details of a regular action defined in the domain.

Parameters:
  • action[in] The name of the action.

  • params[in] Optional parameters for the action.

Returns:

plansys2_msgs::msg::Action object containing the action name, parameters, requirements, and effects. If the action does not exist, the returned value is nullptr.

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

Get the durative actions defined in the domain.

Returns:

std::vector<std::string> Vector containing the names of the durative actions.

virtual plansys2_msgs::msg::DurativeAction::SharedPtr getDurativeAction(const std::string &durative_action, const std::vector<std::string> &params) = 0

Get the details of a durative action defined in the domain.

Parameters:
  • action[in] The name of the durative action.

  • params[in] Optional parameters for the action.

Returns:

plansys2_msgs::msg::DurativeAction object containing the action name, parameters, requirements, and effects. If the action does not exist, the returned value is nullptr.

virtual std::string getDomain() = 0

Get the current domain definition as a string, which can be used to save to a file or initialize another domain.

Returns:

std::string The current domain definition in PDDL format.