Public Member Functions | Private Attributes | List of all members
control_toolbox::Sinusoid Class Reference

A basic sine class. More...

#include <sinusoid.h>

Public Member Functions

void debug ()
 
bool initXml (TiXmlElement *ti_xml_element)
 Initializes the parameters of the sine wave from the given xml element. More...
 
 Sinusoid ()
 Constructor. More...
 
 Sinusoid (double offset, double amplitude, double frequency, double phase)
 Constructor which intializes values. More...
 
double update (double time, double &qd, double &qdd)
 Gets the value and derivatives of the sinusoid at a given time. More...
 
virtual ~Sinusoid ()
 

Private Attributes

double amplitude_
 
double frequency_
 
double offset_
 
double phase_
 

Detailed Description

A basic sine class.

This class calculates the output for a sine wave and its derivatives, given the amplitude, phase, frequency and offset.

Definition at line 85 of file sinusoid.h.

Constructor & Destructor Documentation

◆ Sinusoid() [1/2]

control_toolbox::Sinusoid::Sinusoid ( )

Constructor.

Definition at line 72 of file sinusoid.cpp.

◆ Sinusoid() [2/2]

control_toolbox::Sinusoid::Sinusoid ( double  offset,
double  amplitude,
double  frequency,
double  phase 
)

Constructor which intializes values.

Parameters
offsetA DC offset to be added to the sine wave
amplitudeAmplitude of the sine wave
frequencyFrequency of the sine wave
phasePhase (in radians) of the sine wave at t=0

Definition at line 46 of file sinusoid.cpp.

◆ ~Sinusoid()

control_toolbox::Sinusoid::~Sinusoid ( )
virtual

Destructor

Definition at line 68 of file sinusoid.cpp.

Member Function Documentation

◆ debug()

void control_toolbox::Sinusoid::debug ( )

Prints the parameters of the sine wave to stdout (for debugging)

Definition at line 88 of file sinusoid.cpp.

◆ initXml()

bool control_toolbox::Sinusoid::initXml ( TiXmlElement *  ti_xml_element)

Initializes the parameters of the sine wave from the given xml element.

Parameters
ti_xml_elementThis XML element needs to contain the following attributes: offset, amplitude, frequency, phase
Returns
true if successful, false if not

Definition at line 54 of file sinusoid.cpp.

◆ update()

double control_toolbox::Sinusoid::update ( double  time,
double &  qd,
double &  qdd 
)

Gets the value and derivatives of the sinusoid at a given time.

Parameters
timeTime at which to sample the sine wave
qd(output) The derivative of the sine wave
qdd(output) Second derivative of the sine wave
Returns
The sampled value of the sine wave

Definition at line 76 of file sinusoid.cpp.

Member Data Documentation

◆ amplitude_

double control_toolbox::Sinusoid::amplitude_
private

Amplitude of the sine wave.

Definition at line 133 of file sinusoid.h.

◆ frequency_

double control_toolbox::Sinusoid::frequency_
private

Frequency of the sine wave.

Definition at line 134 of file sinusoid.h.

◆ offset_

double control_toolbox::Sinusoid::offset_
private

DC offset of the sine wave.

Definition at line 132 of file sinusoid.h.

◆ phase_

double control_toolbox::Sinusoid::phase_
private

Phase of the sine wave at t=0.

Definition at line 135 of file sinusoid.h.


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


control_toolbox
Author(s): Melonee Wise, Sachin Chitta, John Hsu
autogenerated on Wed May 11 2022 02:09:47