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

#ifndef YAWRATECALCULATOR_H_
#define YAWRATECALCULATOR_H_

#include "component/SyncComponent.h"

class UniversalDataReader;
class UniversalDataWriter;

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

    /// Initialize function
    void initialize( void );

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

private:

    float lastOrientation_;

    // Accessors
    UniversalDataReader* orientationReader_;
    UniversalDataWriter* yawRateWriter_;
};

#endif /*RATECALCULATOR_H_*/
