mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
This pattern allows cost::Constant to override the hierarchical cost computation for the SerialContainer and avoid traversing the graph. I implemented the CostTerm::supports() pattern over a full double visitor pattern with overloads for each SolutionBase specialization, because the SerialContainer needs to know whether cost aggregation of the subsolutions should take place or whether the SolutionSequence should be forwarded to the CostTerm. This would not be possible with a `virtual double operator()(const SolutionSequence&)` callback in CostTerm. Alternatively, implementing the hierarchical aggregation in the default implementation of this operator would be possible as well, but breaks intuition: - the corresponding methods to handle `SubTrajectory` and `WrappedSolution` *have to* default to not touching the solution's cost at all so it is inappropriate to have the default implementation for the Sequence do something else - The SerialContainer also aggregates costs outside the `computeCost()` interface (in multiple places in `onNewSolution()` to aggregate costs along partial paths) and thus moving the hierarchical aggregation to the CostTerm methods requires the aggregator to be shared between the Container and the CostTerm, The only shortcoming of the implemented approach, by contrast, is that user implementations that want to handle WrappedSolution or SolutionSequence differently have to ensure the supports_ flags are set correctly. Notice that most custom CostTerms will only ever access SubTrajectories and this case is simplified with the provided CostTerm constructors. |
||
|---|---|---|
| .. | ||
| include/moveit/task_constructor | ||
| src | ||
| test | ||
| CMakeLists.txt | ||
| motion_planning_stages_plugin_description.xml | ||
| package.xml | ||