| 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 | { |
nothing calls this directly
no test coverage detected