Skip to content
Snippets Groups Projects
Commit edf6cbc9 authored by JasonChmn's avatar JasonChmn Committed by Pierre Fernbach
Browse files

[python binding] Edit name of all curves of dimension 3 / delete bezier dimension 6

parent b6633721
No related branches found
No related tags found
No related merge requests found
......@@ -21,50 +21,45 @@
/*** TEMPLATE SPECIALIZATION FOR PYTHON ****/
using namespace curves;
typedef double real;
typedef Eigen::Vector3d point_t;
typedef Eigen::Vector3d point3_t;
typedef Eigen::Vector3d tangent_t;
typedef std::pair<point_t, tangent_t> pair_point_tangent_t;
typedef Eigen::Matrix<double, 6, 1, 0, 6, 1> point6_t;
typedef Eigen::Matrix<double, 3, 1, 0, 3, 1> ret_point_t;
typedef Eigen::Matrix<double, 6, 1, 0, 6, 1> ret_point6_t;
typedef std::pair<point3_t, tangent_t> pair_point3_tangent_t;
typedef Eigen::Matrix<double, 3, 1, 0, 3, 1> ret_point3_t;
typedef Eigen::VectorXd time_waypoints_t;
typedef Eigen::Matrix<real, 3, Eigen::Dynamic> point_list_t;
typedef Eigen::Matrix<real, 6, Eigen::Dynamic> point_list6_t;
typedef std::vector<point_t,Eigen::aligned_allocator<point_t> > t_point_t;
typedef std::vector<point6_t,Eigen::aligned_allocator<point6_t> > t_point6_t;
typedef std::pair<real, point_t> Waypoint;
typedef std::vector<point3_t,Eigen::aligned_allocator<point3_t> > t_point3_t;
typedef std::pair<real, point3_t> Waypoint;
typedef std::vector<Waypoint> T_Waypoint;
typedef std::pair<real, point6_t> Waypoint6;
typedef std::vector<Waypoint6> T_Waypoint6;
typedef std::vector<pair_point_tangent_t,Eigen::aligned_allocator<pair_point_tangent_t> > t_pair_point_tangent_t;
typedef curves::bezier_curve <real, real, 3, true, point_t> bezier3_t;
typedef curves::bezier_curve <real, real, 6, true, point6_t> bezier6_t;
typedef curves::polynomial <real, real, 3, true, point_t, t_point_t> polynomial_t;
typedef curves::exact_cubic <real, real, 3, true, point_t, t_point_t> exact_cubic_t;
typedef curves::cubic_hermite_spline <real, real, 3, true, point_t> cubic_hermite_spline_t;
typedef polynomial_t::coeff_t coeff_t;
typedef std::pair<real, point_t> waypoint_t;
typedef std::vector<waypoint_t, Eigen::aligned_allocator<point_t> > t_waypoint_t;
typedef curves::piecewise_curve <real, real, 3, true, point_t, t_point_t, polynomial_t> piecewise_polynomial_curve_t;
typedef curves::piecewise_curve <real, real, 3, true, point_t, t_point_t, bezier3_t> piecewise_bezier3_curve_t;
typedef curves::piecewise_curve <real, real, 6, true, point6_t, t_point6_t, bezier6_t> piecewise_bezier6_curve_t;
typedef curves::piecewise_curve <real, real, 3, true, point_t, t_point_t, cubic_hermite_spline_t> piecewise_cubic_hermite_curve_t;
typedef std::vector<pair_point3_tangent_t,Eigen::aligned_allocator<pair_point3_tangent_t> > t_pair_point3_tangent_t;
typedef curves::bezier_curve <real, real, 3, true, point3_t> bezier3_t;
typedef curves::polynomial <real, real, 3, true, point3_t, t_point3_t> polynomial3_t;
typedef curves::exact_cubic <real, real, 3, true, point3_t, t_point3_t> exact_cubic3_t;
typedef curves::cubic_hermite_spline <real, real, 3, true, point3_t> cubic_hermite_spline3_t;
typedef polynomial3_t::coeff_t coeff_t;
typedef std::pair<real, point3_t> waypoint3_t;
typedef std::vector<waypoint3_t, Eigen::aligned_allocator<point3_t> > t_waypoint3_t;
typedef curves::piecewise_curve <real, real, 3, true, point3_t, t_point3_t, polynomial3_t> piecewise_polynomial3_curve_t;
typedef curves::piecewise_curve <real, real, 3, true, point3_t, t_point3_t, bezier3_t> piecewise_bezier3_curve_t;
typedef curves::piecewise_curve <real, real, 3, true, point3_t, t_point3_t, cubic_hermite_spline3_t> piecewise_cubic_hermite3_curve_t;
typedef curves::Bern<double> bernstein_t;
typedef curves::curve_constraints<point_t> curve_constraints_t;
typedef curves::curve_constraints<point6_t> curve_constraints6_t;
typedef curves::curve_constraints<point3_t> curve_constraints3_t;
/*** TEMPLATE SPECIALIZATION FOR PYTHON ****/
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(bernstein_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(bezier3_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(bezier6_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(polynomial_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(exact_cubic_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(cubic_hermite_spline_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(curve_constraints_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(polynomial3_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(exact_cubic3_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(cubic_hermite_spline3_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(curve_constraints3_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(piecewise_polynomial3_curve_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(piecewise_bezier3_curve_t)
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(piecewise_cubic_hermite3_curve_t)
namespace curves
{
......@@ -90,91 +85,71 @@ namespace curves
/*3D constructors bezier */
bezier3_t* wrapBezierConstructor3(const point_list_t& array)
{
return wrapBezierConstructorTemplate<bezier3_t, point_list_t, t_point_t>(array) ;
return wrapBezierConstructorTemplate<bezier3_t, point_list_t, t_point3_t>(array) ;
}
bezier3_t* wrapBezierConstructorBounds3(const point_list_t& array, const real T_min, const real T_max)
{
return wrapBezierConstructorTemplate<bezier3_t, point_list_t, t_point_t>(array, T_min, T_max) ;
return wrapBezierConstructorTemplate<bezier3_t, point_list_t, t_point3_t>(array, T_min, T_max) ;
}
bezier3_t* wrapBezierConstructor3Constraints(const point_list_t& array, const curve_constraints_t& constraints)
bezier3_t* wrapBezierConstructor3Constraints(const point_list_t& array, const curve_constraints3_t& constraints)
{
return wrapBezierConstructorConstraintsTemplate<bezier3_t, point_list_t, t_point_t, curve_constraints_t>(array, constraints) ;
return wrapBezierConstructorConstraintsTemplate<bezier3_t, point_list_t, t_point3_t, curve_constraints3_t>(array, constraints) ;
}
bezier3_t* wrapBezierConstructorBounds3Constraints(const point_list_t& array, const curve_constraints_t& constraints,
bezier3_t* wrapBezierConstructorBounds3Constraints(const point_list_t& array, const curve_constraints3_t& constraints,
const real T_min, const real T_max)
{
return wrapBezierConstructorConstraintsTemplate<bezier3_t, point_list_t, t_point_t, curve_constraints_t>(array, constraints,
return wrapBezierConstructorConstraintsTemplate<bezier3_t, point_list_t, t_point3_t, curve_constraints3_t>(array, constraints,
T_min, T_max) ;
}
/*END 3D constructors bezier */
/*6D constructors bezier */
bezier6_t* wrapBezierConstructor6(const point_list6_t& array)
{
return wrapBezierConstructorTemplate<bezier6_t, point_list6_t, t_point6_t>(array) ;
}
bezier6_t* wrapBezierConstructorBounds6(const point_list6_t& array, const real T_min, const real T_max)
{
return wrapBezierConstructorTemplate<bezier6_t, point_list6_t, t_point6_t>(array, T_min, T_max) ;
}
bezier6_t* wrapBezierConstructor6Constraints(const point_list6_t& array, const curve_constraints6_t& constraints)
{
return wrapBezierConstructorConstraintsTemplate<bezier6_t, point_list6_t, t_point6_t, curve_constraints6_t>(array, constraints) ;
}
bezier6_t* wrapBezierConstructorBounds6Constraints(const point_list6_t& array, const curve_constraints6_t& constraints,
const real T_min, const real T_max)
{
return wrapBezierConstructorConstraintsTemplate<bezier6_t, point_list6_t, t_point6_t, curve_constraints6_t>(array, constraints,
T_min, T_max) ;
}
/*END 6D constructors bezier */
/* Wrap Cubic hermite spline */
t_pair_point_tangent_t getPairsPointTangent(const point_list_t& points, const point_list_t& tangents)
t_pair_point3_tangent_t getPairsPointTangent(const point_list_t& points, const point_list_t& tangents)
{
t_pair_point_tangent_t res;
t_pair_point3_tangent_t res;
if (points.size() != tangents.size())
{
throw std::length_error("size of points and tangents must be the same");
}
for(int i =0;i<points.cols();++i)
{
res.push_back(pair_point_tangent_t(tangents.col(i), tangents.col(i)));
res.push_back(pair_point3_tangent_t(tangents.col(i), tangents.col(i)));
}
return res;
}
cubic_hermite_spline_t* wrapCubicHermiteSplineConstructor(const point_list_t& points, const point_list_t& tangents,
cubic_hermite_spline3_t* wrapCubicHermiteSplineConstructor(const point_list_t& points, const point_list_t& tangents,
const time_waypoints_t& time_pts)
{
t_pair_point_tangent_t ppt = getPairsPointTangent(points, tangents);
t_pair_point3_tangent_t ppt = getPairsPointTangent(points, tangents);
std::vector<real> time_control_pts;
for( int i =0; i<time_pts.size(); ++i)
{
time_control_pts.push_back(time_pts[i]);
}
return new cubic_hermite_spline_t(ppt.begin(), ppt.end(), time_control_pts);
return new cubic_hermite_spline3_t(ppt.begin(), ppt.end(), time_control_pts);
}
/* End wrap Cubic hermite spline */
/* Wrap polynomial */
polynomial_t* wrapSplineConstructor1(const coeff_t& array, const real min, const real max)
polynomial3_t* wrapPolynomial3Constructor1(const coeff_t& array, const real min, const real max)
{
return new polynomial_t(array, min, max);
return new polynomial3_t(array, min, max);
}
polynomial_t* wrapSplineConstructor2(const coeff_t& array)
polynomial3_t* wrapPolynomial3Constructor2(const coeff_t& array)
{
return new polynomial_t(array, 0., 1.);
return new polynomial3_t(array, 0., 1.);
}
/* End wrap polynomial */
/* Wrap piecewise curve */
piecewise_polynomial_curve_t* wrapPiecewisePolynomialCurveConstructor(const polynomial_t& pol)
piecewise_polynomial3_curve_t* wrapPiecewisePolynomial3CurveConstructor(const polynomial3_t& pol)
{
return new piecewise_polynomial_curve_t(pol);
return new piecewise_polynomial3_curve_t(pol);
}
piecewise_polynomial_curve_t* wrapPiecewisePolynomialCurveEmptyConstructor()
piecewise_polynomial3_curve_t* wrapPiecewisePolynomial3CurveEmptyConstructor()
{
return new piecewise_polynomial_curve_t();
return new piecewise_polynomial3_curve_t();
}
piecewise_bezier3_curve_t* wrapPiecewiseBezier3CurveConstructor(const bezier3_t& bc)
{
......@@ -184,28 +159,20 @@ namespace curves
{
return new piecewise_bezier3_curve_t();
}
piecewise_bezier6_curve_t* wrapPiecewiseBezier6CurveConstructor(const bezier6_t& bc)
{
return new piecewise_bezier6_curve_t(bc);
}
piecewise_bezier6_curve_t* wrapPiecewiseBezier6CurveEmptyConstructor()
{
return new piecewise_bezier6_curve_t();
}
piecewise_cubic_hermite_curve_t* wrapPiecewiseCubicHermiteCurveConstructor(const cubic_hermite_spline_t& ch)
piecewise_cubic_hermite3_curve_t* wrapPiecewiseCubicHermite3CurveConstructor(const cubic_hermite_spline3_t& ch)
{
return new piecewise_cubic_hermite_curve_t(ch);
return new piecewise_cubic_hermite3_curve_t(ch);
}
piecewise_cubic_hermite_curve_t* wrapPiecewiseCubicHermiteCurveEmptyConstructor()
piecewise_cubic_hermite3_curve_t* wrapPiecewiseCubicHermite3CurveEmptyConstructor()
{
return new piecewise_cubic_hermite_curve_t();
return new piecewise_cubic_hermite3_curve_t();
}
/* end wrap piecewise polynomial curve */
/* Wrap exact cubic spline */
t_waypoint_t getWayPoints(const coeff_t& array, const time_waypoints_t& time_wp)
t_waypoint3_t getWayPoints(const coeff_t& array, const time_waypoints_t& time_wp)
{
t_waypoint_t res;
t_waypoint3_t res;
for(int i =0;i<array.cols();++i)
{
res.push_back(std::make_pair(time_wp(i), array.col(i)));
......@@ -228,55 +195,55 @@ namespace curves
return res;
}
exact_cubic_t* wrapExactCubicConstructor(const coeff_t& array, const time_waypoints_t& time_wp)
exact_cubic3_t* wrapExactCubic3Constructor(const coeff_t& array, const time_waypoints_t& time_wp)
{
t_waypoint_t wps = getWayPoints(array, time_wp);
return new exact_cubic_t(wps.begin(), wps.end());
t_waypoint3_t wps = getWayPoints(array, time_wp);
return new exact_cubic3_t(wps.begin(), wps.end());
}
exact_cubic_t* wrapExactCubicConstructorConstraint(const coeff_t& array, const time_waypoints_t& time_wp,
const curve_constraints_t& constraints)
exact_cubic3_t* wrapExactCubic3ConstructorConstraint(const coeff_t& array, const time_waypoints_t& time_wp,
const curve_constraints3_t& constraints)
{
t_waypoint_t wps = getWayPoints(array, time_wp);
return new exact_cubic_t(wps.begin(), wps.end(), constraints);
t_waypoint3_t wps = getWayPoints(array, time_wp);
return new exact_cubic3_t(wps.begin(), wps.end(), constraints);
}
point_t get_init_vel(const curve_constraints_t& c)
point3_t get_init_vel(const curve_constraints3_t& c)
{
return c.init_vel;
}
point_t get_init_acc(const curve_constraints_t& c)
point3_t get_init_acc(const curve_constraints3_t& c)
{
return c.init_acc;
}
point_t get_end_vel(const curve_constraints_t& c)
point3_t get_end_vel(const curve_constraints3_t& c)
{
return c.end_vel;
}
point_t get_end_acc(const curve_constraints_t& c)
point3_t get_end_acc(const curve_constraints3_t& c)
{
return c.end_acc;
}
void set_init_vel(curve_constraints_t& c, const point_t& val)
void set_init_vel(curve_constraints3_t& c, const point3_t& val)
{
c.init_vel = val;
}
void set_init_acc(curve_constraints_t& c, const point_t& val)
void set_init_acc(curve_constraints3_t& c, const point3_t& val)
{
c.init_acc = val;
}
void set_end_vel(curve_constraints_t& c, const point_t& val)
void set_end_vel(curve_constraints3_t& c, const point3_t& val)
{
c.end_vel = val;
}
void set_end_acc(curve_constraints_t& c, const point_t& val)
void set_end_acc(curve_constraints3_t& c, const point3_t& val)
{
c.end_acc = val;
}
......@@ -289,40 +256,14 @@ namespace curves
{
/** BEGIN eigenpy init**/
eigenpy::enableEigenPy();
eigenpy::enableEigenPySpecific<point_t,point_t>();
eigenpy::enableEigenPySpecific<ret_point_t,ret_point_t>();
eigenpy::enableEigenPySpecific<point3_t,point3_t>();
eigenpy::enableEigenPySpecific<ret_point3_t,ret_point3_t>();
eigenpy::enableEigenPySpecific<point_list_t,point_list_t>();
eigenpy::enableEigenPySpecific<point6_t,point6_t>();
eigenpy::enableEigenPySpecific<ret_point6_t,ret_point6_t>();
eigenpy::enableEigenPySpecific<point_list6_t,point_list6_t>();
eigenpy::enableEigenPySpecific<coeff_t,coeff_t>();
/*eigenpy::exposeAngleAxis();
eigenpy::exposeQuaternion();*/
/** END eigenpy init**/
/** BEGIN bezier curve 6**/
class_<bezier6_t>("bezier6", init<>())
.def("__init__", make_constructor(&wrapBezierConstructor6))
.def("__init__", make_constructor(&wrapBezierConstructorBounds6))
//.def("__init__", make_constructor(&wrapBezierConstructor6Constraints))
//.def("__init__", make_constructor(&wrapBezierConstructorBounds6Constraints))
.def("min", &bezier6_t::min)
.def("max", &bezier6_t::max)
.def("__call__", &bezier6_t::operator())
.def("derivate", &bezier6_t::derivate)
.def("compute_derivate", &bezier6_t::compute_derivate)
.def("compute_primitive", &bezier6_t::compute_primitive)
.def("waypoints", &wayPointsToList<bezier6_t,6>)
.def("saveAsText", &bezier6_t::saveAsText<bezier6_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&bezier6_t::loadFromText<bezier6_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&bezier6_t::saveAsXML<bezier6_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&bezier6_t::loadFromXML<bezier6_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&bezier6_t::saveAsBinary<bezier6_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&bezier6_t::loadFromBinary<bezier6_t>,bp::args("filename"),"Loads *this from a binary file.")
.def_readonly("degree", &bezier6_t::degree_)
.def_readonly("nbWaypoints", &bezier6_t::size_)
//.def(SerializableVisitor<bezier6_t>())
;
/** END bezier curve**/
/** BEGIN bezier curve**/
class_<bezier3_t>("bezier3", init<>())
.def("__init__", make_constructor(&wrapBezierConstructor3))
......@@ -374,50 +315,50 @@ namespace curves
;
/** END variable points bezier curve**/
/** BEGIN polynomial curve function**/
class_<polynomial_t>("polynomial", init<>())
.def("__init__", make_constructor(&wrapSplineConstructor1),
class_<polynomial3_t>("polynomial3", init<>())
.def("__init__", make_constructor(&wrapPolynomial3Constructor1),
"Create polynomial spline from an Eigen matrix of coefficient defined for t \in [min,max]."
" The matrix should contain one coefficient per column, from the zero order coefficient,up to the highest order."
" Spline order is given by the number of the columns -1.")
.def("__init__", make_constructor(&wrapSplineConstructor2),
.def("__init__", make_constructor(&wrapPolynomial3Constructor2),
"Create polynomial spline from an Eigen matrix of coefficient defined for t \in [0,1]."
" The matrix should contain one coefficient per column, from the zero order coefficient,up to the highest order."
" Spline order is given by the number of the columns -1.")
.def("min", &polynomial_t::min, "Get the LOWER bound on interval definition of the curve.")
.def("max", &polynomial_t::max,"Get the HIGHER bound on interval definition of the curve.")
.def("__call__", &polynomial_t::operator(),"Evaluate the spline at the given time.")
.def("derivate", &polynomial_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("compute_derivate", &polynomial_t::compute_derivate,"Compute derivative of order N of curve at time t.")
.def("saveAsText", &polynomial_t::saveAsText<polynomial_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&polynomial_t::loadFromText<polynomial_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&polynomial_t::saveAsXML<polynomial_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&polynomial_t::loadFromXML<polynomial_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&polynomial_t::saveAsBinary<polynomial_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&polynomial_t::loadFromBinary<polynomial_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<polynomial_t>())
.def("min", &polynomial3_t::min, "Get the LOWER bound on interval definition of the curve.")
.def("max", &polynomial3_t::max,"Get the HIGHER bound on interval definition of the curve.")
.def("__call__", &polynomial3_t::operator(),"Evaluate the spline at the given time.")
.def("derivate", &polynomial3_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("compute_derivate", &polynomial3_t::compute_derivate,"Compute derivative of order N of curve at time t.")
.def("saveAsText", &polynomial3_t::saveAsText<polynomial3_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&polynomial3_t::loadFromText<polynomial3_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&polynomial3_t::saveAsXML<polynomial3_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&polynomial3_t::loadFromXML<polynomial3_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&polynomial3_t::saveAsBinary<polynomial3_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&polynomial3_t::loadFromBinary<polynomial3_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<polynomial3_t>())
;
/** END polynomial function**/
/** BEGIN piecewise curve function **/
class_<piecewise_polynomial_curve_t>
("piecewise_polynomial_curve", init<>())
.def("__init__", make_constructor(&wrapPiecewisePolynomialCurveConstructor),
class_<piecewise_polynomial3_curve_t>
("piecewise_polynomial3_curve", init<>())
.def("__init__", make_constructor(&wrapPiecewisePolynomial3CurveConstructor),
"Create a peicewise-polynomial curve containing the given polynomial curve.")
.def("min", &piecewise_polynomial_curve_t::min,"Set the LOWER bound on interval definition of the curve.")
.def("max", &piecewise_polynomial_curve_t::max,"Set the HIGHER bound on interval definition of the curve.")
.def("__call__", &piecewise_polynomial_curve_t::operator(),"Evaluate the curve at the given time.")
.def("derivate", &piecewise_polynomial_curve_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("add_curve", &piecewise_polynomial_curve_t::add_curve,
.def("min", &piecewise_polynomial3_curve_t::min,"Set the LOWER bound on interval definition of the curve.")
.def("max", &piecewise_polynomial3_curve_t::max,"Set the HIGHER bound on interval definition of the curve.")
.def("__call__", &piecewise_polynomial3_curve_t::operator(),"Evaluate the curve at the given time.")
.def("derivate", &piecewise_polynomial3_curve_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("add_curve", &piecewise_polynomial3_curve_t::add_curve,
"Add a new curve to piecewise curve, which should be defined in T_{min},T_{max}] "
"where T_{min} is equal toT_{max} of the actual piecewise curve.")
.def("is_continuous", &piecewise_polynomial_curve_t::is_continuous,"Check if the curve is continuous at the given order.")
.def("saveAsText", &piecewise_polynomial_curve_t::saveAsText<piecewise_polynomial_curve_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&piecewise_polynomial_curve_t::loadFromText<piecewise_polynomial_curve_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&piecewise_polynomial_curve_t::saveAsXML<piecewise_polynomial_curve_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&piecewise_polynomial_curve_t::loadFromXML<piecewise_polynomial_curve_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&piecewise_polynomial_curve_t::saveAsBinary<piecewise_polynomial_curve_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&piecewise_polynomial_curve_t::loadFromBinary<piecewise_polynomial_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_polynomial_curve_t>())
.def("is_continuous", &piecewise_polynomial3_curve_t::is_continuous,"Check if the curve is continuous at the given order.")
.def("saveAsText", &piecewise_polynomial3_curve_t::saveAsText<piecewise_polynomial3_curve_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&piecewise_polynomial3_curve_t::loadFromText<piecewise_polynomial3_curve_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&piecewise_polynomial3_curve_t::saveAsXML<piecewise_polynomial3_curve_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&piecewise_polynomial3_curve_t::loadFromXML<piecewise_polynomial3_curve_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&piecewise_polynomial3_curve_t::saveAsBinary<piecewise_polynomial3_curve_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&piecewise_polynomial3_curve_t::loadFromBinary<piecewise_polynomial3_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_polynomial3_curve_t>())
;
class_<piecewise_bezier3_curve_t>
("piecewise_bezier3_curve", init<>())
......@@ -436,81 +377,64 @@ namespace curves
.def("loadFromBinary",&piecewise_bezier3_curve_t::loadFromBinary<piecewise_bezier3_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_bezier3_curve_t>())
;
class_<piecewise_bezier6_curve_t>
("piecewise_bezier6_curve", init<>())
.def("__init__", make_constructor(&wrapPiecewiseBezier6CurveConstructor))
.def("min", &piecewise_bezier6_curve_t::min)
.def("max", &piecewise_bezier6_curve_t::max)
.def("__call__", &piecewise_bezier6_curve_t::operator())
.def("derivate", &piecewise_bezier6_curve_t::derivate)
.def("add_curve", &piecewise_bezier6_curve_t::add_curve)
.def("is_continuous", &piecewise_bezier6_curve_t::is_continuous)
.def("saveAsText", &piecewise_bezier6_curve_t::saveAsText<piecewise_bezier6_curve_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&piecewise_bezier6_curve_t::loadFromText<piecewise_bezier6_curve_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&piecewise_bezier6_curve_t::saveAsXML<piecewise_bezier6_curve_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&piecewise_bezier6_curve_t::loadFromXML<piecewise_bezier6_curve_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&piecewise_bezier6_curve_t::saveAsBinary<piecewise_bezier6_curve_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&piecewise_bezier6_curve_t::loadFromBinary<piecewise_bezier6_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_bezier6_curve_t>())
;
class_<piecewise_cubic_hermite_curve_t>
("piecewise_cubic_hermite_curve", init<>())
.def("__init__", make_constructor(&wrapPiecewiseCubicHermiteCurveConstructor))
.def("min", &piecewise_cubic_hermite_curve_t::min)
.def("max", &piecewise_cubic_hermite_curve_t::max)
.def("__call__", &piecewise_cubic_hermite_curve_t::operator())
.def("derivate", &piecewise_cubic_hermite_curve_t::derivate)
.def("add_curve", &piecewise_cubic_hermite_curve_t::add_curve)
.def("is_continuous", &piecewise_cubic_hermite_curve_t::is_continuous)
.def("saveAsText", &piecewise_cubic_hermite_curve_t::saveAsText<piecewise_cubic_hermite_curve_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&piecewise_cubic_hermite_curve_t::loadFromText<piecewise_cubic_hermite_curve_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&piecewise_cubic_hermite_curve_t::saveAsXML<piecewise_cubic_hermite_curve_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&piecewise_cubic_hermite_curve_t::loadFromXML<piecewise_cubic_hermite_curve_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&piecewise_cubic_hermite_curve_t::saveAsBinary<piecewise_cubic_hermite_curve_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&piecewise_cubic_hermite_curve_t::loadFromBinary<piecewise_cubic_hermite_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_cubic_hermite_curve_t>())
class_<piecewise_cubic_hermite3_curve_t>
("piecewise_cubic_hermite3_curve", init<>())
.def("__init__", make_constructor(&wrapPiecewiseCubicHermite3CurveConstructor))
.def("min", &piecewise_cubic_hermite3_curve_t::min)
.def("max", &piecewise_cubic_hermite3_curve_t::max)
.def("__call__", &piecewise_cubic_hermite3_curve_t::operator())
.def("derivate", &piecewise_cubic_hermite3_curve_t::derivate)
.def("add_curve", &piecewise_cubic_hermite3_curve_t::add_curve)
.def("is_continuous", &piecewise_cubic_hermite3_curve_t::is_continuous)
.def("saveAsText", &piecewise_cubic_hermite3_curve_t::saveAsText<piecewise_cubic_hermite3_curve_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&piecewise_cubic_hermite3_curve_t::loadFromText<piecewise_cubic_hermite3_curve_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&piecewise_cubic_hermite3_curve_t::saveAsXML<piecewise_cubic_hermite3_curve_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&piecewise_cubic_hermite3_curve_t::loadFromXML<piecewise_cubic_hermite3_curve_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&piecewise_cubic_hermite3_curve_t::saveAsBinary<piecewise_cubic_hermite3_curve_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&piecewise_cubic_hermite3_curve_t::loadFromBinary<piecewise_cubic_hermite3_curve_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<piecewise_cubic_hermite3_curve_t>())
;
/** END piecewise curve function **/
/** BEGIN exact_cubic curve**/
class_<exact_cubic_t>
("exact_cubic", init<>())
.def("__init__", make_constructor(&wrapExactCubicConstructor))
.def("__init__", make_constructor(&wrapExactCubicConstructorConstraint))
.def("min", &exact_cubic_t::min)
.def("max", &exact_cubic_t::max)
.def("__call__", &exact_cubic_t::operator())
.def("derivate", &exact_cubic_t::derivate)
.def("getNumberSplines", &exact_cubic_t::getNumberSplines)
.def("getSplineAt", &exact_cubic_t::getSplineAt)
.def("saveAsText", &exact_cubic_t::saveAsText<exact_cubic_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&exact_cubic_t::loadFromText<exact_cubic_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&exact_cubic_t::saveAsXML<exact_cubic_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&exact_cubic_t::loadFromXML<exact_cubic_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&exact_cubic_t::saveAsBinary<exact_cubic_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&exact_cubic_t::loadFromBinary<exact_cubic_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<exact_cubic_t>())
class_<exact_cubic3_t>
("exact_cubic3", init<>())
.def("__init__", make_constructor(&wrapExactCubic3Constructor))
.def("__init__", make_constructor(&wrapExactCubic3ConstructorConstraint))
.def("min", &exact_cubic3_t::min)
.def("max", &exact_cubic3_t::max)
.def("__call__", &exact_cubic3_t::operator())
.def("derivate", &exact_cubic3_t::derivate)
.def("getNumberSplines", &exact_cubic3_t::getNumberSplines)
.def("getSplineAt", &exact_cubic3_t::getSplineAt)
.def("saveAsText", &exact_cubic3_t::saveAsText<exact_cubic3_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&exact_cubic3_t::loadFromText<exact_cubic3_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&exact_cubic3_t::saveAsXML<exact_cubic3_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&exact_cubic3_t::loadFromXML<exact_cubic3_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&exact_cubic3_t::saveAsBinary<exact_cubic3_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&exact_cubic3_t::loadFromBinary<exact_cubic3_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<exact_cubic3_t>())
;
/** END exact_cubic curve**/
/** BEGIN cubic_hermite_spline **/
class_<cubic_hermite_spline_t>
("cubic_hermite_spline", init<>())
class_<cubic_hermite_spline3_t>
("cubic_hermite_spline3", init<>())
.def("__init__", make_constructor(&wrapCubicHermiteSplineConstructor))
.def("min", &cubic_hermite_spline_t::min)
.def("max", &cubic_hermite_spline_t::max)
.def("__call__", &cubic_hermite_spline_t::operator())
.def("derivate", &cubic_hermite_spline_t::derivate)
.def("saveAsText", &cubic_hermite_spline_t::saveAsText<cubic_hermite_spline_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&cubic_hermite_spline_t::loadFromText<cubic_hermite_spline_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&cubic_hermite_spline_t::saveAsXML<cubic_hermite_spline_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&cubic_hermite_spline_t::loadFromXML<cubic_hermite_spline_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&cubic_hermite_spline_t::saveAsBinary<cubic_hermite_spline_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&cubic_hermite_spline_t::loadFromBinary<cubic_hermite_spline_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<cubic_hermite_spline_t>())
.def("min", &cubic_hermite_spline3_t::min)
.def("max", &cubic_hermite_spline3_t::max)
.def("__call__", &cubic_hermite_spline3_t::operator())
.def("derivate", &cubic_hermite_spline3_t::derivate)
.def("saveAsText", &cubic_hermite_spline3_t::saveAsText<cubic_hermite_spline3_t>,bp::args("filename"),"Saves *this inside a text file.")
.def("loadFromText",&cubic_hermite_spline3_t::loadFromText<cubic_hermite_spline3_t>,bp::args("filename"),"Loads *this from a text file.")
.def("saveAsXML",&cubic_hermite_spline3_t::saveAsXML<cubic_hermite_spline3_t>,bp::args("filename","tag_name"),"Saves *this inside a XML file.")
.def("loadFromXML",&cubic_hermite_spline3_t::loadFromXML<cubic_hermite_spline3_t>,bp::args("filename","tag_name"),"Loads *this from a XML file.")
.def("saveAsBinary",&cubic_hermite_spline3_t::saveAsBinary<cubic_hermite_spline3_t>,bp::args("filename"),"Saves *this inside a binary file.")
.def("loadFromBinary",&cubic_hermite_spline3_t::loadFromBinary<cubic_hermite_spline3_t>,bp::args("filename"),"Loads *this from a binary file.")
//.def(SerializableVisitor<cubic_hermite_spline3_t>())
;
/** END cubic_hermite_spline **/
/** BEGIN curve constraints**/
class_<curve_constraints_t>
("curve_constraints", init<>())
class_<curve_constraints3_t>
("curve_constraints3", 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)
......@@ -524,12 +448,12 @@ namespace curves
;
/** END bernstein polynomial**/
/** BEGIN curves conversion**/
def("polynomial_from_bezier", polynomial_from_curve<polynomial_t,bezier3_t>);
def("polynomial_from_hermite", polynomial_from_curve<polynomial_t,cubic_hermite_spline_t>);
def("bezier_from_hermite", bezier_from_curve<bezier3_t,cubic_hermite_spline_t>);
def("bezier_from_polynomial", bezier_from_curve<bezier3_t,polynomial_t>);
def("hermite_from_bezier", hermite_from_curve<cubic_hermite_spline_t, bezier3_t>);
def("hermite_from_polynomial", hermite_from_curve<cubic_hermite_spline_t, polynomial_t>);
def("polynomial_from_bezier", polynomial_from_curve<polynomial3_t,bezier3_t>);
def("polynomial_from_hermite", polynomial_from_curve<polynomial3_t,cubic_hermite_spline3_t>);
def("bezier_from_hermite", bezier_from_curve<bezier3_t,cubic_hermite_spline3_t>);
def("bezier_from_polynomial", bezier_from_curve<bezier3_t,polynomial3_t>);
def("hermite_from_bezier", hermite_from_curve<cubic_hermite_spline3_t, bezier3_t>);
def("hermite_from_polynomial", hermite_from_curve<cubic_hermite_spline3_t, polynomial3_t>);
/** END curves conversion**/
} // End BOOST_PYTHON_MODULE
} // namespace curves
......@@ -6,10 +6,12 @@ from numpy.linalg import norm
#from curves import ( serialize_polynomial, deserialize_polynomial, serialize_piecewise_polynomial_curve, deserialize_piecewise_polynomial_curve )
from curves import (bezier3, bezier6, bezier_from_hermite, bezier_from_polynomial, cubic_hermite_spline,
curve_constraints, exact_cubic, hermite_from_bezier, hermite_from_polynomial,
piecewise_bezier3_curve, piecewise_bezier6_curve, piecewise_cubic_hermite_curve,
piecewise_polynomial_curve, polynomial, polynomial_from_bezier, polynomial_from_hermite)
from curves import (bezier_from_hermite, bezier_from_polynomial, hermite_from_polynomial,
hermite_from_bezier, polynomial_from_hermite, polynomial_from_bezier,
cubic_hermite_spline3, curve_constraints3, exact_cubic3, bezier3,
piecewise_bezier3_curve, piecewise_cubic_hermite3_curve,
piecewise_polynomial3_curve, polynomial3
)
#import curves
......@@ -30,10 +32,8 @@ class TestCurves(unittest.TestCase):
self.assertTrue(norm(a(t) - matrix([1., 2., 3.]).T) < __EPS)
t += 0.1
waypoints = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
waypoints6 = matrix([[1., 2., 3., 7., 5., 5.], [4., 5., 6., 4., 5., 6.]]).transpose()
time_waypoints = matrix([0., 1.]).transpose()
# Create bezier6 and bezier3
a6 = bezier6(waypoints6)
a = bezier3(waypoints, 0., 3.)
# Test : Degree, min, max, derivate
#self.print_str(("test 1")
......@@ -71,7 +71,7 @@ class TestCurves(unittest.TestCase):
self.assertTrue(norm(prim0(t) - prim1(t * 3) / 3.) < __EPS)
self.assertTrue((prim(0) == matrix([0., 0., 0.])).all())
# testing bezier with constraints
c = curve_constraints()
c = curve_constraints3()
c.init_vel = matrix([0., 1., 1.]).transpose()
c.end_vel = matrix([0., 1., 1.]).transpose()
c.init_acc = matrix([0., 1., -1.]).transpose()
......@@ -88,12 +88,6 @@ class TestCurves(unittest.TestCase):
b = bezier3()
b.loadFromText("serialization_curve.test")
self.assertTrue((a(0.4) == b(0.4)).all())
# Test serialization : Bezier 6
a6.saveAsText("serialization_curve.test")
b6 = bezier6()
b6.loadFromText("serialization_curve.test")
self.assertTrue((a6(0.4) == b6(0.4)).all())
os.remove("serialization_curve.test")
return
......@@ -102,8 +96,8 @@ class TestCurves(unittest.TestCase):
# - Functions : constructor, min, max, derivate, serialize, deserialize
waypoints_0 = matrix([[0.,0.,0.], [0.,0.,0.]]).transpose()
waypoints = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
a = polynomial(waypoints) # Defined on [0.,1.]
a = polynomial(waypoints, -1., 3.) # Defined on [-1.,3.]
a = polynomial3(waypoints) # Defined on [0.,1.]
a = polynomial3(waypoints, -1., 3.) # Defined on [-1.,3.]
a.min()
a.max()
a(0.4)
......@@ -113,7 +107,7 @@ class TestCurves(unittest.TestCase):
self.assertTrue((a.derivate(0.4, 1) == a_derivated(0.4)).all())
# Test serialization
a.saveAsText("serialization_curve.test")
b = polynomial()
b = polynomial3()
b.loadFromText("serialization_curve.test")
self.assertTrue((a(0.4) == b(0.4)).all())
os.remove("serialization_curve.test")
......@@ -123,7 +117,7 @@ class TestCurves(unittest.TestCase):
points = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
tangents = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
time_points = matrix([0., 1.]).transpose()
a = cubic_hermite_spline(points, tangents, time_points)
a = cubic_hermite_spline3(points, tangents, time_points)
a.min()
a.max()
a(0.4)
......@@ -131,7 +125,7 @@ class TestCurves(unittest.TestCase):
a.derivate(0.4, 2)
# Test serialization
a.saveAsText("serialization_curve.test")
b = cubic_hermite_spline()
b = cubic_hermite_spline3()
b.loadFromText("serialization_curve.test")
self.assertTrue((a(0.4) == b(0.4)).all())
os.remove("serialization_curve.test")
......@@ -143,10 +137,10 @@ class TestCurves(unittest.TestCase):
waypoints0 = matrix([[0., 0., 0.]]).transpose()
waypoints1 = matrix([[1., 1., 1.]]).transpose()
waypoints2 = matrix([[1., 1., 1.], [1., 1., 1.]]).transpose()
pol0 = polynomial(waypoints0, 0., 0.1)
a = polynomial(waypoints1, 0., 1.)
b = polynomial(waypoints2, 1., 3.)
pc = piecewise_polynomial_curve(a)
pol0 = polynomial3(waypoints0, 0., 0.1)
a = polynomial3(waypoints1, 0., 1.)
b = polynomial3(waypoints2, 1., 3.)
pc = piecewise_polynomial3_curve(a)
pc.add_curve(b)
pc.min()
pc.max()
......@@ -157,7 +151,7 @@ class TestCurves(unittest.TestCase):
pc.is_continuous(1)
# Test serialization
pc.saveAsText("serialization_pc.test")
pc_test = piecewise_polynomial_curve()
pc_test = piecewise_polynomial3_curve()
pc_test.loadFromText("serialization_pc.test")
self.assertTrue((pc(0.4) == pc_test(0.4)).all())
os.remove("serialization_pc.test")
......@@ -186,29 +180,6 @@ class TestCurves(unittest.TestCase):
os.remove("serialization_pc.test")
return
def test_piecewise_bezier6_curve(self):
# To test :
# - Functions : constructor, min, max, derivate, add_curve, is_continuous
waypoints = matrix([[1., 2., 3., 7., 5., 5.], [4., 5., 6., 4., 5., 6.]]).transpose()
a = bezier6(waypoints, 0., 1.)
b = bezier6(waypoints, 1., 2.)
pc = piecewise_bezier6_curve(a)
pc.add_curve(b)
pc.min()
pc.max()
pc(0.4)
self.assertTrue((pc.derivate(0.4, 0) == pc(0.4)).all())
pc.derivate(0.4, 2)
pc.is_continuous(0)
pc.is_continuous(1)
# Test serialization
pc.saveAsText("serialization_pc.test")
pc_test = piecewise_bezier6_curve()
pc_test.loadFromText("serialization_pc.test")
self.assertTrue((pc(0.4) == pc_test(0.4)).all())
os.remove("serialization_pc.test")
return
def test_piecewise_cubic_hermite_curve(self):
# To test :
# - Functions : constructor, min, max, derivate, add_curve, is_continuous
......@@ -216,9 +187,9 @@ class TestCurves(unittest.TestCase):
tangents = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
time_points0 = matrix([0., 1.]).transpose()
time_points1 = matrix([1., 2.]).transpose()
a = cubic_hermite_spline(points, tangents, time_points0)
b = cubic_hermite_spline(points, tangents, time_points1)
pc = piecewise_cubic_hermite_curve(a)
a = cubic_hermite_spline3(points, tangents, time_points0)
b = cubic_hermite_spline3(points, tangents, time_points1)
pc = piecewise_cubic_hermite3_curve(a)
pc.add_curve(b)
pc.min()
pc.max()
......@@ -229,7 +200,7 @@ class TestCurves(unittest.TestCase):
pc.is_continuous(1)
# Test serialization
pc.saveAsText("serialization_pc.test")
pc_test = piecewise_cubic_hermite_curve()
pc_test = piecewise_cubic_hermite3_curve()
pc_test.loadFromText("serialization_pc.test")
self.assertTrue((pc(0.4) == pc_test(0.4)).all())
os.remove("serialization_pc.test")
......@@ -240,7 +211,7 @@ class TestCurves(unittest.TestCase):
# - Functions : constructor, min, max, derivate, getNumberSplines, getSplineAt
waypoints = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
time_waypoints = matrix([0., 1.]).transpose()
a = exact_cubic(waypoints, time_waypoints)
a = exact_cubic3(waypoints, time_waypoints)
a.min()
a.max()
a(0.4)
......@@ -250,7 +221,7 @@ class TestCurves(unittest.TestCase):
a.getSplineAt(0)
# Test serialization
a.saveAsText("serialization_pc.test")
b = exact_cubic()
b = exact_cubic3()
b.loadFromText("serialization_pc.test")
self.assertTrue((a(0.4) == b(0.4)).all())
os.remove("serialization_pc.test")
......@@ -261,7 +232,7 @@ class TestCurves(unittest.TestCase):
# - Functions : constructor, min, max, derivate
waypoints = matrix([[1., 2., 3.], [4., 5., 6.]]).transpose()
time_waypoints = matrix([0., 1.]).transpose()
c = curve_constraints()
c = curve_constraints3()
c.init_vel
c.end_vel
c.init_acc
......@@ -270,8 +241,8 @@ class TestCurves(unittest.TestCase):
c.end_vel = matrix([0., 1., 1.]).transpose()
c.init_acc = matrix([0., 1., 1.]).transpose()
c.end_acc = matrix([0., 1., 1.]).transpose()
a = exact_cubic(waypoints, time_waypoints)
a = exact_cubic(waypoints, time_waypoints, c)
a = exact_cubic3(waypoints, time_waypoints)
a = exact_cubic3(waypoints, time_waypoints, c)
return
def test_conversion_curves(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment