Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Mar 11, 2025
1 parent f8d4663 commit a0e57c1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions perception/multi_object_tracker/src/multi_object_tracker_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,18 @@ void MultiObjectTracker::sanitizeTracker(
constexpr double distance_threshold = 5.0;

// Create sorted list with non-UNKNOWN objects first, then by measurement count
std::vector<std::shared_ptr<Tracker>> sorted_list_tracker(list_tracker.begin(), list_tracker.end());
std::sort(sorted_list_tracker.begin(), sorted_list_tracker.end(),
[](const std::shared_ptr<Tracker>& a, const std::shared_ptr<Tracker>& b) {
std::vector<std::shared_ptr<Tracker>> sorted_list_tracker(
list_tracker.begin(), list_tracker.end());
std::sort(
sorted_list_tracker.begin(), sorted_list_tracker.end(),
[](const std::shared_ptr<Tracker> & a, const std::shared_ptr<Tracker> & b) {
bool a_unknown = (a->getHighestProbLabel() == Label::UNKNOWN);
bool b_unknown = (b->getHighestProbLabel() == Label::UNKNOWN);
if (a_unknown != b_unknown) {
return b_unknown; // Put non-UNKNOWN objects first
}
return a->getTotalMeasurementCount() > b->getTotalMeasurementCount(); // Then sort by measurement count
return a->getTotalMeasurementCount() >
b->getTotalMeasurementCount(); // Then sort by measurement count
});

/* delete collision tracker */
Expand Down Expand Up @@ -438,8 +441,9 @@ void MultiObjectTracker::sanitizeTracker(

if (delete_candidate_tracker) {
/* erase only when prioritized one has a measurement or the other one doesn't */
if (sorted_list_tracker[i]->getNoMeasurementCount() <= 0 or
sorted_list_tracker[j]->getNoMeasurementCount() > 0) {
if (
sorted_list_tracker[i]->getNoMeasurementCount() <= 0 or
sorted_list_tracker[j]->getNoMeasurementCount() > 0) {
// Remove from original list_tracker
list_tracker.remove(sorted_list_tracker[j]);
// Remove from sorted list
Expand Down

0 comments on commit a0e57c1

Please sign in to comment.