Class ProblemExpertNode

Inheritance Relationships

Base Type

  • public rclcpp_lifecycle::LifecycleNode

Class Documentation

class ProblemExpertNode : public rclcpp_lifecycle::LifecycleNode

ROS 2 Lifecycle node that manages the PDDL problem representation and operations.

This node provides services to add, remove, and query PDDL problem elements such as instances, predicates, functions, and goals. It also publishes the problem state and change notifications.

Public Types

using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn

Public Functions

explicit ProblemExpertNode(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())

Constructor for the ProblemExpertNode.

Initializes the node, declares parameters, and creates service servers and publishers.

CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)

Configures the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if configuration is successful, FAILURE otherwise.

CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)

Activates the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if activation is successful, FAILURE otherwise.

CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)

Deactivates the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if deactivation is successful, FAILURE otherwise.

CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)

Cleans up the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if cleanup is successful, FAILURE otherwise.

CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)

Shuts down the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if shutdown is successful, FAILURE otherwise.

CallbackReturnT on_error(const rclcpp_lifecycle::State &state)

Handles errors in the node.

Parameters:

state[in] The current lifecycle state.

Returns:

SUCCESS if error handling is successful, FAILURE otherwise.

plansys2_msgs::msg::Knowledge::SharedPtr get_knowledge_as_msg() const

Converts the current problem knowledge to a message.

Returns:

plansys2_msgs::msg::Knowledge::SharedPtr The knowledge message containing the current problem state, including instances, predicates, functions, and goal.

void add_problem_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AddProblem::Request> request, const std::shared_ptr<plansys2_msgs::srv::AddProblem::Response> response)

Service callback to add a PDDL problem.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the PDDL problem string.

  • response[out] Service response with success status and error information.

void add_problem_goal_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AddProblemGoal::Request> request, const std::shared_ptr<plansys2_msgs::srv::AddProblemGoal::Response> response)

Service callback to add a problem goal.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the goal as a Tree.

  • response[out] Service response with success status and error information.

void add_problem_instance_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectParam::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectParam::Response> response)

Service callback to add a problem instance.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the instance parameter.

  • response[out] Service response with success status and error information.

void add_problem_predicate_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Response> response)

Service callback to add a problem predicate.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the predicate node.

  • response[out] Service response with success status and error information.

void add_problem_function_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Response> response)

Service callback to add a problem function.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the function node.

  • response[out] Service response with success status and error information.

void get_problem_goal_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetProblemGoal::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetProblemGoal::Response> response)

Service callback to get the problem goal.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response containing the goal tree and success status.

void get_problem_instance_details_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetProblemInstanceDetails::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetProblemInstanceDetails::Response> response)

Service callback to get details about a specific problem instance.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the instance name.

  • response[out] Service response with instance details and success status.

void get_problem_instances_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetProblemInstances::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetProblemInstances::Response> response)

Service callback to get all problem instances.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response containing the list of instances and success status.

void get_problem_predicate_details_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetNodeDetails::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetNodeDetails::Response> response)

Service callback to get details about a specific problem predicate.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the predicate expression.

  • response[out] Service response with predicate details and success status.

void get_problem_predicates_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetStates::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetStates::Response> response)

Service callback to get all problem predicates.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response containing the list of predicates and success status.

void get_problem_function_details_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetNodeDetails::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetNodeDetails::Response> response)

Service callback to get details about a specific problem function.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the function expression.

  • response[out] Service response with function details and success status.

void get_problem_functions_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetStates::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetStates::Response> response)

Service callback to get all problem functions.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response containing the list of states.

void get_problem_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::GetProblem::Request> request, const std::shared_ptr<plansys2_msgs::srv::GetProblem::Response> response)

Service callback to get the full PDDL problem.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response containing the problem.

void is_problem_goal_satisfied_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::IsProblemGoalSatisfied::Request> request, const std::shared_ptr<plansys2_msgs::srv::IsProblemGoalSatisfied::Response> response)

Service callback to check if a problem goal is satisfied.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the goal tree to check.

  • response[out] Service response with satisfaction status.

void remove_problem_goal_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::RemoveProblemGoal::Request> request, const std::shared_ptr<plansys2_msgs::srv::RemoveProblemGoal::Response> response)

Service callback to remove the problem goal.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response with success status and error information.

void clear_problem_knowledge_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::ClearProblemKnowledge::Request> request, const std::shared_ptr<plansys2_msgs::srv::ClearProblemKnowledge::Response> response)

Service callback to clear all problem knowledge.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Empty service request.

  • response[out] Service response with success status and error information.

void remove_problem_instance_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectParam::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectParam::Response> response)

Service callback to remove a problem instance.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the instance parameter to remove.

  • response[out] Service response with success status and error information.

void remove_problem_predicate_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Response> response)

Service callback to remove a problem predicate.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the predicate node to remove.

  • response[out] Service response with success status and error information.

void remove_problem_function_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Response> response)

Service callback to remove a problem function.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the function node to remove.

  • response[out] Service response with success status and error information.

void exist_problem_predicate_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::ExistNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::ExistNode::Response> response)

Service callback to check if a predicate exists in the problem.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the predicate node to check.

  • response[out] Service response with existence status.

void exist_problem_function_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::ExistNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::ExistNode::Response> response)

Service callback to check if a function exists in the problem.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the function node to check.

  • response[out] Service response with existence status.

void update_problem_function_service_callback(const std::shared_ptr<rmw_request_id_t> request_header, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Request> request, const std::shared_ptr<plansys2_msgs::srv::AffectNode::Response> response)

Service callback to update a problem function’s value.

Parameters:
  • request_header[in] ROS service request header.

  • request[in] Service request containing the function node with updated value.

  • response[out] Service response with success status and error information.