mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
setCreator() once in StagePrivate::newSolution()
This commit is contained in:
parent
9ceecd235f
commit
8811045f89
@ -346,10 +346,8 @@ public:
|
|||||||
void reset() override;
|
void reset() override;
|
||||||
|
|
||||||
virtual bool compute(const InterfaceState& from, const InterfaceState& to) = 0;
|
virtual bool compute(const InterfaceState& from, const InterfaceState& to) = 0;
|
||||||
void connect(const InterfaceState& from, const InterfaceState& to,
|
void connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& trajectory);
|
||||||
SubTrajectory&& trajectory);
|
void connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& trajectory, double cost) {
|
||||||
void connect(const InterfaceState& from, const InterfaceState& to,
|
|
||||||
SubTrajectory&& trajectory, double cost) {
|
|
||||||
trajectory.setCost(cost);
|
trajectory.setCost(cost);
|
||||||
connect(from, to, std::move(trajectory));
|
connect(from, to, std::move(trajectory));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public:
|
|||||||
inline void setIntrospection(Introspection* introspection) { introspection_ = introspection; }
|
inline void setIntrospection(Introspection* introspection) { introspection_ = introspection; }
|
||||||
void composePropertyErrorMsg(const std::string& name, std::ostream& os);
|
void composePropertyErrorMsg(const std::string& name, std::ostream& os);
|
||||||
|
|
||||||
void newSolution(const SolutionBase ¤t);
|
void newSolution(SolutionBase& current);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Stage* const me_; // associated/owning Stage instance
|
Stage* const me_; // associated/owning Stage instance
|
||||||
|
|||||||
@ -856,7 +856,6 @@ void ParallelContainerBase::spawn(InterfaceState &&state, SubTrajectory&& t)
|
|||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
assert(impl->prevEnds() && impl->nextStarts());
|
assert(impl->prevEnds() && impl->nextStarts());
|
||||||
|
|
||||||
t.setCreator(impl);
|
|
||||||
// store newly created solution (otherwise it's lost)
|
// store newly created solution (otherwise it's lost)
|
||||||
auto it = impl->created_solutions_.insert(impl->created_solutions_.end(), std::move(t));
|
auto it = impl->created_solutions_.insert(impl->created_solutions_.end(), std::move(t));
|
||||||
|
|
||||||
|
|||||||
@ -83,8 +83,10 @@ InterfaceFlags StagePrivate::interfaceFlags() const
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StagePrivate::newSolution(const SolutionBase &solution)
|
void StagePrivate::newSolution(SolutionBase &solution)
|
||||||
{
|
{
|
||||||
|
solution.setCreator(this);
|
||||||
|
|
||||||
if (introspection_)
|
if (introspection_)
|
||||||
introspection_->registerSolution(solution);
|
introspection_->registerSolution(solution);
|
||||||
|
|
||||||
@ -249,7 +251,6 @@ std::ostream& operator<<(std::ostream& os, const StagePrivate& impl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SubTrajectory& ComputeBasePrivate::addTrajectory(SubTrajectory&& trajectory) {
|
SubTrajectory& ComputeBasePrivate::addTrajectory(SubTrajectory&& trajectory) {
|
||||||
trajectory.setCreator(this);
|
|
||||||
if (!trajectory.isFailure()) {
|
if (!trajectory.isFailure()) {
|
||||||
return *solutions_.insert(std::move(trajectory));
|
return *solutions_.insert(std::move(trajectory));
|
||||||
} else if (me()->storeFailures()) {
|
} else if (me()->storeFailures()) {
|
||||||
@ -653,8 +654,7 @@ void Connecting::reset()
|
|||||||
ComputeBase::reset();
|
ComputeBase::reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connecting::connect(const InterfaceState& from, const InterfaceState& to,
|
void Connecting::connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& t) {
|
||||||
SubTrajectory&& t) {
|
|
||||||
auto impl = pimpl();
|
auto impl = pimpl();
|
||||||
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
||||||
trajectory.setStartState(from);
|
trajectory.setStartState(from);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user