41 #include <moveit/task_constructor/storage.h>
42 #include <moveit/task_constructor/utils.h>
43 #include <moveit_msgs/RobotState.h>
46 namespace task_constructor {
54 MOVEIT_CLASS_FORWARD(CostTerm);
62 virtual double operator()(
const SubTrajectory& s, std::string& comment)
const;
63 virtual double operator()(
const SolutionSequence& s, std::string& comment)
const;
64 virtual double operator()(
const WrappedSolution& s, std::string& comment)
const;
73 enum class Mode : uint8_t
81 double operator()(
const SolutionSequence& s, std::string& comment)
const override;
82 double operator()(
const WrappedSolution& s, std::string& comment)
const override;
88 using SubTrajectorySignature = std::function<double(
const SubTrajectory&, std::string&)>;
89 using SubTrajectoryShortSignature = std::function<double(
const SubTrajectory&)>;
92 template <typename Term, typename Signature = decltype(signatureMatcher(std::declval<Term>()))>
98 using TrajectoryCostTerm::operator();
99 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
102 SubTrajectorySignature term_;
105 template <
typename T>
106 static auto signatureMatcher(
const T& t) -> decltype(t(
SubTrajectory{}), SubTrajectoryShortSignature{});
107 template <
typename T>
108 static auto signatureMatcher(
const T& t) -> decltype(t(
SubTrajectory{}, std::string{}), SubTrajectorySignature{});
119 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
120 double operator()(
const SolutionSequence& s, std::string& comment)
const override;
121 double operator()(
const WrappedSolution& s, std::string& comment)
const override;
135 PathLength(std::map<std::string, double> j) : joints(std::move(j)) {}
137 using TrajectoryCostTerm::operator();
138 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
140 std::map<std::string, double> joints;
148 std::map<std::string, double> w = std::map<std::string, double>());
150 std::map<std::string, double> w = std::map<std::string, double>());
152 using TrajectoryCostTerm::operator();
153 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
155 moveit_msgs::RobotState reference;
156 std::map<std::string, double> weights;
164 using TrajectoryCostTerm::operator();
165 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
174 std::string link_name;
176 using TrajectoryCostTerm::operator();
177 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
191 Clearance(
bool with_world =
true,
bool cumulative =
false, std::string group_property =
"group",
192 Mode mode = Mode::AUTO);
195 std::string group_property;
199 std::function<double(
double)> distance_to_cost;
201 using TrajectoryCostTerm::operator();
202 double operator()(
const SubTrajectory& s, std::string& comment)
const override;
Definition: cost_terms.h:56
Definition: cost_terms.h:86
Definition: storage.h:380
SubTrajectory connects interface states of ComputeStages.
Definition: storage.h:348
Definition: cost_terms.h:71
Definition: storage.h:414
Definition: cost_terms.h:189
add a constant cost to each solution
Definition: cost_terms.h:115
(weighted) joint-space distance to reference pose
Definition: cost_terms.h:145
Definition: cost_terms.h:170
trajectory length with optional weighting for different joints
Definition: cost_terms.h:128
PathLength()=default
By default, all joints are considered with same weight of 1.0.
PathLength(std::map< std::string, double > j)
Limit measurements to given joints and use given weighting.
Definition: cost_terms.h:135
execution duration of the whole trajectory
Definition: cost_terms.h:162