Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check action finished #217

Merged
merged 5 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions plansys2_executor/src/plansys2_executor/BTBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,6 @@ BTBuilder::get_graph(const plansys2_msgs::msg::Plan & current_plan)
}
}

remove_existing_requirements(requirements, predicates, functions);
for (const auto & req : requirements) {
std::cerr << "[ERROR] requirement not met: [" <<
parser::pddl::toString(req) << "]" << std::endl;
}
assert(requirements.empty());

// Look for contradicting parallel actions
// A1 and A2 cannot run in parallel if the effects of A1 contradict the requirements of A2
auto contradictions = get_node_contradict(graph, new_node);
Expand All @@ -414,12 +407,21 @@ BTBuilder::get_graph(const plansys2_msgs::msg::Plan & current_plan)
// Compute the state up to the new node
// The effects of the new node are not applied
std::list<GraphNode::Ptr> used_nodes;
auto predicates = problem_client_->getPredicates();
auto functions = problem_client_->getFunctions();
predicates = problem_client_->getPredicates();
functions = problem_client_->getFunctions();
get_state(new_node, used_nodes, predicates, functions);
new_node->predicates = predicates;
new_node->functions = functions;

// Check any requirements that do not have satisfying nodes.
// These should be satisfied by the initial state.
remove_existing_requirements(requirements, predicates, functions);
for (const auto & req : requirements) {
std::cerr << "[ERROR] requirement not met: [" <<
parser::pddl::toString(req) << "]" << std::endl;
}
assert(requirements.empty());

action_sequence.erase(action_sequence.begin());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ WaitAction::tick()
}

if ((*action_map_)[action].action_executor != nullptr &&
(*action_map_)[action].action_executor->is_finished())
(*action_map_)[action].action_executor->is_finished() &&
(*action_map_)[action].at_start_effects_applied &&
(*action_map_)[action].at_end_effects_applied)
{
return BT::NodeStatus::SUCCESS;
} else {
Expand Down