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

#ifndef SPEEDCONTROL_H_
#define SPEEDCONTROL_H_

#include "component/SyncComponent.h"

class Timestamp;
class UniversalDataReader;

/**
 *  This is the primary "control" for the vehicle's speed.
 *  It accepts inputs that
 *  specify the desired speed for the vehicle, and
 *  combined with thruster sensor inputs, converts
 *  the settings to commands that are ultimately relayed to devices via
 *  ThrusterServo.
 *
 *  SpeedControl.h should only be included by SpeedControl.cpp
 *  Other classes should include SpeedControlIF.h
 *
 *  \ingroup modules_control
 */
class SpeedControl : public SyncControlComponent
{
public:

    SpeedControl( const Module* module );

    virtual ~SpeedControl();

    void initialize( void );

    void run();

    void uninitialize( void );

private:

    // Note that the copy constructor below is private and not given a body.
    // Any attempt to call it will return a compiler error.
    SpeedControl( const SpeedControl& old ); // disallow copy constructor

    bool ok_;

    float propPitch_;

    float propOmegaMargin_;

    bool readConfig( void );

    void controlSpeed();

    float calcPropOmga( float speedMetersPerSec );

    void setSpeed( float speedCmd );

    DataReader *speedCmdReader_;

    ConfigReader *propPitchCfgReader_;

    UniversalDataReader *speedReader_;

    DataWriter *propOmegaActionWriter_;

};

#endif /*SAMPLECOMPONENT_H_*/
