plansys2_support_py.ProblemExpertClient module

PlanSys2 Problem Expert Client.

This module provides specific classes for interacting with PlanSys2 Problem Expert services.

class plansys2_support_py.ProblemExpertClient.ProblemExpertClient(*args: Any, **kwargs: Any)

Bases: Node

Problem Expert client for PlanSys2.

This class provides convenient methods to interact with all Problem Expert services in PlanSys2, wrapping the ROS2 service calls with proper error handling.

add_problem(problem: str) bool

Add a PDDL problem.

Parameters

problemstr

The PDDL problem string.

Returns

bool: True if successful, False otherwise.

add_problem_function(function: plansys2_msgs.msg.Node) bool

Add a function to the problem.

Parameters

functionPlanSys2Node

The function to add.

Returns

bool: True if successful, False otherwise.

add_problem_goal(goal: plansys2_msgs.msg.Tree) bool

Add a goal to the problem.

Parameters

goalTree

The goal to add.

Returns

bool: True if successful, False otherwise.

add_problem_instance(instance: plansys2_msgs.msg.Param) bool

Add an instance to the problem.

Parameters

instanceParam

The instance to add.

Returns

bool: True if successful, False otherwise.

add_problem_predicate(predicate: plansys2_msgs.msg.Node) bool

Add a predicate to the problem.

Parameters

predicatePlanSys2Node

The predicate to add.

Returns

bool: True if successful, False otherwise.

clear_problem_knowledge() bool

Clear the instances, predicates, and functions.

Returns

bool: True if successful, False otherwise.

exist_problem_function(function: plansys2_msgs.msg.Node) bool | None

Check if a function exists.

Parameters

functionPlanSys2Node

The function to check.

Returns

Optional[bool]: True if satisfied, False if not, None if failed.

exist_problem_predicate(predicate: plansys2_msgs.msg.Node) bool | None

Check if a predicate exists.

Parameters

predicatePlanSys2Node

The predicate to check.

Returns

Optional[bool]: True if satisfied, False if not, None if failed.

get_problem() str | None

Get the PDDL problem as a string.

Returns

Optional[str]: The PDDL problem string or None if failed.

get_problem_function(function: str) plansys2_msgs.msg.Node | None

Get the details of a function.

Parameters

functionstr

The name of the function to retrieve.

Returns

Optional[PlanSys2Node]: List of function names or None if failed.

get_problem_functions() List[plansys2_msgs.msg.Node] | None

Get the functions in the problem.

Returns

Optional[List[PlanSys2Node]]: List of function names or None if failed.

get_problem_goal() str | None

Get the goals in the problem as a PDDL string.

Returns

Optional[str]: The goals string or None if failed.

get_problem_instance(instance: str) plansys2_msgs.msg.Param | None

Get the details of an instance.

Parameters

instancestr

The name of the instance to retrieve.

Returns

Optional[Param]: Details of the instance or None if failed.

get_problem_instances() List[plansys2_msgs.msg.Param] | None

Get the instances in the problem.

Returns

Optional[List[Param]]: List of instance or None if failed.

get_problem_predicate(predicate: str) plansys2_msgs.msg.Node | None

Get the details of a predicate.

Parameters

predicatestr

The name of the predicate to retrieve.

Returns

Optional[PlanSys2Node]: List of predicate names or None if failed.

get_problem_predicates() List[plansys2_msgs.msg.Node] | None

Get the predicates in the problem.

Returns

Optional[List[PlanSys2Node]]: List of predicate names or None if failed.

is_problem_goal_satisfied(goal: plansys2_msgs.msg.Tree) bool | None

Check if the current problem goal is satisfied.

Returns

Optional[bool]: True if satisfied, False if not, None if failed.

print_problem_info() None

Print comprehensive information about the current problem.

Calls all available public methods to provide an overview of the problem state.

remove_problem_function(function: plansys2_msgs.msg.Node) bool

Remove a function from the problem.

Parameters

functionPlanSys2Node

The function to remove.

Returns

bool: True if successful, False otherwise.

remove_problem_goal() bool

Remove the current goal from the problem.

Returns

bool: True if successful, False otherwise.

remove_problem_instance(instance: plansys2_msgs.msg.Param) bool

Remove an instance from the problem.

Parameters

instanceParam

The instance to remove.

Returns

bool: True if successful, False otherwise.

remove_problem_predicate(predicate: plansys2_msgs.msg.Node) bool

Remove a predicate from the problem.

Parameters

predicatePlanSys2Node

The predicate to remove.

Returns

bool: True if successful, False otherwise.

update_problem_function(function: plansys2_msgs.msg.Node) bool | None

Update a function value.

Parameters

functionPlanSys2Node

The function to update.

Returns

Optional[bool]: True if satisfied, False if not, None if failed.