#include "spline/bezier_curve.h" #include "spline/spline_curve.h" #include "spline/exact_cubic.h" #include "spline/spline_deriv_constraint.h" #include #include #include #include /*** TEMPLATE SPECIALIZATION FOR PYTHON ****/ typedef double real; typedef Eigen::Vector3d point_t; typedef Eigen::Matrix ret_point_t; typedef Eigen::VectorXd time_waypoints_t; typedef Eigen::Matrix point_list_t; typedef std::vector > t_point_t; typedef std::pair Waypoint; typedef std::vector T_Waypoint; typedef spline::bezier_curve bezier_t; typedef spline::spline_curve spline_curve_t; typedef spline::exact_cubic exact_cubic_t; typedef spline_curve_t::coeff_t coeff_t; typedef std::pair waypoint_t; typedef std::vector > t_waypoint_t; typedef spline::spline_deriv_constraint spline_deriv_constraint_t; typedef spline_deriv_constraint_t::spline_constraints spline_constraints_t; /*** TEMPLATE SPECIALIZATION FOR PYTHON ****/ EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(bezier_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(spline_curve_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(exact_cubic_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(spline_constraints_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(spline_deriv_constraint_t) namespace spline { using namespace boost::python; t_point_t vectorFromEigenArray(const point_list_t& array) { t_point_t res; for(int i =0;i(); eigenpy::enableEigenPySpecific(); eigenpy::enableEigenPySpecific(); eigenpy::enableEigenPySpecific(); /*eigenpy::exposeAngleAxis(); eigenpy::exposeQuaternion();*/ /** END eigenpy init**/ /** BEGIN bezier curve**/ class_ ("bezier", no_init) .def("__init__", make_constructor(&wrapBezierConstructor)) .def("__init__", make_constructor(&wrapBezierConstructorBounds)) .def("min", &bezier_t::min) .def("max", &bezier_t::max) .def("__call__", &bezier_t::operator()) .def("derivate", &bezier_t::derivate) .def("compute_derivate", &bezier_t::compute_derivate) ; /** END bezier curve**/ /** BEGIN spline curve function**/ class_("spline", init()) .def("__init__", make_constructor(&wrapSplineConstructor)) .def("min", &spline_curve_t::min) .def("max", &spline_curve_t::max) .def("__call__", &spline_curve_t::operator()) .def("derivate", &spline_curve_t::derivate) ; /** END cubic function**/ /** BEGIN exact_cubic curve**/ class_ ("exact_cubic", no_init) .def("__init__", make_constructor(&wrapExactCubicConstructor)) .def("min", &exact_cubic_t::min) .def("max", &exact_cubic_t::max) .def("__call__", &exact_cubic_t::operator()) .def("derivate", &exact_cubic_t::derivate) ; /** END bezier curve**/ /** BEGIN spline constraints**/ class_ ("spline_constraints", init<>()) .add_property("init_vel", &get_init_vel, &set_init_vel) .add_property("init_acc", &get_init_acc, &set_init_acc) .add_property("end_vel", &get_end_vel, &set_end_vel) .add_property("end_acc", &get_end_acc, &set_end_acc) ; /** END spline constraints**/ /** BEGIN spline_deriv_constraints**/ class_ ("spline_deriv_constraint", no_init) .def("__init__", make_constructor(&wrapSplineDerivConstraint)) .def("__init__", make_constructor(&wrapSplineDerivConstraintNoConstraints)) .def("min", &exact_cubic_t::min) .def("max", &exact_cubic_t::max) .def("__call__", &exact_cubic_t::operator()) .def("derivate", &exact_cubic_t::derivate) ; /** END spline_deriv_constraints**/ } } // namespace spline