diff --git a/core/include/moveit/task_constructor/container.h b/core/include/moveit/task_constructor/container.h index c171cac2..38de388c 100644 --- a/core/include/moveit/task_constructor/container.h +++ b/core/include/moveit/task_constructor/container.h @@ -68,7 +68,7 @@ public: virtual bool compute() = 0; /// called by a (direct) child when a new solution becomes available - virtual void onNewSolution(SolutionBase& t) = 0; + virtual void onNewSolution(const SolutionBase& s) = 0; protected: ContainerBase(ContainerBasePrivate* impl); @@ -96,7 +96,7 @@ public: protected: /// called by a (direct) child when a new solution becomes available - void onNewSolution(SolutionBase &s) override; + void onNewSolution(const SolutionBase &s) override; /// function type used for traversing solutions /// For each sub solution (current), the trace from the start as well as the @@ -142,7 +142,7 @@ protected: ParallelContainerBase(ParallelContainerBasePrivate* impl); /// called by a (direct) child when a new solution becomes available - void onNewSolution(SolutionBase &s) override; + void onNewSolution(const SolutionBase &s) override; /// callback for new start states (received externally) virtual void onNewStartState(const InterfaceState &external) = 0; diff --git a/core/include/moveit/task_constructor/container_p.h b/core/include/moveit/task_constructor/container_p.h index 6b564709..51c3bc80 100644 --- a/core/include/moveit/task_constructor/container_p.h +++ b/core/include/moveit/task_constructor/container_p.h @@ -158,7 +158,7 @@ PIMPL_FUNCTIONS(SerialContainer) * have separate incoming/outgoing trajectories */ class WrappedSolution : public SolutionBase { public: - explicit WrappedSolution(StagePrivate* creator, SolutionBase* wrapped) + explicit WrappedSolution(StagePrivate* creator, const SolutionBase* wrapped) : SolutionBase(creator, wrapped->cost()), wrapped_(wrapped) {} void fillMessage(moveit_task_constructor_msgs::Solution &solution, @@ -167,7 +167,7 @@ public: } private: - SolutionBase* wrapped_; + const SolutionBase* wrapped_; }; diff --git a/core/include/moveit/task_constructor/stage_p.h b/core/include/moveit/task_constructor/stage_p.h index c6a5c428..2a37a2a1 100644 --- a/core/include/moveit/task_constructor/stage_p.h +++ b/core/include/moveit/task_constructor/stage_p.h @@ -92,7 +92,7 @@ public: inline void setPrevEnds(const InterfacePtr& prev_ends) { prev_ends_ = prev_ends; } inline void setNextStarts(const InterfacePtr& next_starts) { next_starts_ = next_starts; } - void newSolution(SolutionBase ¤t); + void newSolution(const SolutionBase ¤t); protected: Stage* const me_; // associated/owning Stage instance diff --git a/core/include/moveit/task_constructor/task.h b/core/include/moveit/task_constructor/task.h index 72cd0963..b382e3ce 100644 --- a/core/include/moveit/task_constructor/task.h +++ b/core/include/moveit/task_constructor/task.h @@ -120,7 +120,7 @@ protected: void initScene(); bool canCompute() const override; bool compute() override; - void onNewSolution(SolutionBase &s) override; + void onNewSolution(const SolutionBase &s) override; private: std::string id_; diff --git a/core/src/container.cpp b/core/src/container.cpp index 7d329616..12b10658 100644 --- a/core/src/container.cpp +++ b/core/src/container.cpp @@ -233,7 +233,7 @@ struct SolutionCollector { const StagePrivate* const stopping_stage; }; -void SerialContainer::onNewSolution(SolutionBase ¤t) +void SerialContainer::onNewSolution(const SolutionBase ¤t) { const StagePrivate *creator = current.creator(); auto& children = pimpl()->children(); @@ -495,7 +495,7 @@ ParallelContainerBasePrivate::ParallelContainerBasePrivate(ParallelContainerBase })); } -void ParallelContainerBase::onNewSolution(SolutionBase &s) +void ParallelContainerBase::onNewSolution(const SolutionBase &s) { auto impl = pimpl(); WrappedSolution wrapped(impl, &s); diff --git a/core/src/stage.cpp b/core/src/stage.cpp index ad1adbf2..c6cebf41 100644 --- a/core/src/stage.cpp +++ b/core/src/stage.cpp @@ -102,7 +102,7 @@ void StagePrivate::validate() const { if (errors) throw errors; } -void StagePrivate::newSolution(SolutionBase &solution) +void StagePrivate::newSolution(const SolutionBase &solution) { for (const auto& cb : solution_cbs_) cb(solution); diff --git a/core/src/task.cpp b/core/src/task.cpp index 079cb1c9..96754f6b 100644 --- a/core/src/task.cpp +++ b/core/src/task.cpp @@ -235,7 +235,7 @@ void Task::publishAllSolutions(bool wait) introspection_->publishAllSolutions(wait); } -void Task::onNewSolution(SolutionBase &s) +void Task::onNewSolution(const SolutionBase &s) { pimpl()->newSolution(s); if (introspection_)