Class Sinusoid

Class Documentation

class Sinusoid

A basic sine class.

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

Public Functions

Sinusoid()

Constructor.

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

Constructor which initializes values.

Parameters:
  • offset – A DC offset to be added to the sine wave

  • amplitude – Amplitude of the sine wave

  • frequency – Frequency of the sine wave

  • phase – Phase (in radians) of the sine wave at t=0

virtual ~Sinusoid()

Destructor

void debug()

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

double update(double time, double &qd, double &qdd)

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

Parameters:
  • time – Time 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