Commit 36e66de9 authored by JasonChmn's avatar JasonChmn
Browse files

Doc include/curves done

parent 73fee04e
......@@ -292,7 +292,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// The new list contains centroid of parameters \f${t,1-t}\f$ of consecutive points in the list.
/// \param pts : list of points.
/// \param u : NORMALIZED time when to evaluate the curve.
/// \return Reduced list of point (size of pts - 1).
/// \return reduced list of point (size of pts - 1).
///
t_point_t deCasteljauReduction(const t_point_t& pts, const Numeric u) const{
if(u < 0 || u > 1)
......@@ -310,7 +310,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \brief Split the bezier curve in 2 at time t.
/// \param t : list of points.
/// \param u : unNormalized time.
/// \return A pair containing the first element of both bezier curve obtained.
/// \return pair containing the first element of both bezier curve obtained.
///
std::pair<bezier_curve_t,bezier_curve_t> split(const Numeric t){
if (t == T_)
......
......@@ -28,8 +28,8 @@ namespace curves
///
/// \brief Converts a Bezier curve to a polynom.
/// \param bezier: the Bezier curve to convert.
/// \return The equivalent polynom.
/// \param bezier : the Bezier curve to convert.
/// \return the equivalent polynom.
template<typename Bezier, typename Polynom>
Polynom from_bezier(const Bezier& curve)
{
......@@ -52,7 +52,7 @@ Polynom from_bezier(const Bezier& curve)
///\brief Converts a polynom to a Bezier curve.
///\param polynom : the polynom to convert.
///\return The equivalent Bezier curve.
///\return the equivalent Bezier curve.
/*template<typename Bezier, typename Polynom>
Bezier from_polynom(const Polynom& polynom)
{
......
......@@ -137,7 +137,8 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \brief Set duration by default of each spline (called in constructor).
/// Set a linear time from 0 to 1 for each control point with a \f$step=1.0/N\f$
/// where \f$N\f$ is the number of control points.<br>
/// Exemple for 5 control points : vector time_control_points_ will contain \f$(0., 0.25, 0.5, 0.75, 1.0)\f$.
/// Exemple for 5 control points : vector time_control_points_ will contain \f$(0., 0.25, 0.5, 0.75, 1.0)\f$
/// corresponding to time for \f$P_0\f$, \f$P_1\f$, \f$P_2\f$, \f$P_3\f$ and \f$P_4\f$ respectively.
///
void setTimeSplinesDefault()
{
......@@ -157,12 +158,12 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Dim, Safe, Point>
}
/// \brief Get number of control points contained in the trajectory.
/// \return Number of control points.
/// \return number of control points.
///
Index size() const { return size_; }
/// \brief Get number of intervals (subsplines) contained in the trajectory.
/// \return Number of intervals (subsplines).
/// \return number of intervals (subsplines).
///
Index numIntervals() const { return size()-1; }
......
......@@ -23,7 +23,7 @@
namespace curves
{
/// \brief Creates coefficient vector of a cubic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :
/// \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.
///
......
......@@ -20,7 +20,7 @@ namespace curves
{
/// \struct curve_abc.
/// \brief Represents a curve of dimension Dim.
/// If parameter Safe is false, no verification is made on the evaluation of the curve.
/// If value of parameter Safe is false, no verification is made on the evaluation of the curve.
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false
, typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct curve_abc : std::unary_function<Time, Point>
......
......@@ -75,13 +75,19 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
virtual ~exact_cubic(){}
private:
/// \brief Compute polynom of exact cubic spline from waypoints.
/// Compute the coefficients of polynom as in paper : "Task-Space Trajectories via Cubic Spline Optimization".<br>
/// \f$x_i(t)=a_i+b_i(t-t_i)+c_i(t-t_i)^2\f$<br>
/// with \f$a=x\f$, \f$H_1b=H_2x\f$, \f$c=H_3x+H_4b\f$, \f$d=H_5x+H_6b\f$.<br>
/// The matrices \f$H\f$ are defined as in the paper in Appendix A.
///
template<typename In>
t_spline_t computeWayPoints(In wayPointsBegin, In wayPointsEnd) const
{
std::size_t const size(std::distance(wayPointsBegin, wayPointsEnd));
if(Safe && size < 1)
{
throw; // TODO
throw std::length_error("size of waypoints must be superior to 0") ; // TODO
}
t_spline_t subSplines; subSplines.reserve(size);
......@@ -103,6 +109,7 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
In it(wayPointsBegin), next(wayPointsBegin);
++next;
// Fill the matrices H as specified in the paper.
for(std::size_t i(0); next != wayPointsEnd; ++next, ++it, ++i)
{
num_t const dTi((*next).first - (*it).first);
......@@ -134,11 +141,13 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
}
// adding last x
x.row(size-1)= (*it).second.transpose();
// Compute coefficients of polynom.
a= x;
PseudoInverse(h1);
b = h1 * h2 * x; //h1 * b = h2 * x => b = (h1)^-1 * h2 * x
c = h3 * x + h4 * b;
d = h5 * x + h6 * b;
// create splines along waypoints.
it= wayPointsBegin, next=wayPointsBegin; ++ next;
for(int i=0; next != wayPointsEnd; ++i, ++it, ++next)
{
......@@ -158,7 +167,7 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
public:
/// \brief Evaluation of the cubic spline at time t.
/// \param t : time when to evaluate the spline
/// \return \f$x(t)\f$, point corresponding on spline at time t.
/// \return \f$x(t)\f$ point corresponding on spline at time t.
///
virtual point_t operator()(const time_t t) const
{
......@@ -175,7 +184,7 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \brief Evaluate the derivative of order N of spline at time t.
/// \param t : time when to evaluate the spline.
/// \param order : order of derivative.
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$, point corresponding on derivative spline of order N at time t.
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$ point corresponding on derivative spline of order N at time t.
///
virtual point_t derivate(const time_t t, const std::size_t order) const
{
......@@ -193,10 +202,10 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
/*Helpers*/
public:
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$, lower bound of time range.
/// \return \f$t_{min}\f$ lower bound of time range.
num_t virtual min() const{return subSplines_.front().min();}
/// \brief Get the maximum time for which the curve is defined.
/// \return \f$t_{max}\f$, upper bound of time range.
/// \return \f$t_{max}\f$ upper bound of time range.
num_t virtual max() const{return subSplines_.back().max();}
/*Helpers*/
......
......@@ -27,8 +27,8 @@ namespace curves
{
/// \class polynom.
/// \brief Represents a polynom of an arbitrary order defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :
/// \f$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N \f$,
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :<br>
/// \f$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N \f$<br>
/// where N is the order and \f$ t \in [t_{min}, t_{max}] \f$.
///
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false,
......@@ -49,8 +49,8 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \param coefficients : a reference to an Eigen matrix where each column is a coefficient,
/// from the zero order coefficient, up to the highest order. Spline order is given
/// by the number of the columns -1.
/// \param min: LOWER bound on interval definition of the curve.
/// \param max: UPPER bound on interval definition of the curve.
/// \param min : LOWER bound on interval definition of the curve.
/// \param max : UPPER bound on interval definition of the curve.
polynom(const coeff_t& coefficients, const time_t min, const time_t max)
: curve_abc_t(),
coefficients_(coefficients), dim_(Dim), order_(coefficients_.cols()-1), t_min_(min), t_max_(max)
......@@ -62,8 +62,8 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \param coefficients : a container containing all coefficients of the spline, starting
/// with the zero order coefficient, up to the highest order. Spline order is given
/// by the size of the coefficients.
/// \param min: LOWER bound on interval definition of the spline.
/// \param max: UPPER bound on interval definition of the spline.
/// \param min : LOWER bound on interval definition of the spline.
/// \param max : UPPER bound on interval definition of the spline.
polynom(const T_Point& coefficients, const time_t min, const time_t max)
: curve_abc_t(),
coefficients_(init_coeffs(coefficients.begin(), coefficients.end())),
......@@ -133,7 +133,7 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \brief Evaluation of the cubic spline at time t using horner's scheme.
/// \param t : time when to evaluate the spline.
/// \return \f$x(t)\f$, point corresponding on spline at time t.
/// \return \f$x(t)\f$ point corresponding on spline at time t.
virtual point_t operator()(const time_t t) const
{
if((t < t_min_ || t > t_max_) && Safe){ throw std::out_of_range("TODO");}
......@@ -148,7 +148,7 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
/// \brief Evaluation of the derivative of order N of spline at time t.
/// \param t : the time when to evaluate the spline.
/// \param order : order of derivative.
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$, point corresponding on derivative spline at time t.
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$ point corresponding on derivative spline at time t.
virtual point_t derivate(const time_t t, const std::size_t order) const
{
if((t < t_min_ || t > t_max_) && Safe){ throw std::out_of_range("TODO");}
......@@ -174,10 +174,10 @@ struct polynom : public curve_abc<Time, Numeric, Dim, Safe, Point>
/*Helpers*/
public:
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$, lower bound of time range.
/// \return \f$t_{min}\f$ lower bound of time range.
num_t virtual min() const {return t_min_;}
/// \brief Get the maximum time for which the curve is defined.
/// \return \f$t_{max}\f$, upper bound of time range.
/// \return \f$t_{max}\f$ upper bound of time range.
num_t virtual max() const {return t_max_;}
/*Helpers*/
......
......@@ -23,8 +23,8 @@
namespace curves
{
/// \brief Creates coefficient vector of a quintic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :
/// \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$
/// \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>
......
......@@ -32,8 +32,8 @@ namespace curves
{
/// \class spline_deriv_constraint.
/// \brief Represents a set of cubic splines defining a continuous function
/// crossing each of the waypoint given in its initialization. Additional constraints
/// are used to increase the order of the last spline, to start and finish
/// crossing each of the waypoint given in its initialization. <br>
/// Additional constraints +are used to increase the order of the last spline, to start and finish
/// trajectory with user defined velocity and acceleration.
///
template<typename Time= double, typename Numeric=Time, std::size_t Dim=3, bool Safe=false,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment