chrono::ChFunctionConstAcc Class Reference

Description

Constant acceleration function.

The function consists of three segments:

  • constant acceleration (+acc): 0.0 <= x/duration < acceleration1_end
  • constant velocity: acceleration1_end <= x/duration < acceleration2_start
  • constant deceleration (-acc): acceleration2_start <= x/duration <= 1.0

End of the first acceleration and start of the second acceleration are specified as fractions of the total duration.

The function takes care of computing the acceleration 'acc' so to achieve the desired final displacement in the given duration.

#include <ChFunctionConstAcc.h>

Inheritance diagram for chrono::ChFunctionConstAcc:
Collaboration diagram for chrono::ChFunctionConstAcc:

Public Member Functions

 ChFunctionConstAcc (double displacement, double acceleration1_end, double acceleration2_start, double duration)
 
 ChFunctionConstAcc (const ChFunctionConstAcc &other)
 
virtual ChFunctionConstAccClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual Type GetType () const override
 Return the unique function type identifier.
 
virtual double GetVal (double x) const override
 Return the function output for input x. More...
 
virtual double GetDer (double x) const override
 Return the first derivative of the function. More...
 
virtual double GetDer2 (double x) const override
 Return the second derivative of the function. More...
 
void SetDuration (double duration)
 Set duration of the double acceleration.
 
void SetFirstAccelerationEnd (double acceleration1_end)
 Set the end of the first acceleration ramp, as a fraction of the total duration [0, 1) Must be less than the start of the second acceleration ramp.
 
void SetSecondAccelerationStart (double acceleration2_start)
 Set the start of the second acceleration ramp, as a fraction of the total duration [0, 1) Must be greater than the end of the first acceleration ramp.
 
void SetDisplacement (double displacement)
 Set the desired displacement. More...
 
void SetAccelerationPoints (double acceleration1_end, double acceleration2_start)
 Set the end of the first acceleration ramp and the start of the second acceleration ramp.
 
double GetDuration () const
 Get the duration of the double acceleration.
 
double GetFirstAccelerationEnd () const
 Get the end of the first acceleration ramp, as a fraction of the total duration.
 
double GetSecondAccelerationStart () const
 Get the start of the second acceleration ramp, as a fraction of the total duration.
 
double GetDisplacement () const
 Get the desired displacement.
 
virtual double GetPositiveAccelerationCoeff () const override
 Get the positive acceleration coefficient.
 
virtual double GetNegativeAccelerationCoeff () const override
 Get the negative acceleration coefficient.
 
virtual double GetVelocityCoefficient () const override
 Get the velocity coefficient.
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFunction
 ChFunction (const ChFunction &other)
 
virtual double GetDer3 (double x) const
 Return the third derivative of the function. More...
 
virtual double GetDerN (double x, int der_order) const
 Return the Nth derivative of the function (up to 3rd derivative). More...
 
virtual double GetWeight (double x) const
 Return the weight of the function. More...
 
virtual void Update (double x)
 Update the function at the provided value of its argument.
 
virtual double GetMax (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the maximum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMin (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the minimum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetSquaredMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the squared mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetIntegral (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the integral of the function (or its der_order derivative) over the range [xmin, xmax]. More...
 
virtual void OutputToASCIIFile (std::ostream &file, double xmin, double xmax, int samples, char delimiter)
 Store X-Y pairs to an ASCII File. More...
 
virtual ChMatrixDynamic SampleUpToDerN (double xmin, double xmax, double step, int derN=0)
 Sample function on given interval [xmin, xmax], up to derN derivative (0 being the function ouput itself). More...
 
double operator() (double arg) const
 Alias operator of the GetVal function.
 

Additional Inherited Members

- Public Types inherited from chrono::ChFunction
enum  Type {
  BSPLINE, CONSTANT, CONSTACC, CONSTJERK,
  CUSTOM, CYCLOIDAL, DERIVATIVE, FILLET3,
  INTEGRAL, INTERP, LAMBDA, MIRROR,
  OPERATOR, POLY, POLY23, POLY345,
  RAMP, REPEAT, SEQUENCE, SINE,
  SINE_STEP
}
 Enumeration of function types.
 

Member Function Documentation

◆ GetDer()

double chrono::ChFunctionConstAcc::GetDer ( double  x) const
overridevirtual

Return the first derivative of the function.

Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).

Reimplemented from chrono::ChFunction.

◆ GetDer2()

double chrono::ChFunctionConstAcc::GetDer2 ( double  x) const
overridevirtual

Return the second derivative of the function.

Default implementation computes a numerical differentiation. Inherited classes may override this method with a more efficient implementation (e.g. analytical solution).

Reimplemented from chrono::ChFunction.

◆ GetVal()

double chrono::ChFunctionConstAcc::GetVal ( double  x) const
overridevirtual

Return the function output for input x.

Must be overridden by specialized classes.

Implements chrono::ChFunction.

◆ SetDisplacement()

void chrono::ChFunctionConstAcc::SetDisplacement ( double  displacement)
inline

Set the desired displacement.

The function will compute the accelerations so to achieve this displacement in the given duration.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionConstAcc.h
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionConstAcc.cpp