From b10f7386c518aaeb44af00f2b5fff464a2404444 Mon Sep 17 00:00:00 2001 From: Ellon Mendes Date: Thu, 19 Nov 2015 11:02:51 +0100 Subject: [PATCH] Wrap prior factors --- python/handwritten/slam_python.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/handwritten/slam_python.cpp b/python/handwritten/slam_python.cpp index 67aaf50c6..c3c86661a 100644 --- a/python/handwritten/slam_python.cpp +++ b/python/handwritten/slam_python.cpp @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -51,13 +52,19 @@ struct NonlinearFactorCallback : NonlinearFactor, wrapper } }; -// Macro used to define a BetweenFactor given the type. +// Macro used to define templated factors #define BETWEENFACTOR(VALUE) \ class_< BetweenFactor, bases, boost::shared_ptr< BetweenFactor > >("BetweenFactor"#VALUE) \ .def(init()) \ .def("measured", &BetweenFactor::measured, return_internal_reference<>()) \ ; +#define PRIORFACTOR(VALUE) \ + class_< PriorFactor, bases, boost::shared_ptr< PriorFactor > >("PriorFactor"#VALUE) \ + .def(init()) \ + .def("prior", &PriorFactor::prior, return_internal_reference<>()) \ +; + BOOST_PYTHON_MODULE(libslam_python) { @@ -70,4 +77,10 @@ BOOST_PYTHON_MODULE(libslam_python) BETWEENFACTOR(Pose3) + PRIORFACTOR(Point3) + + PRIORFACTOR(Rot3) + + PRIORFACTOR(Pose3) + } \ No newline at end of file