![]() |
Controlpp
|
A lite weight incremental sine generator. More...
#include <controlpp/Generator.hpp>
Public Member Functions | |
| SineGenerator (const T &frequency, const T &sample_time) | |
| Constructs a sine generator. | |
| void | set_frequency (const T &frequency) |
| void | set_sample_time (const T &sample_time) |
| void | set_frequency_and_sample_time (const T &frequency, const T &sample_time) |
| T | sin () const |
| Returns the current sine output. | |
| T | cos () const |
| Returns the current cosine output. | |
| Eigen::Vector< T, 2 > | next () |
| calculates the next output | |
| void | reset () |
| Resets the Sine generator to the initial position. | |
A lite weight incremental sine generator.
A lite weight sine generator that calculates incremental results. This allows the use of a fast 2x2 Matrix Vector multiplication, which is much faster than the standard sin and cos computations.
Thus this class is well suited for generating sine waves that are written to an output like an DAC (Digital to Analog Converter).
| T | The value type that the SineGenerator uses. Typically float, double or a custom fixpoint implementation. |
|
inline |
Constructs a sine generator.
The initial position (internal state) is at sin() == 0 and cos() == 1
| frequency | The frequency of the sine wave |
| sample_time | The time that passes in between outputs (calls to next()) |
|
inline |
Returns the current cosine output.
Does not advance the state
|
inline |
calculates the next output
Advances the state
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the current sine output.
Does not advance the state