Skip to content
Draft
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
22 changes: 9 additions & 13 deletions core/src/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,24 +534,24 @@ void SerialContainer::onNewSolution(const SolutionBase& current) {
SolutionCollector<Interface::BACKWARD> incoming(num_before, current);
SolutionCollector<Interface::FORWARD> outgoing(num_after, current);

// collect (and sort) all solutions spanning from start to end of this container
ordered<SolutionSequencePtr> sorted;
// collect (and lift) all solutions spanning from start to end of this container
for (auto& in : incoming.solutions) {
for (auto& out : outgoing.solutions) {
InterfaceState::Priority prio = in.second + InterfaceState::Priority(1u, current.cost()) + out.second;
assert(prio.enabled());
// found a complete solution path connecting start to end?
if (prio.depth() == children.size()) {
SolutionSequence::container_type solution;
solution.reserve(children.size());
SolutionSequence::container_type seq;
seq.reserve(children.size());
// insert incoming solutions in reverse order
solution.insert(solution.end(), in.first.rbegin(), in.first.rend());
seq.insert(seq.end(), in.first.rbegin(), in.first.rend());
// insert current solution
solution.push_back(&current);
seq.push_back(&current);
// insert outgoing solutions in normal order
solution.insert(solution.end(), out.first.begin(), out.first.end());
// store solution in sorted list
sorted.insert(std::make_shared<SolutionSequence>(std::move(solution), prio.cost(), this));
seq.insert(seq.end(), out.first.begin(), out.first.end());
// create SolutionSequence and lift it to external interface
auto solution = std::make_shared<SolutionSequence>(std::move(seq), prio.cost(), this);
impl->liftSolution(solution, solution->internalStart(), solution->internalEnd());
}
if (prio.depth() > 1) {
// update state priorities along the whole partial solution path
Expand All @@ -561,10 +561,6 @@ void SerialContainer::onNewSolution(const SolutionBase& current) {
}
}
// printChildrenInterfaces(*this->pimpl(), true, *current.creator());

// finally, store + announce new solutions to external interface
for (const auto& solution : sorted)
impl->liftSolution(solution, solution->internalStart(), solution->internalEnd());
}

SerialContainer::SerialContainer(SerialContainerPrivate* impl) : ContainerBase(impl) {}
Expand Down
7 changes: 7 additions & 0 deletions demo/include/moveit_task_constructor_demo/pick_place_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class PickPlaceTask

private:
void loadParameters();
std::unique_ptr<SerialContainer> container(moveit::task_constructor::Task& t,
const solvers::PlannerInterfacePtr& sampling_planner,
const solvers::PlannerInterfacePtr& cartesian_planner,
const geometry_msgs::PoseStamped& place_pose);

static constexpr char LOGNAME[]{ "pick_place_task" };

Expand Down Expand Up @@ -117,5 +121,8 @@ class PickPlaceTask
// Place metrics
geometry_msgs::Pose place_pose_;
double place_surface_offset_;

std::mutex stats_mutex_;
std::vector<std::chrono::steady_clock::time_point> callback_times_;
};
} // namespace moveit_task_constructor_demo
Loading