mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
refactor addCost->computeCost
This commit is contained in:
parent
d2bd0a0037
commit
1f8feaaf0a
@ -158,7 +158,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return true if solution remains feasible (is no failure)
|
* @return true if solution remains feasible (is no failure)
|
||||||
*/
|
*/
|
||||||
bool addCost(SolutionBase& solution);
|
bool computeCost(SolutionBase& solution);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// associated/owning Stage instance
|
// associated/owning Stage instance
|
||||||
|
|||||||
@ -156,7 +156,7 @@ void StagePrivate::sendForward(const InterfaceState& from, InterfaceState&& to,
|
|||||||
solution->setStartState(from);
|
solution->setStartState(from);
|
||||||
solution->setEndState(*to_it);
|
solution->setEndState(*to_it);
|
||||||
|
|
||||||
if (!solution->isFailure() && addCost(*solution)) {
|
if (!solution->isFailure() && computeCost(*solution)) {
|
||||||
nextStarts()->add(*to_it);
|
nextStarts()->add(*to_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ void StagePrivate::sendBackward(InterfaceState&& from, const InterfaceState& to,
|
|||||||
solution->setStartState(*from_it);
|
solution->setStartState(*from_it);
|
||||||
solution->setEndState(to);
|
solution->setEndState(to);
|
||||||
|
|
||||||
if (!solution->isFailure() && addCost(*solution))
|
if (!solution->isFailure() && computeCost(*solution))
|
||||||
prevEnds()->add(*from_it);
|
prevEnds()->add(*from_it);
|
||||||
|
|
||||||
newSolution(solution);
|
newSolution(solution);
|
||||||
@ -191,7 +191,7 @@ void StagePrivate::spawn(InterfaceState&& state, const SolutionBasePtr& solution
|
|||||||
solution->setStartState(*from);
|
solution->setStartState(*from);
|
||||||
solution->setEndState(*to);
|
solution->setEndState(*to);
|
||||||
|
|
||||||
if (!solution->isFailure() && addCost(*solution)) {
|
if (!solution->isFailure() && computeCost(*solution)) {
|
||||||
prevEnds()->add(*from);
|
prevEnds()->add(*from);
|
||||||
nextStarts()->add(*to);
|
nextStarts()->add(*to);
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void StagePrivate::connect(const InterfaceState& from, const InterfaceState& to,
|
|||||||
solution->setEndState(to);
|
solution->setEndState(to);
|
||||||
|
|
||||||
if (!solution->isFailure())
|
if (!solution->isFailure())
|
||||||
addCost(*solution);
|
computeCost(*solution);
|
||||||
|
|
||||||
newSolution(solution);
|
newSolution(solution);
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ void StagePrivate::newSolution(const SolutionBasePtr& solution) {
|
|||||||
parent()->onNewSolution(*solution);
|
parent()->onNewSolution(*solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StagePrivate::addCost(SolutionBase& solution) {
|
bool StagePrivate::computeCost(SolutionBase& solution) {
|
||||||
double cost{ 0.0 };
|
double cost{ 0.0 };
|
||||||
|
|
||||||
auto* trajectory{ dynamic_cast<const SubTrajectory*>(&solution) };
|
auto* trajectory{ dynamic_cast<const SubTrajectory*>(&solution) };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user