Merge branch 'develop' into feature/LPSolver
commit
bcb5ca97e0
|
@ -0,0 +1,31 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* 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 common macros used by handwritten exports of the python module
|
||||||
|
* @author Ellon Paiva Mendes (LAAS-CNRS)
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Fix to avoid registration warnings */
|
||||||
|
// Solution taken from https://github.com/BVLC/caffe/pull/4069/commits/673e8cfc0b8f05f9fa3ebbad7cc6202822e5d9c5
|
||||||
|
#define REGISTER_SHARED_PTR_TO_PYTHON(PTR) do { \
|
||||||
|
const boost::python::type_info info = \
|
||||||
|
boost::python::type_id<boost::shared_ptr<PTR > >(); \
|
||||||
|
const boost::python::converter::registration* reg = \
|
||||||
|
boost::python::converter::registry::query(info); \
|
||||||
|
if (reg == NULL) { \
|
||||||
|
boost::python::register_ptr_to_python<boost::shared_ptr<PTR > >(); \
|
||||||
|
} else if ((*reg).m_to_python == NULL) { \
|
||||||
|
boost::python::register_ptr_to_python<boost::shared_ptr<PTR > >(); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include "gtsam/linear/NoiseModel.h"
|
#include "gtsam/linear/NoiseModel.h"
|
||||||
|
|
||||||
|
#include "python/handwritten/common.h"
|
||||||
|
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
using namespace gtsam::noiseModel;
|
using namespace gtsam::noiseModel;
|
||||||
|
@ -110,7 +112,7 @@ void exportNoiseModels(){
|
||||||
.def("Covariance",&Gaussian::Covariance, Gaussian_Covariance_overloads())
|
.def("Covariance",&Gaussian::Covariance, Gaussian_Covariance_overloads())
|
||||||
.staticmethod("Covariance")
|
.staticmethod("Covariance")
|
||||||
;
|
;
|
||||||
register_ptr_to_python< boost::shared_ptr<Gaussian> >();
|
REGISTER_SHARED_PTR_TO_PYTHON(Gaussian);
|
||||||
|
|
||||||
class_<Diagonal, boost::shared_ptr<Diagonal>, bases<Gaussian> >("Diagonal", no_init)
|
class_<Diagonal, boost::shared_ptr<Diagonal>, bases<Gaussian> >("Diagonal", no_init)
|
||||||
.def("Sigmas",&Diagonal::Sigmas, Diagonal_Sigmas_overloads())
|
.def("Sigmas",&Diagonal::Sigmas, Diagonal_Sigmas_overloads())
|
||||||
|
@ -120,7 +122,7 @@ void exportNoiseModels(){
|
||||||
.def("Precisions",&Diagonal::Precisions, Diagonal_Precisions_overloads())
|
.def("Precisions",&Diagonal::Precisions, Diagonal_Precisions_overloads())
|
||||||
.staticmethod("Precisions")
|
.staticmethod("Precisions")
|
||||||
;
|
;
|
||||||
register_ptr_to_python< boost::shared_ptr<Diagonal> >();
|
REGISTER_SHARED_PTR_TO_PYTHON(Diagonal);
|
||||||
|
|
||||||
class_<Isotropic, boost::shared_ptr<Isotropic>, bases<Diagonal> >("Isotropic", no_init)
|
class_<Isotropic, boost::shared_ptr<Isotropic>, bases<Diagonal> >("Isotropic", no_init)
|
||||||
.def("Sigma",&Isotropic::Sigma, Isotropic_Sigma_overloads())
|
.def("Sigma",&Isotropic::Sigma, Isotropic_Sigma_overloads())
|
||||||
|
@ -130,12 +132,12 @@ void exportNoiseModels(){
|
||||||
.def("Precision",&Isotropic::Precision, Isotropic_Precision_overloads())
|
.def("Precision",&Isotropic::Precision, Isotropic_Precision_overloads())
|
||||||
.staticmethod("Precision")
|
.staticmethod("Precision")
|
||||||
;
|
;
|
||||||
register_ptr_to_python< boost::shared_ptr<Isotropic> >();
|
REGISTER_SHARED_PTR_TO_PYTHON(Isotropic);
|
||||||
|
|
||||||
class_<Unit, boost::shared_ptr<Unit>, bases<Isotropic> >("Unit", no_init)
|
class_<Unit, boost::shared_ptr<Unit>, bases<Isotropic> >("Unit", no_init)
|
||||||
.def("Create",&Unit::Create)
|
.def("Create",&Unit::Create)
|
||||||
.staticmethod("Create")
|
.staticmethod("Create")
|
||||||
;
|
;
|
||||||
|
|
||||||
register_ptr_to_python< boost::shared_ptr<Unit> >();
|
REGISTER_SHARED_PTR_TO_PYTHON(Unit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "gtsam/navigation/ImuFactor.h"
|
#include "gtsam/navigation/ImuFactor.h"
|
||||||
#include "gtsam/navigation/GPSFactor.h"
|
#include "gtsam/navigation/GPSFactor.h"
|
||||||
|
|
||||||
|
#include "python/handwritten/common.h"
|
||||||
|
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
|
@ -78,7 +80,7 @@ void exportImuFactor() {
|
||||||
.staticmethod("MakeSharedU");
|
.staticmethod("MakeSharedU");
|
||||||
|
|
||||||
// NOTE(frank): https://mail.python.org/pipermail/cplusplus-sig/2016-January/017362.html
|
// NOTE(frank): https://mail.python.org/pipermail/cplusplus-sig/2016-January/017362.html
|
||||||
register_ptr_to_python< boost::shared_ptr<PreintegrationParams> >();
|
REGISTER_SHARED_PTR_TO_PYTHON(PreintegrationParams);
|
||||||
|
|
||||||
class_<PreintegrationType>(
|
class_<PreintegrationType>(
|
||||||
#ifdef GTSAM_TANGENT_PREINTEGRATION
|
#ifdef GTSAM_TANGENT_PREINTEGRATION
|
||||||
|
@ -105,21 +107,21 @@ void exportImuFactor() {
|
||||||
.def("error", &ImuFactor::error)
|
.def("error", &ImuFactor::error)
|
||||||
.def(init<Key, Key, Key, Key, Key, const PreintegratedImuMeasurements&>())
|
.def(init<Key, Key, Key, Key, Key, const PreintegratedImuMeasurements&>())
|
||||||
.def(repr(self));
|
.def(repr(self));
|
||||||
register_ptr_to_python<boost::shared_ptr<ImuFactor>>();
|
REGISTER_SHARED_PTR_TO_PYTHON(ImuFactor);
|
||||||
|
|
||||||
class_<ImuFactor2, bases<NonlinearFactor>, boost::shared_ptr<ImuFactor2>>("ImuFactor2")
|
class_<ImuFactor2, bases<NonlinearFactor>, boost::shared_ptr<ImuFactor2>>("ImuFactor2")
|
||||||
.def("error", &ImuFactor2::error)
|
.def("error", &ImuFactor2::error)
|
||||||
.def(init<Key, Key, Key, const PreintegratedImuMeasurements&>())
|
.def(init<Key, Key, Key, const PreintegratedImuMeasurements&>())
|
||||||
.def(repr(self));
|
.def(repr(self));
|
||||||
register_ptr_to_python<boost::shared_ptr<ImuFactor2>>();
|
REGISTER_SHARED_PTR_TO_PYTHON(ImuFactor2);
|
||||||
|
|
||||||
class_<GPSFactor, bases<NonlinearFactor>, boost::shared_ptr<GPSFactor>>("GPSFactor")
|
class_<GPSFactor, bases<NonlinearFactor>, boost::shared_ptr<GPSFactor>>("GPSFactor")
|
||||||
.def("error", &GPSFactor::error)
|
.def("error", &GPSFactor::error)
|
||||||
.def(init<Key, const Point3&, noiseModel::Base::shared_ptr>());
|
.def(init<Key, const Point3&, noiseModel::Base::shared_ptr>());
|
||||||
register_ptr_to_python<boost::shared_ptr<GPSFactor>>();
|
REGISTER_SHARED_PTR_TO_PYTHON(GPSFactor);
|
||||||
|
|
||||||
class_<GPSFactor2, bases<NonlinearFactor>, boost::shared_ptr<GPSFactor2>>("GPSFactor2")
|
class_<GPSFactor2, bases<NonlinearFactor>, boost::shared_ptr<GPSFactor2>>("GPSFactor2")
|
||||||
.def("error", &GPSFactor2::error)
|
.def("error", &GPSFactor2::error)
|
||||||
.def(init<Key, const Point3&, noiseModel::Base::shared_ptr>());
|
.def(init<Key, const Point3&, noiseModel::Base::shared_ptr>());
|
||||||
register_ptr_to_python<boost::shared_ptr<GPSFactor2>>();
|
REGISTER_SHARED_PTR_TO_PYTHON(GPSFactor2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue