MCPcopy Create free account
hub / github.com/TUC-ProAut/libRSF / marginalizeAllStatesOutsideWindow

Method marginalizeAllStatesOutsideWindow

src/FactorGraph.cpp:360–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358 }
359
360 bool FactorGraph::marginalizeAllStatesOutsideWindow(const double TimeWindow, const double CurrentTime, const double Inflation)
361 {
362 /** calculate time boarder */
363 const double CutTime = roundToTick(CurrentTime - TimeWindow);
364
365 /** check if marginalization is required before doing anything */
366 double TimeFirst = CutTime;
367 _StateData.getTimeFirstOverall(TimeFirst);
368 if (TimeFirst > CutTime)
369 {
370 /** no marginalization required, exit here... */
371 return true;
372 }
373
374 /** collect relevant states */
375 std::vector<StateID> States;
376
377 /** iterate over state names */
378 const std::vector<string> StateNames = _StateData.getKeysAll();
379 for (const string &Name : StateNames)
380 {
381 /** check if there is an element below cut time */
382 double TimeFirstState;
383 if (_StateData.getTimeFirst(Name, TimeFirstState))
384 {
385 if (TimeFirstState <= CutTime)
386 {
387 /** iterate over timestamps */
388 std::vector<double> Times;
389 if (_StateData.getTimesBelowOrEqual(Name, CutTime, Times))
390 {
391 for (const double Time : Times)
392 {
393 /** iterate over number */
394 int Numbers = _StateData.countElement(Name, Time);
395 for (int n = 0; n < Numbers; n++)
396 {
397 States.emplace_back(StateID(Name, Time, n));
398 }
399 }
400 }
401 }
402 }
403 }
404
405 /** marginalize */
406 return this->marginalizeStates(States, Inflation);
407 }
408
409 bool FactorGraph::computeCovariance(const string Name, const double Timestamp)
410 {

Callers

nothing calls this directly

Calls 7

marginalizeStatesMethod · 0.95
roundToTickFunction · 0.85
getTimeFirstOverallMethod · 0.80
getKeysAllMethod · 0.80
getTimesBelowOrEqualMethod · 0.80
countElementMethod · 0.80
getTimeFirstMethod · 0.45

Tested by

no test coverage detected