Class DomainExpertClient
Defined in File DomainExpertClient.hpp
Inheritance Relationships
Base Type
public plansys2::DomainExpertInterface(Class DomainExpertInterface)
Class Documentation
-
class DomainExpertClient : public plansys2::DomainExpertInterface
Client for requesting information or sending changes from/to the DomainExpertNode.
Any node can create a DomainExpertClient object to request changes to the DomainExpertNode, or to get information from it. It presents the same interface as DomainExpert and hides the complexity of using ROS2 services.
Public Functions
-
DomainExpertClient()
Construct a new DomainExpertClient object.
-
virtual std::string getName()
Get the name of the domain.
- Returns:
std::string The name of the domain.
-
virtual std::vector<std::string> getTypes()
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)
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()
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)
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()
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)
Get the details of a function defined in the domain.
- Parameters:
function – [in] The name of the function.
- Returns:
std::optional<plansys2::Function> Function object with parameters (name and type). If the function does not exist, the returned value is empty.
-
virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicates()
Get the derived predicates defined in the domain.
- Returns:
std::vector<plansys2::Predicate> Vector containing the derived predicates defined in the domain.
-
plansys2::DerivedResolutionGraph getDerivedResolutionGraph()
-
virtual std::vector<plansys2_msgs::msg::Derived> getDerivedPredicate(const std::string &predicate, const std::vector<std::string> ¶ms = {})
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()
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> ¶ms = {})
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()
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 &action, const std::vector<std::string> ¶ms = {})
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()
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.
-
std::string getDomain(bool use_cache)
Get the current domain definition as a string, which can be used to save to a file or initialize another domain.
- Parameters:
use_cache – [in] If true, use the cached domain if available.
- Returns:
std::string The current domain definition in PDDL format.
Public Members
-
std::string cached_domain_
-
DomainExpertClient()