/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : CurrentBuoy.h                                                 */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 10/17/2001                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _CurrentBuoy_H
#define _CurrentBuoy_H

#include "ourTypes.h"
#include "Behavior.h"
#include "DynamicControlIF.h"
#include "BuoyLauncherIF.h"

#define CurrentBuoyBehaviorName "CurrentBuoy"

#define NullLegDuration -1.0

class FloatAttribute;
class AngleAttribute;

/*
CLASS 
CurrentBuoy

DESCRIPTION
Move a specific buoy into the data position.

Attribute       Type               Meaning
---------       ----               -------
heading         angle              Commanded heading
speed           double             Commanded speed
verticalMode    VerticalMode       Either "depth" or "pitch"
depth           double             Commanded depth if verticalMode is "depth"
pitch           angle              Commanded pitch if verticalMode is "pitch"
legDuration     integer            Duration of each leg 
maxLegs         integer            Maximum number of legs
headingInc      angle              Increment heading by this amount after 
                                   each leg
AUTHOR
*/
class CurrentBuoy : public Behavior {

public:

  CurrentBuoy();

  virtual ~CurrentBuoy();

  virtual void execute();
  Boolean shouldBehaviorStart( void );
  virtual Boolean validInput();

protected:

  //
  // Open an interface to the Buoy Launcher:
  //
  BuoyLauncherIF *_buoyLauncher;


  // Desired heading; will get incremented after each leg
  double _heading;

  // Desired speed
  double _speed;

  // Vertical mode 
  DynamicControlIF::VerticalMode _verticalMode;

  // Desired depth if verticalMode is Depth
  double _depth;

  // Buoy number to move in data position
  long  _buoyNumber;

  // True when the launcher has been sent the current buoy request
  Boolean _commandSent;

  // Desired pitch if verticalMode is Pitch
  double _pitch;

  // Maximum number of legs to do
  long _maxLegs;

  // Duration (secs) of each leg
  long _legDuration;

  // Increment heading by this amount after each leg
  double _headingIncrement;

  // Number of legs completed
  int _legsCompleted;

  // Starting time of current leg
  double _legStartTime;

  // Used to slow down waiting message
  Boolean _waitMessage;

  FloatAttribute *_depthAttribute;
  AngleAttribute *_pitchAttribute;
};

#endif
