From e53d943b758547714cae3ceb36ccb1d8df29a832 Mon Sep 17 00:00:00 2001 From: v4hn Date: Tue, 18 Aug 2020 17:23:08 +0200 Subject: [PATCH] remove CostTransform If required, this can hopefully be implemented through Wrapper stages soon. --- core/include/moveit/task_constructor/stage.h | 11 ----------- core/include/moveit/task_constructor/stage_p.h | 1 - core/src/stage.cpp | 8 +------- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/core/include/moveit/task_constructor/stage.h b/core/include/moveit/task_constructor/stage.h index 857f2012..9c0d7461 100644 --- a/core/include/moveit/task_constructor/stage.h +++ b/core/include/moveit/task_constructor/stage.h @@ -215,9 +215,6 @@ public: using CostTerm = std::function; using CostTermShort = std::function; - - using CostTransform = std::function; - /* \brief set method to determine costs for solutions of this stage * * This interface supports only primitive solutions, no containers. @@ -231,14 +228,6 @@ public: void setCostTerm(const CostTerm& term); void setCostTerm(const CostTermShort& term); - /* \brief set CostTransform to be applied to costs of this stage's solution costs - * - * This interface can be used to modify the cost associated with each solution of this stage/container. - * The most common case would be linear weighting `[](double cost){ return constant*cost; }` - * but any non-linear transform is obviously possible as well. - */ - void setCostTransform(const CostTransform& transform); - const ordered& solutions() const; const std::list& failures() const; size_t numFailures() const; diff --git a/core/include/moveit/task_constructor/stage_p.h b/core/include/moveit/task_constructor/stage_p.h index 208639d0..221034e9 100644 --- a/core/include/moveit/task_constructor/stage_p.h +++ b/core/include/moveit/task_constructor/stage_p.h @@ -173,7 +173,6 @@ protected: // user-configurable cost estimator Stage::CostTerm cost_term_; - Stage::CostTransform cost_transform_; // The total compute time std::chrono::duration total_compute_time_; diff --git a/core/src/stage.cpp b/core/src/stage.cpp index 89e0241b..4b5247bc 100644 --- a/core/src/stage.cpp +++ b/core/src/stage.cpp @@ -99,7 +99,6 @@ std::ostream& operator<<(std::ostream& os, const InitStageException& e) { StagePrivate::StagePrivate(Stage* me, const std::string& name) : me_(me) , name_(name) - , cost_transform_([](auto x) { return x; }) , total_compute_time_{} , parent_(nullptr) , introspection_(nullptr) {} @@ -282,8 +281,7 @@ bool StagePrivate::computeCost(SolutionBase& solution) { cost = solution.cost(); } - // all costs are transformed - solution.setCost(cost_transform_(cost)); + solution.setCost(cost); return !solution.isFailure(); } @@ -392,10 +390,6 @@ void Stage::setCostTerm(const CostTermShort& term) { setCostTerm([=](auto&& solution, auto&&) { return term(solution); }); } -void Stage::setCostTransform(const CostTransform& transform) { - pimpl()->cost_transform_ = transform; -} - const ordered& Stage::solutions() const { return pimpl()->solutions_; }