File tree 1 file changed +5
-3
lines changed
perception/multi_object_tracker/src/processor
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -183,14 +183,16 @@ void TrackerProcessor::removeOverlappedTracker(const rclcpp::Time & time)
183
183
list_tracker_.begin (), list_tracker_.end ());
184
184
std::sort (
185
185
sorted_list_tracker.begin (), sorted_list_tracker.end (),
186
- [](const std::shared_ptr<Tracker> & a, const std::shared_ptr<Tracker> & b) {
186
+ [& time ](const std::shared_ptr<Tracker> & a, const std::shared_ptr<Tracker> & b) {
187
187
bool a_unknown = (a->getHighestProbLabel () == Label::UNKNOWN);
188
188
bool b_unknown = (b->getHighestProbLabel () == Label::UNKNOWN);
189
189
if (a_unknown != b_unknown) {
190
190
return b_unknown; // Put non-UNKNOWN objects first
191
191
}
192
- return a->getTotalMeasurementCount () >
193
- b->getTotalMeasurementCount (); // Then sort by measurement count
192
+ if (a->getTotalMeasurementCount () != b->getTotalMeasurementCount ()) {
193
+ return a->getTotalMeasurementCount () > b->getTotalMeasurementCount (); // Then sort by measurement count
194
+ }
195
+ return a->getElapsedTimeFromLastUpdate (time ) < b->getElapsedTimeFromLastUpdate (time ); // Finally sort by elapsed time (smaller first)
194
196
});
195
197
196
198
/* Iterate through the list of trackers */
You can’t perform that action at this time.
0 commit comments