From 5841c1eb3e689907de53382dc4972ffe86a68ec2 Mon Sep 17 00:00:00 2001 From: jvallve <jvallve@iri.upc.edu> Date: Mon, 25 Apr 2022 14:33:36 +0200 Subject: [PATCH] wip --- include/core/problem/problem.h | 13 ++++++++----- src/problem/problem.cpp | 3 --- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index 3ded670af..ce1a393f6 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -200,8 +200,8 @@ class Problem : public std::enable_shared_from_this<Problem> void removeMotionProvider(MotionProviderPtr proc); public: - const std::map<int,MotionProviderConstPtr>& getMotionProviderMap() const; - const std::map<int,MotionProviderPtr>& getMotionProviderMap(); + std::map<int,MotionProviderConstPtr> getMotionProviderMap() const; + std::map<int,MotionProviderPtr> getMotionProviderMap(); // Trajectory branch ---------------------------------- TrajectoryBaseConstPtr getTrajectory() const; @@ -455,12 +455,15 @@ inline bool Problem::isPriorSet() const return prior_options_ == nullptr; } -inline const std::map<int,MotionProviderConstPtr>& Problem::getMotionProviderMap() const +inline std::map<int,MotionProviderConstPtr> Problem::getMotionProviderMap() const { - return motion_provider_const_map_; + std::map<int,MotionProviderConstPtr> map_const; + for (auto&& pair : motion_provider_map_) + map_const[pair.first] = pair.second; + return map_const; } -inline const std::map<int,MotionProviderPtr>& Problem::getMotionProviderMap() +inline std::map<int,MotionProviderPtr> Problem::getMotionProviderMap() { return motion_provider_map_; } diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index cc51fa680..74949c604 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -65,7 +65,6 @@ Problem::Problem(const std::string& _frame_structure, SizeEigen _dim, MapBasePtr trajectory_ptr_(std::make_shared<TrajectoryBase>()), map_ptr_(_map), motion_provider_map_(), - motion_provider_const_map_(), frame_structure_(_frame_structure), prior_options_(std::make_shared<PriorOptions>()) { @@ -659,7 +658,6 @@ void Problem::addMotionProvider(MotionProviderPtr _motion_provider_ptr) // add to map ordered by priority motion_provider_map_.emplace(_motion_provider_ptr->getStatePriority(), _motion_provider_ptr); - motion_provider_const_map_.emplace(_motion_provider_ptr->getStatePriority(), _motion_provider_ptr); appendToStructure(_motion_provider_ptr->getStateStructure()); } @@ -668,7 +666,6 @@ void Problem::removeMotionProvider(MotionProviderPtr proc) WOLF_WARN_COND(motion_provider_map_.count(proc->getStatePriority()) == 0, "Problem::clearMotionProvider: missing processor"); motion_provider_map_.erase(proc->getStatePriority()); - motion_provider_const_map_.erase(proc->getStatePriority()); // rebuild frame structure with remaining motion processors frame_structure_.clear(); -- GitLab