Commit 88ff7cce by JasonChmn Committed by Pierre Fernbach

### [dynamic dim - polynomial] Remove dim from template + binding python

parent c31bd106
 ... ... @@ -35,13 +35,12 @@ namespace curves return res; } template polynomial create_cubic(Point const& a, Point const& b, Point const& c, Point const &d, const Time t_min, const Time t_max) template polynomial create_cubic(Point const& a, Point const& b, Point const& c, Point const &d, const Time t_min, const Time t_max) { T_Point coeffs = make_cubic_vector(a,b,c,d); return polynomial(coeffs.begin(),coeffs.end(), t_min, t_max); return polynomial(coeffs.begin(),coeffs.end(), t_min, t_max); } } // namespace curves #endif //_STRUCT_CUBICSPLINE ... ...
 ... ... @@ -40,7 +40,7 @@ namespace curves template, typename T_Point =std::vector >, typename SplineBase=polynomial > typename SplineBase=polynomial > struct exact_cubic : public piecewise_curve { typedef Point point_t; ... ... @@ -182,9 +182,9 @@ namespace curves for(int i=0; next != wayPointsEnd; ++i, ++it, ++next) { subSplines.push_back( create_cubic(a.row(i), b.row(i), c.row(i), d.row(i), (*it).first, (*next).first)); create_cubic(a.row(i), b.row(i), c.row(i), d.row(i), (*it).first, (*next).first)); } return subSplines; } ... ... @@ -218,7 +218,7 @@ namespace curves const num_t& init_t = wayPointsBegin->first, end_t = wayPointsNext->first; const num_t dt = end_t - init_t, dt_2 = dt * dt, dt_3 = dt_2 * dt; const point_t d0 = (a1 - a0 - b0 * dt - c0 * dt_2) / dt_3; subSplines.push_back(create_cubic(a0,b0,c0,d0,init_t, end_t)); subSplines.push_back(create_cubic(a0,b0,c0,d0,init_t, end_t)); constraints.init_vel = subSplines.back().derivate(end_t, 1); constraints.init_acc = subSplines.back().derivate(end_t, 2); } ... ... @@ -247,7 +247,7 @@ namespace curves eq(2,0) = x_d_2; eq(2,1) = x_e_2; eq(2,2) = x_f_2; rhs = eq.inverse().eval() * rhs; d = rhs.row(0); e = rhs.row(1); f = rhs.row(2); subSplines.push_back(create_quintic(a0,b0,c0,d,e,f, init_t, end_t)); subSplines.push_back(create_quintic(a0,b0,c0,d,e,f, init_t, end_t)); } public: ... ...
 ... ... @@ -31,7 +31,7 @@ namespace curves /// \f$x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N \f$
/// where N is the order and \f$t \in [t_{min}, t_{max}] \f$. /// template, typename T_Point =std::vector > > struct polynomial : public curve_abc { ... ... @@ -40,16 +40,16 @@ namespace curves typedef Time time_t; typedef Numeric num_t; typedef curve_abc curve_abc_t; typedef Eigen::Matrix coeff_t; typedef Eigen::MatrixXd coeff_t; typedef Eigen::Ref coeff_t_ref; typedef polynomial polynomial_t; typedef polynomial polynomial_t; /* Constructors - destructors */ public: /// \brief Empty constructor. Curve obtained this way can not perform other class functions. /// polynomial() : T_min_(0), T_max_(0) : curve_abc_t(), dim_(0), T_min_(0), T_max_(0) {} /// \brief Constructor. ... ... @@ -60,8 +60,9 @@ namespace curves /// \param max : UPPER bound on interval definition of the curve. polynomial(const coeff_t& coefficients, const time_t min, const time_t max) : curve_abc_t(), dim_(coefficients.rows()), coefficients_(coefficients), dim_(Dim), degree_(coefficients_.cols()-1), degree_(coefficients.cols()-1), T_min_(min), T_max_(max) { safe_check(); ... ... @@ -75,8 +76,9 @@ namespace curves /// \param max : UPPER bound on interval definition of the spline. polynomial(const T_Point& coefficients, const time_t min, const time_t max) : curve_abc_t(), dim_(coefficients.begin()->size()), coefficients_(init_coeffs(coefficients.begin(), coefficients.end())), dim_(Dim), degree_(coefficients_.cols()-1), degree_(coefficients_.cols()-1), T_min_(min), T_max_(max) { safe_check(); ... ... @@ -90,8 +92,10 @@ namespace curves /// \param max : UPPER bound on interval definition of the spline. template polynomial(In zeroOrderCoefficient, In out, const time_t min, const time_t max) : coefficients_(init_coeffs(zeroOrderCoefficient, out)), dim_(Dim), degree_(coefficients_.cols()-1), : curve_abc_t(), dim_(zeroOrderCoefficient->size()), coefficients_(init_coeffs(zeroOrderCoefficient, out)), degree_(coefficients_.cols()-1), T_min_(min), T_max_(max) { safe_check(); ... ... @@ -105,8 +109,8 @@ namespace curves polynomial(const polynomial& other) : coefficients_(other.coefficients_), dim_(other.dim_), degree_(other.degree_), T_min_(other.T_min_), T_max_(other.T_max_) : dim_(other.dim_), coefficients_(other.coefficients_), degree_(other.degree_), T_min_(other.T_min_), T_max_(other.T_max_) {} ... ... @@ -229,8 +233,8 @@ namespace curves /*Helpers*/ /*Attributes*/ coeff_t coefficients_; //const std::size_t dim_; //const coeff_t coefficients_; //const std::size_t degree_; //const time_t T_min_, T_max_; //const /*Attributes*/ ... ... @@ -240,7 +244,7 @@ namespace curves coeff_t init_coeffs(In zeroOrderCoefficient, In highestOrderCoefficient) { std::size_t size = std::distance(zeroOrderCoefficient, highestOrderCoefficient); coeff_t res = coeff_t(Dim, size); int i = 0; coeff_t res = coeff_t(dim_, size); int i = 0; for(In cit = zeroOrderCoefficient; cit != highestOrderCoefficient; ++cit, ++i) { res.col(i) = *cit; ... ...
 ... ... @@ -37,12 +37,12 @@ namespace curves return res; } template polynomial create_quintic(Point const& a, Point const& b, Point const& c, Point const &d, Point const &e, Point const &f, template polynomial create_quintic(Point const& a, Point const& b, Point const& c, Point const &d, Point const &e, Point const &f, const Time t_min, const Time t_max) { T_Point coeffs = make_quintic_vector(a,b,c,d,e,f); return polynomial(coeffs.begin(),coeffs.end(), t_min, t_max); return polynomial(coeffs.begin(),coeffs.end(), t_min, t_max); } } // namespace curves #endif //_STRUCT_QUINTIC_SPLINE ... ...