From 4c002629318aec7c616bcc2a27c4bc164832dfa6 Mon Sep 17 00:00:00 2001 From: Aleksei Panchenko Date: Wed, 29 May 2024 20:05:45 +0300 Subject: [PATCH] fixing python bindings for FGraphDiff --- python_examples/FGraphDiff_2d.py | 5 +++-- src/pybind/FGraphDiffPy.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/python_examples/FGraphDiff_2d.py b/python_examples/FGraphDiff_2d.py index 3eae4d4..2c454fc 100644 --- a/python_examples/FGraphDiff_2d.py +++ b/python_examples/FGraphDiff_2d.py @@ -15,7 +15,8 @@ graph.add_factor_1pose_2d(np.array([0,0,np.pi/4]),n1,1e6*invCov) graph.add_factor_2poses_2d(np.ones(3),n1,n2,invCov) -graph.solve(mrob.LM) -graph.print(True) +for i in range(10): + graph.solve(mrob.FGraphDiff_GN) + graph.print(True) diff --git a/src/pybind/FGraphDiffPy.cpp b/src/pybind/FGraphDiffPy.cpp index f864398..19f6f5e 100644 --- a/src/pybind/FGraphDiffPy.cpp +++ b/src/pybind/FGraphDiffPy.cpp @@ -96,12 +96,12 @@ class FGraphDiffPy : public FGraphDiffSolve void init_FGraphDiff(py::module &m) { -// py::enum_(m, "FGraphDiff.optimMethod") -// .value("GN", FGraphDiffSolve::optimMethod::GN) -// .value("LM", FGraphDiffSolve::optimMethod::LM) -// .value("LM_ELLIPS", FGraphDiffSolve::optimMethod::LM_ELLIPS) -// .export_values() -// ; + py::enum_(m, "FGraphDiff.optimMethod") + .value("FGraphDiff_GN", FGraphDiffSolve::optimMethod::GN) + .value("FGraphDiff_LM", FGraphDiffSolve::optimMethod::LM) + .value("FGraphDiff_LM_ELLIPS", FGraphDiffSolve::optimMethod::LM_ELLIPS) + .export_values() + ; // py::enum_(m, "FGraphDiff.robustFactorType") // .value("QUADRATIC", DiffFactor::robustFactorType::QUADRATIC) // .value("CAUCHY", DiffFactor::robustFactorType::CAUCHY)