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

Method computeUnweightedError

src/FactorGraph.cpp:777–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775 }
776
777 void FactorGraph::computeUnweightedError(const FactorType CurrentFactorType, std::vector<double> &ErrorData)
778 {
779 /** get residual IDs */
780 std::vector<ceres::ResidualBlockId> IDs;
781 _Structure.getResidualIDs(CurrentFactorType, IDs);
782
783 /** terminate here, if factors are missing */
784 if (IDs.empty() == true)
785 {
786 PRINT_WARNING("Factors of type ", CurrentFactorType, " are missing!");
787 return;
788 }
789
790 /** check IDs */
791 std::vector<ceres::ResidualBlockId> IDsCeres;
792 std::vector<bool> Existence;
793 _Graph.GetResidualBlocks(&IDsCeres);
794 for (auto const &ID1 : IDs)
795 {
796 bool Exists = false;
797 for (auto const &ID2 : IDsCeres)
798 {
799 if (ID1 == ID2)
800 {
801 Exists = true;
802 }
803 }
804 Existence.push_back(Exists);
805 if (Exists == false)
806 {
807 PRINT_ERROR("Found missing ID");
808 }
809 }
810
811 /** configure evaluation */
812 ceres::Problem::EvaluateOptions Options;
813 Options.num_threads = std::thread::hardware_concurrency();
814 Options.residual_blocks = IDs;
815 Options.apply_loss_function = false;
816
817 /** disable error model during evaluation */
818 disableErrorModel(CurrentFactorType);
819
820 /** compute the errors */
821 _Graph.Evaluate(Options, nullptr, &ErrorData, nullptr, nullptr);
822
823 /** re-enable error model */
824 enableErrorModel(CurrentFactorType);
825
826 /** create factor ID */
827 double TimeFirst;
828 _Structure.getTimeFirst(CurrentFactorType, TimeFirst);
829 FactorID FirstID(CurrentFactorType, TimeFirst, 0);
830
831 /** remove unused dimensions */
832 int InputSize, OutputSize;
833 _Structure.getErrorInputSize(FirstID, InputSize);
834 _Structure.getErrorOutputSize(FirstID, OutputSize);

Callers 4

TuneErrorModelFunction · 0.80
TuneErrorModelFunction · 0.80
TuneErrorModelFunction · 0.80

Calls 13

getResidualIDsMethod · 0.80
emptyMethod · 0.80
getErrorInputSizeMethod · 0.80
getErrorOutputSizeMethod · 0.80
beginMethod · 0.80
getFactorIDsMethod · 0.80
setTimestampMethod · 0.80
checkFactorMethod · 0.80
getResidualIDMethod · 0.80
EvaluateMethod · 0.45
getTimeFirstMethod · 0.45
setMeanMethod · 0.45

Tested by

no test coverage detected