Skip to content

Commit

Permalink
Merge pull request #340 from fmrico/fix_plan_services
Browse files Browse the repository at this point in the history
Fix get plan services
  • Loading branch information
fmrico authored Dec 22, 2024
2 parents c7276d5 + 9982ad3 commit 038c861
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions plansys2_executor/src/plansys2_executor/ExecutorNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@ ExecutorNode::get_plan_service_callback(
const std::shared_ptr<plansys2_msgs::srv::GetPlan::Request> request,
const std::shared_ptr<plansys2_msgs::srv::GetPlan::Response> response)
{
response->plan = *complete_plan_;
if (complete_plan_ != nullptr) {
response->success = true;
response->plan = *complete_plan_;
} else {
response->success = false;
}
}

void
Expand All @@ -327,7 +332,12 @@ ExecutorNode::get_remaining_plan_service_callback(
const std::shared_ptr<plansys2_msgs::srv::GetPlan::Request> request,
const std::shared_ptr<plansys2_msgs::srv::GetPlan::Response> response)
{
response->plan = *remaining_plan_;
if (remaining_plan_ != nullptr) {
response->success = true;
response->plan = *remaining_plan_;
} else {
response->success = false;
}
}

rclcpp_action::GoalResponse
Expand Down Expand Up @@ -678,6 +688,9 @@ ExecutorNode::execute_plan()

executor_state_ = IDLE_STATE;
runtime_info = PlanRuntineInfo();
complete_plan_ = nullptr;
remaining_plan_ = nullptr;
ordered_sub_goals_ = nullptr;
}

void
Expand Down

0 comments on commit 038c861

Please sign in to comment.