Loading...
Searching...
No Matches
ndcurves::sinusoidal< Time, Numeric, Safe, Point > Class Template Reference

Represents a sinusoidal curve, evaluating the following equation: p0 + amplitude * (sin(2pi/T + phi) More...

#include <ndcurves/sinusoidal.h>

Inheritance diagram for ndcurves::sinusoidal< Time, Numeric, Safe, Point >:
Collaboration diagram for ndcurves::sinusoidal< Time, Numeric, Safe, Point >:

Public Types

typedef Point point_t
 
typedef Point point_derivate_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef sinusoidal< Time, Numeric, Safe, Point > sinusoidal_t
 
typedef curve_abc< Time, Numeric, Safe, Point > curve_abc_t
 
- Public Types inherited from ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >
typedef Point point_t
 
typedef Point_derivate point_derivate_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef curve_abc< Time, Numeric, Safe, point_t, point_derivate_tcurve_t
 
typedef curve_abc< Time, Numeric, Safe, point_derivate_tcurve_derivate_t
 
typedef std::shared_ptr< curve_tcurve_ptr_t
 

Public Member Functions

 sinusoidal ()
 Empty constructor. Curve obtained this way can not perform other class functions.
 
 sinusoidal (const Point &p0, const Point &amplitude, const time_t T, const time_t phi, const time_t T_min=0., const time_t T_max=std::numeric_limits< time_t >::max())
 Constructor.
 
 sinusoidal (const time_t traj_time, const Point &p_init, const Point &p_final, const time_t T_min=0., const time_t T_max=std::numeric_limits< time_t >::max())
 Constructor from stationary points.
 
 sinusoidal (const sinusoidal_t &other)
 Copy constructor.
 
virtual ~sinusoidal ()
 Destructor.
 
virtual point_t operator() (const time_t t) const
 Evaluation of the cubic spline at time t.
 
virtual point_derivate_t derivate (const time_t t, const std::size_t order) const
 Evaluate the derivative of order N of curve at time t.
 
sinusoidal_t compute_derivate (const std::size_t order) const
 Compute the derived curve at order N. Computes the derivative order N, \(\frac{d^Nx(t)}{dt^N}\) of bezier curve of parametric equation x(t).
 
virtual sinusoidal_tcompute_derivate_ptr (const std::size_t order) const
 Compute the derived curve at orderN.
 
virtual bool isApprox (const sinusoidal_t &other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 isApprox check if other and *this are approximately equals given a precision threshold Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent.
 
virtual bool isApprox (const curve_abc_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 
virtual bool operator== (const sinusoidal_t &other) const
 
virtual bool operator!= (const sinusoidal_t &other) const
 
virtual std::size_t dim () const
 Get dimension of curve.
 
virtual num_t min () const
 Get the minimum time for which the curve is defined.
 
virtual num_t max () const
 Get the maximum time for which the curve is defined.
 
virtual std::size_t degree () const
 Get the degree of the curve.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
- Public Member Functions inherited from ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >
 curve_abc ()
 Constructor.
 
virtual ~curve_abc ()
 Destructor.
 
bool isEquivalent (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision(), const size_t order=5) const
 isEquivalent check if other and *this are approximately equal by values, given a precision threshold. This test is done by discretizing both curves and evaluating them and their derivatives.
 
virtual bool isApprox (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const =0
 isApprox check if other and *this are approximately equal given a precision threshold Only two curves of the same class can be approximately equal, for comparison between different type of curves see isEquivalent.
 
std::pair< time_t, time_ttimeRange ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
- Public Member Functions inherited from ndcurves::serialization::Serializable
template<class Derived >
void loadFromText (const std::string &filename)
 Loads a Derived object from a text file.
 
template<class Derived >
void saveAsText (const std::string &filename) const
 Saved a Derived object as a text file.
 
template<class Derived >
void loadFromXML (const std::string &filename, const std::string &tag_name)
 Loads a Derived object from an XML file.
 
template<class Derived >
void saveAsXML (const std::string &filename, const std::string &tag_name) const
 Saved a Derived object as an XML file.
 
template<class Derived >
void loadFromBinary (const std::string &filename)
 Loads a Derived object from an binary file.
 
template<class Derived >
void saveAsBinary (const std::string &filename) const
 Saved a Derived object as an binary file.
 

Public Attributes

Point p0_
 
Point amplitude_
 
time_t T_
 
time_t phi_
 
time_t T_min_
 
time_t T_max_
 
std::size_t dim_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
class ndcurves::sinusoidal< Time, Numeric, Safe, Point >

Represents a sinusoidal curve, evaluating the following equation: p0 + amplitude * (sin(2pi/T + phi)

Member Typedef Documentation

◆ curve_abc_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef curve_abc<Time, Numeric, Safe, Point> ndcurves::sinusoidal< Time, Numeric, Safe, Point >::curve_abc_t

◆ num_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Numeric ndcurves::sinusoidal< Time, Numeric, Safe, Point >::num_t

◆ point_derivate_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Point ndcurves::sinusoidal< Time, Numeric, Safe, Point >::point_derivate_t

◆ point_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Point ndcurves::sinusoidal< Time, Numeric, Safe, Point >::point_t

◆ sinusoidal_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef sinusoidal<Time, Numeric, Safe, Point> ndcurves::sinusoidal< Time, Numeric, Safe, Point >::sinusoidal_t

◆ time_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Time ndcurves::sinusoidal< Time, Numeric, Safe, Point >::time_t

Constructor & Destructor Documentation

◆ sinusoidal() [1/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
ndcurves::sinusoidal< Time, Numeric, Safe, Point >::sinusoidal ( )
inline

Empty constructor. Curve obtained this way can not perform other class functions.

◆ sinusoidal() [2/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
ndcurves::sinusoidal< Time, Numeric, Safe, Point >::sinusoidal ( const Point &  p0,
const Point &  amplitude,
const time_t  T,
const time_t  phi,
const time_t  T_min = 0.,
const time_t  T_max = std::numeric_limits<time_t>::max() 
)
inline

Constructor.

Parameters
p0: Offset of the sinusoidal
amplitudeAmplitude
T: The period
phi: the phase
T_min: lower bound of the time interval (default to 0)
T_max: upper bound of the time interval (default to +inf)

◆ sinusoidal() [3/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
ndcurves::sinusoidal< Time, Numeric, Safe, Point >::sinusoidal ( const time_t  traj_time,
const Point &  p_init,
const Point &  p_final,
const time_t  T_min = 0.,
const time_t  T_max = std::numeric_limits<time_t>::max() 
)
inline

Constructor from stationary points.

Parameters
traj_timeduration to go from p_init to p_final (half a period)
p_init: first stationary point, either minimum or maximum
p_final: second stationary point, either minimum or maximum
T_min: lower bound of the time interval (default to 0)
T_max: upper bound of the time interval (default to +inf)

◆ sinusoidal() [4/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
ndcurves::sinusoidal< Time, Numeric, Safe, Point >::sinusoidal ( const sinusoidal_t other)
inline

Copy constructor.

Parameters
other

◆ ~sinusoidal()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual ndcurves::sinusoidal< Time, Numeric, Safe, Point >::~sinusoidal ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ compute_derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
sinusoidal_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::compute_derivate ( const std::size_t  order) const
inline

Compute the derived curve at order N. Computes the derivative order N, \(\frac{d^Nx(t)}{dt^N}\) of bezier curve of parametric equation x(t).

Parameters
order: order of derivative.
Returns
\(\frac{d^Nx(t)}{dt^N}\) derivative order N of the curve.

◆ compute_derivate_ptr()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual sinusoidal_t * ndcurves::sinusoidal< Time, Numeric, Safe, Point >::compute_derivate_ptr ( const std::size_t  order) const
inlinevirtual

Compute the derived curve at orderN.

Parameters
order: order of derivative.
Returns
A pointer to \(\frac{d^Nx(t)}{dt^N}\) derivative order N of the curve.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ degree()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual std::size_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::degree ( ) const
inlinevirtual

Get the degree of the curve.

Returns
\(degree\), the degree of the curve.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual point_derivate_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::derivate ( const time_t  t,
const std::size_t  order 
) const
inlinevirtual

Evaluate the derivative of order N of curve at time t.

Parameters
t: time when to evaluate the spline.
order: order of derivative.
Returns
\(\frac{d^Nx(t)}{dt^N}\), point corresponding on derivative curve of order N at time t.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ dim()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual std::size_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::dim ( ) const
inlinevirtual

Get dimension of curve.

Returns
dimension of curve.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ isApprox() [1/2]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool ndcurves::sinusoidal< Time, Numeric, Safe, Point >::isApprox ( const curve_abc_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inlinevirtual

◆ isApprox() [2/2]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool ndcurves::sinusoidal< Time, Numeric, Safe, Point >::isApprox ( const sinusoidal_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inlinevirtual

isApprox check if other and *this are approximately equals given a precision threshold Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent.

Parameters
otherthe other curve to check
precthe precision threshold, default Eigen::NumTraits<Numeric>::dummy_precision()
Returns
true is the two curves are approximately equals

◆ max()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual num_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::max ( ) const
inlinevirtual

Get the maximum time for which the curve is defined.

Returns
\(t_{max}\) upper bound of time range.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ min()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual num_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::min ( ) const
inlinevirtual

Get the minimum time for which the curve is defined.

Returns
\(t_{min}\) lower bound of time range.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ operator!=()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool ndcurves::sinusoidal< Time, Numeric, Safe, Point >::operator!= ( const sinusoidal_t other) const
inlinevirtual

◆ operator()()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual point_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::operator() ( const time_t  t) const
inlinevirtual

Evaluation of the cubic spline at time t.

Parameters
t: time when to evaluate the spine
Returns
\(x(t)\), point corresponding on curve at time t.

Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.

◆ operator==()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual bool ndcurves::sinusoidal< Time, Numeric, Safe, Point >::operator== ( const sinusoidal_t other) const
inlinevirtual

◆ serialize()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
template<class Archive >
void ndcurves::sinusoidal< Time, Numeric, Safe, Point >::serialize ( Archive ar,
const unsigned int  version 
)
inline

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
friend class boost::serialization::access
friend

Member Data Documentation

◆ amplitude_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
Point ndcurves::sinusoidal< Time, Numeric, Safe, Point >::amplitude_

◆ dim_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
std::size_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::dim_

◆ p0_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
Point ndcurves::sinusoidal< Time, Numeric, Safe, Point >::p0_

◆ phi_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
time_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::phi_

◆ T_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
time_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::T_

◆ T_max_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
time_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::T_max_

◆ T_min_

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
time_t ndcurves::sinusoidal< Time, Numeric, Safe, Point >::T_min_

The documentation for this class was generated from the following files: