diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index be739d7b4..e503bdb45 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -19,7 +19,7 @@ file(GLOB symbolic_src "symbolic/*.cpp") #wrap_python("base" ${PROJECT_SOURCE_DIR}/python/${PROJECT_NAME} ${base_src}) wrap_python("geometry" ${PROJECT_SOURCE_DIR}/python/gtsam ${geometry_src}) - +wrap_python("slam" ${PROJECT_SOURCE_DIR}/python/gtsam ${slam_src}) #add_python_export_library(${PROJECT_NAME}_test ${PROJECT_SOURCE_DIR}/python/${PROJECT_NAME} # ${AUTOGEN_TEST_FILES} #) \ No newline at end of file diff --git a/python/base/DerivedValue.cpp b/python/base/DerivedValue.cpp deleted file mode 100644 index b389d14fc..000000000 --- a/python/base/DerivedValue.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "gtsam/base/DerivedValue.h" - -using namespace boost::python; -using namespace gtsam; - -/*void exportDerivedValue(){ - class_ >("DerivedValue", no_init); -}*/ \ No newline at end of file diff --git a/python/base/Value.cpp b/python/base/Value.cpp deleted file mode 100644 index 052334dbf..000000000 --- a/python/base/Value.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "gtsam/base/Value.h" - -using namespace boost::python; -using namespace gtsam; - -// Virtual class, no init -void exportValue(){ - class_("Value", no_init); -} \ No newline at end of file diff --git a/python/slam/BearingFactor.cpp b/python/slam/BearingFactor.cpp new file mode 100644 index 000000000..63d4bb3ed --- /dev/null +++ b/python/slam/BearingFactor.cpp @@ -0,0 +1,13 @@ +#include +#include + +using namespace boost::python; +using namespace gtsam; + +using namespace std; + +template +void exposeBearingFactor(const std::string& name){ + class_(name, init<>()) + ; +} \ No newline at end of file diff --git a/python/slam/BetweenFactor.cpp b/python/slam/BetweenFactor.cpp new file mode 100644 index 000000000..3674614da --- /dev/null +++ b/python/slam/BetweenFactor.cpp @@ -0,0 +1,14 @@ +#include +#include + +using namespace boost::python; +using namespace gtsam; + +using namespace std; + +template +void exposeBetweenFactor(const std::string& name){ + class_(name, init<>()) + .def(init()) + ; +} \ No newline at end of file diff --git a/python/slam/PriorFactor.cpp b/python/slam/PriorFactor.cpp new file mode 100644 index 000000000..e1ee27602 --- /dev/null +++ b/python/slam/PriorFactor.cpp @@ -0,0 +1,14 @@ +#include +#include + +using namespace boost::python; +using namespace gtsam; + +using namespace std; + +template +void exposePriorFactor(const std::string& name){ + class_(name, init<>()) + .def(init()) + ; +} \ No newline at end of file diff --git a/python/slam/exportSlam.cpp b/python/slam/exportSlam.cpp new file mode 100644 index 000000000..fdd1d1549 --- /dev/null +++ b/python/slam/exportSlam.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include +#include +#include +#include + +template void exportPriorFactor(const std::string& name); +template void exportBetweenFactor(const std::string& name); + +BOOST_PYTHON_MODULE(libgeometry){ + using namespace boost::python; + + typedef gtsam::PriorFactor Point2PriorFactor; + typedef gtsam::PriorFactor Pose2PriorFactor; + + exportPriorFactor("Point2PriorFactor"); + exportPriorFactor("Pose2PriorFactor"); + + typedef gtsam::BetweenFactor Pose2BetweenFactor; + + exportBetweenFactor("Pose2BetweenFactor"); +} \ No newline at end of file