@@ -774,15 +774,16 @@ auto EntityBase::requestSynchronize(
774
774
RoutingConfiguration lane_changeable_routing_configuration;
775
775
lane_changeable_routing_configuration.allow_lane_change = true ;
776
776
777
- if (other_status_.find (target_name) == other_status_.end ()) {
777
+ if (const auto target_entity_status_it = other_status_.find (target_name);
778
+ target_entity_status_it == other_status_.end ()) {
778
779
THROW_SEMANTIC_ERROR (
779
780
" requestSynchronize(): Entity " , std::quoted (target_name), " does not exist." );
780
781
} else if (const auto canonicalized_lanelet_pose = getCanonicalizedLaneletPose ();
781
782
!canonicalized_lanelet_pose.has_value ()) {
782
783
THROW_SEMANTIC_ERROR (
783
784
" requestSynchronize(): Failed to get lanelet pose of the entity: " , std::quoted (name));
784
785
} else if (const auto target_entity_canonicalized_lanelet_pose =
785
- other_status_. find (target_name) ->second .getCanonicalizedLaneletPose ();
786
+ target_entity_status_it ->second .getCanonicalizedLaneletPose ();
786
787
!target_entity_canonicalized_lanelet_pose.has_value ()) {
787
788
THROW_SEMANTIC_ERROR (
788
789
" requestSynchronize(): Failed to get lanelet pose of the target entity: " ,
@@ -809,8 +810,7 @@ auto EntityBase::requestSynchronize(
809
810
<< std::quoted (target_name) << " has already passed the target lanelet." );
810
811
return true ;
811
812
} else {
812
- const auto target_entity_velocity =
813
- other_status_.find (target_name)->second .getTwist ().linear .x ;
813
+ const auto target_entity_velocity = target_entity_status_it->second .getTwist ().linear .x ;
814
814
const auto entity_velocity = getCurrentTwist ().linear .x ;
815
815
const auto target_entity_arrival_time =
816
816
(std::abs (target_entity_velocity) > std::numeric_limits<double >::epsilon ())
0 commit comments