Class ExecutorClient
Defined in File ExecutorClient.hpp
Class Documentation
-
class ExecutorClient
Client interface for the plansys2 executor node.
This class provides a client interface to interact with the ExecutorNode, allowing applications to request plan execution, monitor progress, cancel plans, and retrieve execution information.
Public Types
-
using ExecutePlan = plansys2_msgs::action::ExecutePlan
-
using GoalHandleExecutePlan = rclcpp_action::ClientGoalHandle<ExecutePlan>
Public Functions
-
ExecutorClient()
Default constructor.
-
explicit ExecutorClient(const std::string &node_name)
Constructor with custom node name.
Creates a ROS node with the specified name and initializes service clients and action clients to communicate with the executor node.
- Parameters:
node_name – [in] Name for the ROS node.
-
bool start_plan_execution(const plansys2_msgs::msg::Plan &plan)
Start the execution of a plan.
- Parameters:
plan – [in] The plan to be executed.
- Returns:
true if the plan was successfully sent and accepted, false otherwise.
-
bool execute_and_check_plan()
Execute the current plan and check its status.
- Returns:
true if plan execution is still in progress, false if plan has finished (either successfully, cancelled, or failed).
-
void cancel_plan_execution()
Cancel the execution of the current plan.
-
std::vector<plansys2_msgs::msg::Tree> getOrderedSubGoals()
Get the ordered sub-goals of the current plan.
Retrieves the ordered sub-goals derived from the current plan being executed. These represent intermediate goals to be achieved during plan execution.
- Returns:
std::vector<plansys2_msgs::msg::Tree> Vector of tree structures representing the ordered sub-goals.
-
std::optional<plansys2_msgs::msg::Plan> get_plan()
Get the complete plan being executed.
- Returns:
std::optional<plansys2_msgs::msg::Plan> The complete plan if available, empty if no plan is currently being executed or if an error occurred.
-
std::optional<plansys2_msgs::msg::Plan> get_remaining_plan()
Get the remaining portion of the plan to be executed.
- Returns:
std::optional<plansys2_msgs::msg::Plan> The remaining plan if available, empty if no remaining plan is available or if an error occurred.
-
inline ExecutePlan::Feedback getFeedBack()
Get the current feedback from plan execution.
- Returns:
ExecutePlan::Feedback The current feedback message from the executor.
-
std::optional<ExecutePlan::Result> getResult()
Get the final result of plan execution.
- Returns:
std::optional<ExecutePlan::Result> The result of the plan execution if available, empty if no result is available or if an error occurred.
-
using ExecutePlan = plansys2_msgs::action::ExecutePlan