From cf0e4e3b017daafd8a3c8a944438b5e43566f12e Mon Sep 17 00:00:00 2001 From: v4hn Date: Tue, 30 Jun 2020 11:10:33 +0200 Subject: [PATCH] establish struct cost pattern for costs with multiple parameters, this option-style is more useful than verbose getter/setter. There is nothing to hide here. --- core/include/moveit/task_constructor/cost_terms.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/include/moveit/task_constructor/cost_terms.h b/core/include/moveit/task_constructor/cost_terms.h index 91c0ab8f..2c2d7af4 100644 --- a/core/include/moveit/task_constructor/cost_terms.h +++ b/core/include/moveit/task_constructor/cost_terms.h @@ -8,15 +8,14 @@ namespace cost { /// These structures all implement the Stage::CostTerm API and can be configured via Stage::setCostTerm() /// add a constant cost to each solution -class ConstantCost +struct ConstantCost { public: - ConstantCost(double cost) : cost_(cost) {} + ConstantCost(double c) : cost(c) {} - double operator()(const SubTrajectory&) { return cost_; } + double operator()(const SubTrajectory&, std::string& /* unused */) const { return cost; } -private: - double cost_; + double cost; }; /// execution duration of the whole trajectory