From 9435a2ee688d32bc2e942cb8ffdf415f44362189 Mon Sep 17 00:00:00 2001 From: Dima Dorezyuk Date: Tue, 13 Jul 2021 16:20:38 +0200 Subject: [PATCH] clear already reported observations --- costmap_2d/src/observation_buffer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/costmap_2d/src/observation_buffer.cpp b/costmap_2d/src/observation_buffer.cpp index 06fb38e878..ce8c995728 100644 --- a/costmap_2d/src/observation_buffer.cpp +++ b/costmap_2d/src/observation_buffer.cpp @@ -191,15 +191,14 @@ void ObservationBuffer::bufferCloud(const sensor_msgs::PointCloud2& cloud) // returns a copy of the observations void ObservationBuffer::getObservations(vector& observations) { - // first... let's make sure that we don't have any stale observations - purgeStaleObservations(); - // now we'll just copy the observations for the caller list::iterator obs_it; for (obs_it = observation_list_.begin(); obs_it != observation_list_.end(); ++obs_it) { observations.push_back(*obs_it); } + + observation_list_.clear(); } void ObservationBuffer::purgeStaleObservations()