From dfd0ee7588f28daabdd15a04af5ea6b041da35e0 Mon Sep 17 00:00:00 2001 From: Takayuki Murooka Date: Tue, 25 Jul 2023 10:32:29 +0900 Subject: [PATCH] fix(dynamic_avoidance): fix bug of emplacing existing object (#4384) Signed-off-by: Takayuki Murooka --- .../dynamic_avoidance/dynamic_avoidance_module.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/planning/behavior_path_planner/include/behavior_path_planner/scene_module/dynamic_avoidance/dynamic_avoidance_module.hpp b/planning/behavior_path_planner/include/behavior_path_planner/scene_module/dynamic_avoidance/dynamic_avoidance_module.hpp index fc477d485dfcc..d43e1d08050e7 100644 --- a/planning/behavior_path_planner/include/behavior_path_planner/scene_module/dynamic_avoidance/dynamic_avoidance_module.hpp +++ b/planning/behavior_path_planner/include/behavior_path_planner/scene_module/dynamic_avoidance/dynamic_avoidance_module.hpp @@ -198,7 +198,11 @@ class DynamicAvoidanceModule : public SceneModuleInterface } void update(const std::string & uuid, const double new_variable) { - variable_.emplace(uuid, new_variable); + if (variable_.count(uuid) != 0) { + variable_.at(uuid) = new_variable; + } else { + variable_.emplace(uuid, new_variable); + } } std::unordered_map variable_;