Program Listing for File base_waveform.hpp
↰ Return to documentation for file (rcppsw/control/base_waveform.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcppsw/control/config/waveform_config.hpp"
#include "rcppsw/math/radians.hpp"
#include "rcppsw/rcppsw.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace rcppsw::control {
/*******************************************************************************
* Classes
******************************************************************************/
class base_waveform {
public:
explicit base_waveform(const struct config::waveform_config* const config)
: m_frequency(config->frequency),
m_amplitude(config->amplitude),
m_offset(config->offset),
m_phase(rmath::radians(config->phase)) {}
virtual ~base_waveform(void) = default;
virtual double value(double time) = 0;
double frequency(void) const { return m_frequency; }
const math::radians& phase(void) const { return m_phase; }
double amplitude(void) const { return m_amplitude; }
double offset(void) const { return m_offset; }
private:
/* clang-format off */
double m_frequency;
double m_amplitude;
double m_offset;
math::radians m_phase;
/* clang-format on */
};
} /* namespace rcppsw::control */