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;
|
||||
|
||||
virtual bool compute(const InterfaceState& from, const InterfaceState& to) = 0;
|
||||
void connect(const InterfaceState& from, const InterfaceState& to,
|
||||
SubTrajectory&& trajectory);
|
||||
void connect(const InterfaceState& from, const InterfaceState& to,
|
||||
SubTrajectory&& trajectory, double cost) {
|
||||
void connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& trajectory);
|
||||
void connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& trajectory, double cost) {
|
||||
trajectory.setCost(cost);
|
||||
connect(from, to, std::move(trajectory));
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
inline void setIntrospection(Introspection* introspection) { introspection_ = introspection; }
|
||||
void composePropertyErrorMsg(const std::string& name, std::ostream& os);
|
||||
|
||||
void newSolution(const SolutionBase ¤t);
|
||||
void newSolution(SolutionBase& current);
|
||||
|
||||
protected:
|
||||
Stage* const me_; // associated/owning Stage instance
|
||||
|
||||
@ -856,7 +856,6 @@ void ParallelContainerBase::spawn(InterfaceState &&state, SubTrajectory&& t)
|
||||
auto impl = pimpl();
|
||||
assert(impl->prevEnds() && impl->nextStarts());
|
||||
|
||||
t.setCreator(impl);
|
||||
// store newly created solution (otherwise it's lost)
|
||||
auto it = impl->created_solutions_.insert(impl->created_solutions_.end(), std::move(t));
|
||||
|
||||
|
||||
@ -83,8 +83,10 @@ InterfaceFlags StagePrivate::interfaceFlags() const
|
||||
return f;
|
||||
}
|
||||
|
||||
void StagePrivate::newSolution(const SolutionBase &solution)
|
||||
void StagePrivate::newSolution(SolutionBase &solution)
|
||||
{
|
||||
solution.setCreator(this);
|
||||
|
||||
if (introspection_)
|
||||
introspection_->registerSolution(solution);
|
||||
|
||||
@ -249,7 +251,6 @@ std::ostream& operator<<(std::ostream& os, const StagePrivate& impl) {
|
||||
}
|
||||
|
||||
SubTrajectory& ComputeBasePrivate::addTrajectory(SubTrajectory&& trajectory) {
|
||||
trajectory.setCreator(this);
|
||||
if (!trajectory.isFailure()) {
|
||||
return *solutions_.insert(std::move(trajectory));
|
||||
} else if (me()->storeFailures()) {
|
||||
@ -653,8 +654,7 @@ void Connecting::reset()
|
||||
ComputeBase::reset();
|
||||
}
|
||||
|
||||
void Connecting::connect(const InterfaceState& from, const InterfaceState& to,
|
||||
SubTrajectory&& t) {
|
||||
void Connecting::connect(const InterfaceState& from, const InterfaceState& to, SubTrajectory&& t) {
|
||||
auto impl = pimpl();
|
||||
SubTrajectory& trajectory = impl->addTrajectory(std::move(t));
|
||||
trajectory.setStartState(from);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user