More wrapping
parent
7b60c50297
commit
1c19b4e803
|
@ -1,6 +1,6 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
* Atlanta, Georgia 30332-0415
|
* Atlanta, Georgia 30332-0415
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||||
|
@ -75,18 +75,9 @@ public:
|
||||||
/// @name Component Access
|
/// @name Component Access
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
inline const Rot3& attitude() const {
|
const Rot3& attitude(OptionalJacobian<3, 9> H = boost::none) const;
|
||||||
return R_;
|
const Point3& position(OptionalJacobian<3, 9> H = boost::none) const;
|
||||||
}
|
const Velocity3& velocity(OptionalJacobian<3, 9> H = boost::none) const;
|
||||||
inline const Point3& position() const {
|
|
||||||
return t_;
|
|
||||||
}
|
|
||||||
inline const Velocity3& velocity() const {
|
|
||||||
return v_;
|
|
||||||
}
|
|
||||||
const Rot3& attitude(OptionalJacobian<3, 9> H) const;
|
|
||||||
const Point3& position(OptionalJacobian<3, 9> H) const;
|
|
||||||
const Velocity3& velocity(OptionalJacobian<3, 9> H) const;
|
|
||||||
|
|
||||||
const Pose3 pose() const {
|
const Pose3 pose() const {
|
||||||
return Pose3(attitude(), position());
|
return Pose3(attitude(), position());
|
||||||
|
|
|
@ -24,18 +24,29 @@
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
typedef gtsam::OptionalJacobian<9, 9> OptionalJacobian9;
|
typedef gtsam::OptionalJacobian<3, 9> OptionalJacobian39;
|
||||||
typedef gtsam::OptionalJacobian<9, 6> OptionalJacobian96;
|
typedef gtsam::OptionalJacobian<9, 6> OptionalJacobian96;
|
||||||
|
typedef gtsam::OptionalJacobian<9, 9> OptionalJacobian9;
|
||||||
|
|
||||||
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(print_overloads, print, 0, 1)
|
||||||
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(attitude_overloads, attitude, 0, 1)
|
||||||
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(position_overloads, position, 0, 1)
|
||||||
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(velocity_overloads, velocity, 0, 1)
|
||||||
|
|
||||||
void exportImuFactor() {
|
void exportImuFactor() {
|
||||||
class_<OptionalJacobian9>("OptionalJacobian9", init<>());
|
class_<OptionalJacobian39>("OptionalJacobian39", init<>());
|
||||||
class_<OptionalJacobian96>("OptionalJacobian96", init<>());
|
class_<OptionalJacobian96>("OptionalJacobian96", init<>());
|
||||||
|
class_<OptionalJacobian9>("OptionalJacobian9", init<>());
|
||||||
|
|
||||||
class_<NavState>("NavState", init<>())
|
class_<NavState>("NavState", init<>())
|
||||||
// TODO(frank): overload with jacobians
|
// TODO(frank): overload with jacobians
|
||||||
// .def("attitude", &NavState::attitude)
|
.def("print", &NavState::print, print_overloads())
|
||||||
// .def("position", &NavState::position)
|
.def("attitude", &NavState::attitude,
|
||||||
// .def("velocity", &NavState::velocity)
|
attitude_overloads()[return_value_policy<copy_const_reference>()])
|
||||||
|
.def("position", &NavState::position,
|
||||||
|
position_overloads()[return_value_policy<copy_const_reference>()])
|
||||||
|
.def("velocity", &NavState::velocity,
|
||||||
|
velocity_overloads()[return_value_policy<copy_const_reference>()])
|
||||||
.def(repr(self))
|
.def(repr(self))
|
||||||
.def("pose", &NavState::pose);
|
.def("pose", &NavState::pose);
|
||||||
|
|
||||||
|
@ -77,6 +88,7 @@ void exportImuFactor() {
|
||||||
// NOTE(frank): Abstract classes need boost::noncopyable
|
// NOTE(frank): Abstract classes need boost::noncopyable
|
||||||
class_<ImuFactor, bases<NonlinearFactor>, boost::shared_ptr<ImuFactor>>(
|
class_<ImuFactor, bases<NonlinearFactor>, boost::shared_ptr<ImuFactor>>(
|
||||||
"ImuFactor")
|
"ImuFactor")
|
||||||
|
.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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
* Atlanta, Georgia 30332-0415
|
* Atlanta, Georgia 30332-0415
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief exports NonlinearFactorGraph class to python
|
* @brief exports NonlinearFactorGraph class to python
|
||||||
* @author Andrew Melim
|
* @author Andrew Melim
|
||||||
* @author Ellon Paiva Mendes (LAAS-CNRS)
|
* @author Ellon Paiva Mendes (LAAS-CNRS)
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
@ -28,6 +28,13 @@ using namespace gtsam;
|
||||||
|
|
||||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(print_overloads, NonlinearFactorGraph::print, 0, 1);
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(print_overloads, NonlinearFactorGraph::print, 0, 1);
|
||||||
|
|
||||||
|
boost::shared_ptr<NonlinearFactor> getNonlinearFactor(
|
||||||
|
const NonlinearFactorGraph& graph, size_t idx) {
|
||||||
|
auto p = boost::dynamic_pointer_cast<NonlinearFactor>(graph.at(idx));
|
||||||
|
if (!p) throw std::runtime_error("No NonlinearFactor at requested index");
|
||||||
|
return p;
|
||||||
|
};
|
||||||
|
|
||||||
void exportNonlinearFactorGraph(){
|
void exportNonlinearFactorGraph(){
|
||||||
|
|
||||||
typedef NonlinearFactorGraph::sharedFactor sharedFactor;
|
typedef NonlinearFactorGraph::sharedFactor sharedFactor;
|
||||||
|
@ -36,7 +43,7 @@ void exportNonlinearFactorGraph(){
|
||||||
void (NonlinearFactorGraph::*add1)(const sharedFactor&) = &NonlinearFactorGraph::add;
|
void (NonlinearFactorGraph::*add1)(const sharedFactor&) = &NonlinearFactorGraph::add;
|
||||||
|
|
||||||
class_<NonlinearFactorGraph>("NonlinearFactorGraph", init<>())
|
class_<NonlinearFactorGraph>("NonlinearFactorGraph", init<>())
|
||||||
.def("size",&NonlinearFactorGraph::size)
|
.def("size",&NonlinearFactorGraph::size)
|
||||||
.def("push_back", push_back1)
|
.def("push_back", push_back1)
|
||||||
.def("add", add1)
|
.def("add", add1)
|
||||||
.def("resize", &NonlinearFactorGraph::resize)
|
.def("resize", &NonlinearFactorGraph::resize)
|
||||||
|
@ -44,4 +51,6 @@ void exportNonlinearFactorGraph(){
|
||||||
.def("print", &NonlinearFactorGraph::print, print_overloads(args("s")))
|
.def("print", &NonlinearFactorGraph::print, print_overloads(args("s")))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
def("getNonlinearFactor", getNonlinearFactor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue