Wrap KeyVector to python

While here, do small cleanup on exportgtsam.cpp
release/4.3a0
Ellon Mendes 2015-11-24 13:28:01 +01:00
parent a6b48194fd
commit 46a1970731
3 changed files with 42 additions and 6 deletions

View File

@ -0,0 +1,37 @@
/* ----------------------------------------------------------------------------
* 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
* -------------------------------------------------------------------------- */
/**
* @brief wraps FastVector instances to python
* @author Ellon Paiva Mendes (LAAS-CNRS)
**/
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#define NO_IMPORT_ARRAY
#include <numpy_eigen/NumpyEigenConverter.hpp>
#include "gtsam/base/FastVector.h"
#include "gtsam/base/types.h" // for Key definition
using namespace boost::python;
using namespace gtsam;
void exportFastVectors(){
typedef FastVector<Key> KeyVector;
class_<KeyVector>("KeyVector")
.def(vector_indexing_suite<KeyVector>())
;
}

View File

@ -20,12 +20,8 @@
#include <numpy_eigen/NumpyEigenConverter.hpp>
#include <gtsam/base/Matrix.h>
#include <gtsam/base/Vector.h>
using namespace boost::python;
using namespace gtsam;
using namespace std;
// Base
void exportFastVectors();
// Geometry
void exportPoint2();
@ -68,6 +64,8 @@ BOOST_PYTHON_MODULE(libgtsam_python){
registerNumpyEigenConversions();
exportFastVectors();
exportPoint2();
exportPoint3();
exportRot2();

View File

@ -107,5 +107,6 @@ void exportValues(){
.def("rot3_at", &Values::at<Rot3>, return_value_policy<copy_const_reference>())
.def("pose3_at", &Values::at<Pose3>, return_value_policy<copy_const_reference>())
.def("exists", exists1)
.def("keys", &Values::keys)
;
}