| 358 | |
| 359 | template <FactorType CurrentFactorType, typename ErrorType> |
| 360 | void addFactorBase(StateList &States, ErrorType &NoiseModel, const Data &Measurement, ceres::LossFunction* RobustLoss, const bool DoPrediction) |
| 361 | { |
| 362 | /** get index timestamp */ |
| 363 | const double TimestampFirst = States._List.front().Timestamp; |
| 364 | |
| 365 | /** translate the factor type enum to the class that should be added to the graph */ |
| 366 | typedef typename FactorTypeTranslator<CurrentFactorType,ErrorType>::Type FactorClassType; |
| 367 | |
| 368 | /** decide at compile time which parameters are required */ |
| 369 | if constexpr (FactorClassType::HasDeltaTime == true && FactorClassType::HasMeasurement == true) |
| 370 | { |
| 371 | /** calculate delta time */ |
| 372 | const double DeltaTime = States._List.back().Timestamp - TimestampFirst; |
| 373 | |
| 374 | addFactorGeneric<ErrorType, FactorClassType> (NoiseModel, |
| 375 | States._List, |
| 376 | CurrentFactorType, |
| 377 | RobustLoss, |
| 378 | DoPrediction, |
| 379 | TimestampFirst, |
| 380 | Measurement, |
| 381 | DeltaTime); |
| 382 | } |
| 383 | else if constexpr (FactorClassType::HasDeltaTime == false && FactorClassType::HasMeasurement == true) |
| 384 | { |
| 385 | addFactorGeneric<ErrorType, FactorClassType> (NoiseModel, |
| 386 | States._List, |
| 387 | CurrentFactorType, |
| 388 | RobustLoss, |
| 389 | DoPrediction, |
| 390 | TimestampFirst, |
| 391 | Measurement); |
| 392 | } |
| 393 | else if constexpr (FactorClassType::HasDeltaTime == true && FactorClassType::HasMeasurement == false) |
| 394 | { |
| 395 | /** calculate delta time */ |
| 396 | const double DeltaTime = States._List.back().Timestamp - TimestampFirst; |
| 397 | |
| 398 | addFactorGeneric<ErrorType, FactorClassType> (NoiseModel, |
| 399 | States._List, |
| 400 | CurrentFactorType, |
| 401 | RobustLoss, |
| 402 | DoPrediction, |
| 403 | TimestampFirst, |
| 404 | DeltaTime); |
| 405 | } |
| 406 | else if constexpr (FactorClassType::HasDeltaTime == false && FactorClassType::HasMeasurement == false) |
| 407 | { |
| 408 | addFactorGeneric<ErrorType, FactorClassType> (NoiseModel, |
| 409 | States._List, |
| 410 | CurrentFactorType, |
| 411 | RobustLoss, |
| 412 | DoPrediction, |
| 413 | TimestampFirst); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | /** default settings for new ceres::Problems, especially enable_fast_removal = true */ |
nothing calls this directly
no outgoing calls
no test coverage detected