|
Stepdance Software Library
|
Used for generating a sinusoidal waveform signal. More...
#include <generators.hpp>
Public Member Functions | |
| WaveGenerator1D () | |
| Default constructor for WaveGenerator1D. Does not initialize board hardware. Call begin() to set up the generator. | |
| void | begin () |
| Initialize the WaveGenerator1D. Must be called to set up the generator. | |
| void | setNoInput () |
| Set the generator to use internal frame count for waveform generation instead of an input signal. This means the generator will produce a continuous waveform based on the frame rate and does not need to be mapped to an input. | |
| void | debugPrint () |
| Print debug information about the WaveGenerator1D to the Serial console. | |
| void | enable () |
| Enable the WaveGenerator1D. | |
| void | disable () |
| Disable the WaveGenerator1D. | |
Public Attributes | |
| volatile ControlParameter | amplitude = 0 |
| ControlParameter for the amplitude of the waveform- the distance from the center line of the wave form to the top or bottom of the wave crest or trough. You can set it directly or map an input to it (e.g. from an analog input). | |
| volatile ControlParameter | phase = 0.0 |
| ControlParameter for the phase of the waveform in radians. Phase is the offset of the waveform from its starting point. You can set it directly or map an input to it. | |
| volatile ControlParameter | frequency = 8 |
| ControlParameter for the frequency of the waveform in revolutions per second (e.g. number of waves within a period). You can set it directly or map an input to it. | |
| BlockPort | input |
| Input BlockPort for the WaveGenerator1D. This is what you map to with an upstream component. If setNoInput() is called, this input is ignored. | |
| BlockPort | output |
| Output BlockPort for the WaveGenerator1D. This is what you map from to a downstream component. | |
Protected Member Functions | |
| void | run () |
Protected Attributes | |
| volatile float64_t | current_angle_rad = 0 |
| volatile float64_t | delta = 0 |
Used for generating a sinusoidal waveform signal.
A WaveGenerator1D produces a sinusoidal waveform output based on an input position or internal frame count. It allows control over amplitude, phase, and frequency, making it useful for generating or modifying motion signals with an oscillation. Here's an example of how to instantiate and configure a WaveGenerator1D:
| BlockPort WaveGenerator1D::input |
Input BlockPort for the WaveGenerator1D. This is what you map to with an upstream component. If setNoInput() is called, this input is ignored.
| BlockPort WaveGenerator1D::output |
Output BlockPort for the WaveGenerator1D. This is what you map from to a downstream component.