diff options
author | Martin Miller | 2017-04-11 10:57:04 -0500 |
---|---|---|
committer | Martin Miller | 2017-04-11 10:57:04 -0500 |
commit | 1c543489862cd0bf9c559cee6575baf20f84b2d0 (patch) | |
tree | d968bf97d9d6a6bd444fd97b24054f720456c84f /src/state.cpp | |
parent | 16972c736994fa49b04d1e967516278660e4be2d (diff) | |
download | refslam-1c543489862cd0bf9c559cee6575baf20f84b2d0.zip refslam-1c543489862cd0bf9c559cee6575baf20f84b2d0.tar.gz |
Remove features after 5 timesteps without measurements
Diffstat (limited to 'src/state.cpp')
-rw-r--r-- | src/state.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/state.cpp b/src/state.cpp index 055a3d1..10b3ad3 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -1164,6 +1164,26 @@ State::doMeasurements ( vector<measurement_t> &z, Vision &viz, kalmanUpdate(h,S,z,q); #endif #endif + // Reset lastseen counter + for (auto i=z.begin(); i!=z.end(); ++i) { + if (i->z_type==HEIGHT) continue; + Feature *ft = featureById(i->id); + if (ft==NULL) { + cerr << "id: " << i->id << "is null." << endl; + } else { + ft->seen(); + } + } + + // Remove features that haven't been measured recently + auto i=features.begin(); + while (i!=features.end()) { + if ((*i)->since(5)) { + ++i; + } else { + i=removeFeature(i,false); + } + } // Initialize new features if (features.size()<MINFEATURES) { |