diff --git a/python/gtsam/__init__.py b/python/gtsam/__init__.py index 3e2899db0..0493a252f 100644 --- a/python/gtsam/__init__.py +++ b/python/gtsam/__init__.py @@ -1,3 +1,5 @@ import registernumpyeigen import noiseModel import geometry +import nonlinear + diff --git a/python/gtsam/nonlinear/.gitignore b/python/gtsam/nonlinear/.gitignore new file mode 100644 index 000000000..d2353be92 --- /dev/null +++ b/python/gtsam/nonlinear/.gitignore @@ -0,0 +1 @@ +/libnonlinear_python.so diff --git a/python/gtsam/nonlinear/__init__.py b/python/gtsam/nonlinear/__init__.py new file mode 100644 index 000000000..74a227d48 --- /dev/null +++ b/python/gtsam/nonlinear/__init__.py @@ -0,0 +1 @@ +from libnonlinear_python import * \ No newline at end of file diff --git a/python/handwritten/nonlinear_python.cpp b/python/handwritten/nonlinear_python.cpp new file mode 100644 index 000000000..09b56ea85 --- /dev/null +++ b/python/handwritten/nonlinear_python.cpp @@ -0,0 +1,54 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file nonlinear_python.cpp + * @brief wraps nonlinear classes into the nonlinear submodule of gtsam python + * @author Ellon Paiva Mendes (LAAS-CNRS) + **/ + + /** TODOs Summary: + * + */ + +#include + +#include +#include + +using namespace boost::python; +using namespace gtsam; + +// Prototypes used to perform overloading +// See: http://www.boost.org/doc/libs/1_59_0/libs/python/doc/tutorial/doc/html/python/functions.html +void (Values::*insert_0)(const gtsam::Values&) = &Values::insert; +void (Values::*insert_1)(Key, const gtsam::Pose3&) = &Values::insert; + +BOOST_PYTHON_MODULE(libnonlinear_python) +{ + +class_("Values") + .def(init<>()) + .def(init()) + .def("clear", &Values::clear) + .def("dim", &Values::dim) + .def("empty", &Values::empty) + .def("equals", &Values::equals) + .def("erase", &Values::erase) + .def("insertFixed", &Values::insertFixed) + .def("print", &Values::print) + .def("size", &Values::size) + .def("swap", &Values::swap) + .def("insert", insert_0) + .def("insert", insert_1) +; + +} \ No newline at end of file