diff --git a/include/curves/bezier_curve.h b/include/curves/bezier_curve.h index 3f3c4cdd49ccd25051f50c3512fcd9ec5709bf21..35793891c780e0dc0313afa0a11dc5c7ca96a285 100644 --- a/include/curves/bezier_curve.h +++ b/include/curves/bezier_curve.h @@ -31,8 +31,8 @@ namespace curves /// For degree lesser than 4, the evaluation is analitycal. Otherwise /// the bernstein polynoms are used to evaluate the spline at a given location. /// - template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false - , typename Point= Eigen::Matrix<Numeric, Eigen::Dynamic, 1> > + template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false, + typename Point= Eigen::Matrix<Numeric, Eigen::Dynamic, 1> > struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point>, public serialization::Serializable< bezier_curve<Time, Numeric, Dim, Safe, Point> > { diff --git a/include/curves/cubic_hermite_spline.h b/include/curves/cubic_hermite_spline.h index 594b6c6f533d709b15cc7f826cb343aa8acba3f0..b7aa9a5e805aa3bd67ea2820c4f510bc28355b38 100644 --- a/include/curves/cubic_hermite_spline.h +++ b/include/curves/cubic_hermite_spline.h @@ -35,8 +35,7 @@ namespace curves /// template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false, typename Point= Eigen::Matrix<Numeric, Eigen::Dynamic, 1>, - typename Tangent= Eigen::Matrix<Numeric, Eigen::Dynamic, 1> - > + typename Tangent= Eigen::Matrix<Numeric, Eigen::Dynamic, 1> > struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point>, public serialization::Serializable< cubic_hermite_spline<Time, Numeric, Dim, Safe, Point, Tangent> > { diff --git a/include/curves/cubic_spline.h b/include/curves/cubic_spline.h index f8233987db571cda9c4057348c2254f37d0d73d7..2baa960e309ea262b2340d5f7875dd8040b8368b 100644 --- a/include/curves/cubic_spline.h +++ b/include/curves/cubic_spline.h @@ -22,27 +22,27 @@ namespace curves { - /// \brief Creates coefficient vector of a cubic spline defined on the interval - /// \f$[t_{min}, t_{max}]\f$. It follows the equation : <br> - /// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 \f$ where \f$ t \in [t_{min}, t_{max}] \f$ - /// with a, b, c and d the control points. - /// - template<typename Point, typename T_Point> - T_Point make_cubic_vector(Point const& a, Point const& b, Point const& c, Point const &d) - { - T_Point res; - res.push_back(a);res.push_back(b);res.push_back(c);res.push_back(d); - return res; - } - - template<typename Time, typename Numeric, std::size_t Dim, bool Safe, - typename Point, typename T_Point> - polynomial<Time,Numeric,Dim,Safe,Point,T_Point> 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<Point, T_Point>(a,b,c,d); - return polynomial<Time,Numeric,Dim,Safe,Point,T_Point>(coeffs.begin(),coeffs.end(), t_min, t_max); - } + /// \brief Creates coefficient vector of a cubic spline defined on the interval + /// \f$[t_{min}, t_{max}]\f$. It follows the equation : <br> + /// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 \f$ where \f$ t \in [t_{min}, t_{max}] \f$ + /// with a, b, c and d the control points. + /// + template<typename Point, typename T_Point> + T_Point make_cubic_vector(Point const& a, Point const& b, Point const& c, Point const &d) + { + T_Point res; + res.push_back(a);res.push_back(b);res.push_back(c);res.push_back(d); + return res; + } + + template<typename Time, typename Numeric, std::size_t Dim, bool Safe, + typename Point, typename T_Point> + polynomial<Time,Numeric,Dim,Safe,Point,T_Point> 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<Point, T_Point>(a,b,c,d); + return polynomial<Time,Numeric,Dim,Safe,Point,T_Point>(coeffs.begin(),coeffs.end(), t_min, t_max); + } } // namespace curves #endif //_STRUCT_CUBICSPLINE diff --git a/include/curves/curve_constraint.h b/include/curves/curve_constraint.h index 26f9c3e986965b1e22bf6f5aad0526d52753efa0..d43323faf4630ea5c1fa089212d7c98cd57c1dbd 100644 --- a/include/curves/curve_constraint.h +++ b/include/curves/curve_constraint.h @@ -19,19 +19,19 @@ namespace curves { - template <typename Point, std::size_t Dim=3> - struct curve_constraints - { - typedef Point point_t; - curve_constraints(): - init_vel(point_t::Zero(Dim)),init_acc(init_vel),end_vel(init_vel),end_acc(init_vel){} + template <typename Point, std::size_t Dim=3> + struct curve_constraints + { + typedef Point point_t; + curve_constraints(): + init_vel(point_t::Zero(Dim)),init_acc(init_vel),end_vel(init_vel),end_acc(init_vel){} - ~curve_constraints(){} + ~curve_constraints(){} - point_t init_vel; - point_t init_acc; - point_t end_vel; - point_t end_acc; - }; + point_t init_vel; + point_t init_acc; + point_t end_vel; + point_t end_acc; + }; } // namespace curves #endif //_CLASS_CUBICZEROVELACC diff --git a/include/curves/polynomial.h b/include/curves/polynomial.h index bda91b365cc38136729695fff012e84c6eedc978..8ea041622c965ae3410da61879330b3c04fcc489 100644 --- a/include/curves/polynomial.h +++ b/include/curves/polynomial.h @@ -39,10 +39,10 @@ namespace curves struct polynomial : public curve_abc<Time, Numeric, Safe, Point>, public serialization::Serializable< polynomial<Time, Numeric, Dim, Safe, Point, T_Point> > { - typedef Point point_t; + typedef Point point_t; typedef T_Point t_point_t; - typedef Time time_t; - typedef Numeric num_t; + typedef Time time_t; + typedef Numeric num_t; typedef curve_abc<Time, Numeric, Safe, Point> curve_abc_t; typedef Eigen::Matrix<double, Dim, Eigen::Dynamic> coeff_t; typedef Eigen::Ref<coeff_t> coeff_t_ref; diff --git a/include/curves/quintic_spline.h b/include/curves/quintic_spline.h index e6f6356fa32fd9216424d20e141f332878658876..b516fd9ad1b4494445ae89ab089d96a4646971eb 100644 --- a/include/curves/quintic_spline.h +++ b/include/curves/quintic_spline.h @@ -22,28 +22,28 @@ namespace curves { - /// \brief Creates coefficient vector of a quintic spline defined on the interval - /// \f$[t_{min}, t_{max}]\f$. It follows the equation :<br> - /// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 + e(t - t_{min})^4 + f(t - t_{min})^5 \f$ <br> - /// where \f$ t \in [t_{min}, t_{max}] \f$. - /// - template<typename Point, typename T_Point> - T_Point make_quintic_vector(Point const& a, Point const& b, Point const& c, - Point const &d, Point const& e, Point const& f) - { - T_Point res; - res.push_back(a);res.push_back(b);res.push_back(c); - res.push_back(d);res.push_back(e);res.push_back(f); - return res; - } - - template<typename Time, typename Numeric, std::size_t Dim, bool Safe, typename Point, typename T_Point> - polynomial<Time,Numeric,Dim,Safe,Point,T_Point> 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<Point, T_Point>(a,b,c,d,e,f); - return polynomial<Time,Numeric,Dim,Safe,Point,T_Point>(coeffs.begin(),coeffs.end(), t_min, t_max); - } + /// \brief Creates coefficient vector of a quintic spline defined on the interval + /// \f$[t_{min}, t_{max}]\f$. It follows the equation :<br> + /// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 + e(t - t_{min})^4 + f(t - t_{min})^5 \f$ <br> + /// where \f$ t \in [t_{min}, t_{max}] \f$. + /// + template<typename Point, typename T_Point> + T_Point make_quintic_vector(Point const& a, Point const& b, Point const& c, + Point const &d, Point const& e, Point const& f) + { + T_Point res; + res.push_back(a);res.push_back(b);res.push_back(c); + res.push_back(d);res.push_back(e);res.push_back(f); + return res; + } + + template<typename Time, typename Numeric, std::size_t Dim, bool Safe, typename Point, typename T_Point> + polynomial<Time,Numeric,Dim,Safe,Point,T_Point> 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<Point, T_Point>(a,b,c,d,e,f); + return polynomial<Time,Numeric,Dim,Safe,Point,T_Point>(coeffs.begin(),coeffs.end(), t_min, t_max); + } } // namespace curves #endif //_STRUCT_QUINTIC_SPLINE diff --git a/python/python_definitions.h b/python/python_definitions.h index b65a3b49a02ddd29f3c4bf7be6c0e5f9c218b529..d4648c2f2d7368d8d347d47368ea8f896b90d977 100644 --- a/python/python_definitions.h +++ b/python/python_definitions.h @@ -8,33 +8,33 @@ namespace curves { - typedef double real; - typedef Eigen::Vector3d point_t; - typedef Eigen::Vector3d tangent_t; - typedef Eigen::VectorXd vectorX_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 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<Waypoint> T_Waypoint; - typedef std::pair<real, point6_t> Waypoint6; - typedef std::vector<Waypoint6> T_Waypoint6; + typedef double real; + typedef Eigen::Vector3d point_t; + typedef Eigen::Vector3d tangent_t; + typedef Eigen::VectorXd vectorX_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 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<Waypoint> T_Waypoint; + typedef std::pair<real, point6_t> Waypoint6; + typedef std::vector<Waypoint6> T_Waypoint6; - template <typename PointList, typename T_Point> - T_Point vectorFromEigenArray(const PointList& array) - { - T_Point res; - for(int i =0;i<array.cols();++i) - { - res.push_back(array.col(i)); - } - return res; - } + template <typename PointList, typename T_Point> + T_Point vectorFromEigenArray(const PointList& array) + { + T_Point res; + for(int i =0;i<array.cols();++i) + { + res.push_back(array.col(i)); + } + return res; + } } //namespace curves #endif //_DEFINITION_PYTHON_BINDINGS