| 89 | } |
| 90 | |
| 91 | void |
| 92 | Tracker3D::newFrame(const std::vector<open_ptrack::detection::Detection>& detections) |
| 93 | { |
| 94 | detections_.clear(); |
| 95 | unassociated_detections_.clear(); |
| 96 | lost_tracks_.clear(); |
| 97 | new_tracks_.clear(); |
| 98 | detections_ = detections; |
| 99 | |
| 100 | ros::Time current_detections_time = detections_[0].getSource()->getTime(); |
| 101 | |
| 102 | for(std::list<open_ptrack::tracking::Track3D*>::iterator it = tracks_.begin(); it != tracks_.end();) |
| 103 | { |
| 104 | open_ptrack::tracking::Track3D* t = *it; |
| 105 | bool deleted = false; |
| 106 | |
| 107 | if(((t->getVisibility() == Track3D::NOT_VISIBLE && (t->getSecFromLastHighConfidenceDetection(current_detections_time)) >= sec_before_old_) |
| 108 | || (!t->isValidated() && t->getSecFromFirstDetection(current_detections_time) >= sec_before_fake_))) |
| 109 | { |
| 110 | if (debug_mode_) |
| 111 | { |
| 112 | std::cout << "Track " << t->getId() << " DELETED" << std::endl; |
| 113 | } |
| 114 | delete t; |
| 115 | it = tracks_.erase(it); |
| 116 | deleted = true; |
| 117 | } |
| 118 | else if(!t->isValidated() && t->getUpdatesWithEnoughConfidence() == detections_to_validate_) |
| 119 | { |
| 120 | t->validate(); |
| 121 | if (debug_mode_) |
| 122 | { |
| 123 | std::cout << "Track " << t->getId() << " VALIDATED" << std::endl; |
| 124 | } |
| 125 | } |
| 126 | else if(t->getStatus() == Track3D::NEW && t->getSecFromFirstDetection(current_detections_time) >= sec_remain_new_) |
| 127 | { |
| 128 | t->setStatus(Track3D::NORMAL); |
| 129 | if (debug_mode_) |
| 130 | { |
| 131 | std::cout << "Track " << t->getId() << " set to NORMAL" << std::endl; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | if(!deleted) |
| 136 | { |
| 137 | if(t->getStatus() == Track3D::NEW && t->getVisibility() == Track3D::VISIBLE) |
| 138 | new_tracks_.push_back(t); |
| 139 | if(t->getVisibility() == Track3D::NOT_VISIBLE) |
| 140 | lost_tracks_.push_back(t); |
| 141 | it++; |
| 142 | } |
| 143 | |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void |
| 148 | Tracker3D::updateTracks() |
nothing calls this directly
no test coverage detected