Fawkes API  Fawkes Development Version
fawkes::SinusoidalInterpolator Class Reference

Sinusoidal value interpolator. More...

#include <>>

Inheritance diagram for fawkes::SinusoidalInterpolator:

Public Member Functions

virtual float interpolate (float t_current, float t_end, float t_step, float v_start, float v_end)
 Interpolate a point at a specific time. More...
 
- Public Member Functions inherited from fawkes::Interpolator
virtual ~Interpolator ()
 Virtual empty descructor. More...
 

Detailed Description

Sinusoidal value interpolator.

The interpolator creates intermediate points given a starting and and end point and time constraints. Times are supplied in a discrete unit like miliseconds or microseconds. The values are interpolated on a sinusoidal curve with a slow start, the greatest slope in the middle and then a slow down in the end. This interpolation is useful for example for smooth servo movements.

The calculation is executed with the following equation:

\[ \left(\frac{1}{2} \sin\left(\frac{1}{2} + \frac{t_\mathrm{current}}{t_\mathrm{end}} \pi \right) + \frac{1}{2}\right) \cdot (v_\mathrm{end} - v_\mathrm{start}) + v_\mathrm{start} \]

Author
Tim Niemueller
Graeme McPhillips
Stephen Marais

Definition at line 34 of file sinusoidal.h.

Member Function Documentation

◆ interpolate()

float fawkes::SinusoidalInterpolator::interpolate ( float  t_current,
float  t_end,
float  t_step,
float  v_start,
float  v_end 
)
virtual

Interpolate a point at a specific time.

Parameters
t_currentcurrent time for which to calculate the intermediate point
t_endend time/total time. The start time is always 0.
t_stepTime of a time slice for discrete intermediate interpolation points. Set to 1 for maximum resolution.
v_startstart value
v_endend value
Returns
interpolated value at time t_current between t_start and t_end.

Implements fawkes::Interpolator.

Definition at line 55 of file sinusoidal.cpp.


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