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

#ifndef BUOYANCY_H_
#define BUOYANCY_H_

#include "component/Behavior.h"
#include "data/Location.h"

class UniversalDataReader;

/**
 *  Contains the Buoyancy Command
 *
 *  Is not satisfied until the specified buoyancy duration
 *  has passed.
 *
 *  Buoyancy.h should only be included by Buoyancy.cpp
 *  Other classes should include BuoyancyIF.h
 *
 *  \ingroup modules_guidance
 */
class Buoyancy : public Behavior
{
public:

    Buoyancy( const Str& prefix, const Module* module );

    virtual ~Buoyancy();

    /// Initialize function
    void initialize( void );

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

    /// Runs and returns false if not in capure radius
    /// Otherwise returns true
    bool runIfUnsatisfied();

    /// Returns true when vehicle has "arrived"
    /// within the captureRadius of the waypoint
    bool isSatisfied();

    /// Uninit function
    void uninitialize( void );

    /// Mission Component factory interface
    static Behavior* CreateBehavior( const Str& prefix, const Module* module );

protected:

    /// return true if the buoyancying time is over
    bool calcSatisfied( );

    // Positon at which to stop buoyancying
    double positionSetting_;

    // Allowable error is buoyancy
    double buoyancyDeviation_;

    // Servo ConfigReader
    ConfigReader* buoyancyDeviationCfgReader_;

    // Slate input setting variables
    UniversalDataReader *positionReader_;

    /// position setting
    SettingReader *positionSettingReader_;

    /// position to VerticalControl
    DataWriter* positionCmdWriter_;

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

};

#endif /*BUOYANCY_H_*/
