Skip to content

Commit 32186de

Browse files
fix(autonomous_emergency_braking): add missing erase to velocity history (#6966)
add missing erase Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent 04faf5e commit 32186de

File tree

1 file changed

+8
-9
lines changed
  • control/autonomous_emergency_braking/include/autonomous_emergency_braking

1 file changed

+8
-9
lines changed

control/autonomous_emergency_braking/include/autonomous_emergency_braking/node.hpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ class CollisionDataKeeper
142142
{
143143
// remove old msg from deque
144144
const auto now = clock_->now();
145-
std::remove_if(
146-
obstacle_velocity_history_.begin(), obstacle_velocity_history_.end(),
147-
[&](const auto & velocity_time_pair) {
148-
const auto & vel_time = velocity_time_pair.second;
149-
return ((now - vel_time).nanoseconds() * 1e-9 > previous_obstacle_keep_time_);
150-
});
151-
145+
obstacle_velocity_history_.erase(
146+
std::remove_if(
147+
obstacle_velocity_history_.begin(), obstacle_velocity_history_.end(),
148+
[&](const auto & velocity_time_pair) {
149+
const auto & vel_time = velocity_time_pair.second;
150+
return ((now - vel_time).nanoseconds() * 1e-9 > previous_obstacle_keep_time_);
151+
}),
152+
obstacle_velocity_history_.end());
152153
obstacle_velocity_history_.emplace_back(
153154
std::make_pair(current_object_velocity, current_object_velocity_time_stamp));
154155
}
@@ -204,8 +205,6 @@ class CollisionDataKeeper
204205
});
205206

206207
if (!estimated_velocity_opt.has_value()) {
207-
this->setPreviousObjectData(closest_object);
208-
this->resetVelocityHistory();
209208
return std::nullopt;
210209
}
211210

0 commit comments

Comments
 (0)