/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : Yoyo.h                                                        */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _YOYO_H
#define _YOYO_H

#include "ourTypes.h"
#include "Behavior.h"
#include "MathP.h"

#define YoyoBehaviorName "yoyo"

/*
CLASS 
Yoyo

DESCRIPTION

This behavior causes the vehicle to move up and down between two
specified depth extremes.  If it gets too close to the bottom then 
the vehicle will go into an ascent leg of the "yo".

All vertical plane control is pitch control.  This behavior does not
control either heading or speed, so some other behavior must handle
horizontal plane motion.

Termination occurs when either the vehicle has completed the requested
number of yo-yo cycles, or the behavior has run for specified time, whichever
comes first.  Note: one complete cycle consists of both an up and down
motion.

If one wishes to disable the bottom triggered termination of a down leg
(say, because the altimeter is not working properly) then set the
variable min_altitude to a negative value.

Attribute         Type               Meaning
---------         ----               -------
minDepth          Float              Start down when above this depth
maxDepth          Float              Start up when below this depth
minAltitude       Float              Start up when below this altitude
maxCycles         Float              End after this many cycles


AUTHOR
Tom O'Reilly
*/
class Yoyo : public Behavior {

public:

  Yoyo();

  virtual ~Yoyo();

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

  virtual Boolean shouldBehaviorStart();

protected:

  Boolean _goingDown;
  double _minDepth;
  double _maxDepth;
  double _minAltitude;
  double _maxCycles;
  double _cyclesCompleted;
};



#endif
