/** \file
 *
 *  Contains the PitchRateCalculator class declaration.
 *
 *  PitchRateCalculator.h should only be included by PitchRateCalculator.cpp
 *  Other classes should include PitchRateCalculatorIF.h
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef PITCHRATECALCULATOR_H_
#define PITCHRATECALCULATOR_H_

#include "component/SyncComponent.h"

class UniversalDataReader;
class UniversalDataWriter;

/**
 *  Over simplified PitchRateCalculator component
 *
 *  PitchRateCalculator.h should only be included by PitchRateCalculator.cpp
 *  Other classes should include PitchRateCalculatorIF.h
 *
 *  Uses a simple differencing formula
 *  \f$ d\theta/dt \approx \frac{\theta(t)-\theta(t-\delta t)}{\delta t} \f$
 *  to calculate the depth rate.
 *
 *  \todo augment with 3 and 4-point backwards difference formulas:
 *  \f$ d\theta/dt \approx \frac{3\theta(t)-4\theta(t-\delta t)+\theta(t-2\delta t)}{2\delta t} \f$
 *  and
 *  \f$ d\theta/dt \approx \frac{11\theta(t)-18\theta(t-\delta t)+9\theta(t-2\delta t)-2\theta(t-3\delta t)}{6\delta t} \f$
 *
 *  \ingroup modules_derivation
 */
class PitchRateCalculator : public SyncDerivationComponent
{
public:
    PitchRateCalculator( const Module* module );
    virtual ~PitchRateCalculator();

    /// Initialize function
    void initialize( void );

    /// The actual "payload" of the component
    void run();

private:

    float lastPitch_;

    // Accessors
    UniversalDataReader* pitchReader_;
    UniversalDataWriter* pitchRateWriter_;

};

#endif /*RATECALCULATOR_H_*/
