/*
********************************************************
Copyright 2000 MBARI.
MBARI Proprietary Information. All rights reserved.
NOTE: This file is automatically generated.
DO NOT MODIFY.
********************************************************
*/

#ifndef __SimulatorIF_H
#define __SimulatorIF_H

#include "TaskInterface.h"


#define SimulatorIFServerName "SimulatorIFServer"

/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : SimulatorIF.idl                                               */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
/*
CLASS 
SimulatorIF

DESCRIPTION
TaskInterface to Simulator

AUTHOR
Tom O'Reilly
*/
class SimulatorIF : public TaskInterface {

  friend class SimulatorIF_SK;

  public:

  
  ////////////////////////////////////////////////////////////
  // Clients can subscribe to these events...
  enum Event {
    NewOutput
  };

  
  typedef double Vector[3];
  
  SimulatorIF(const char *name, int timeout = 10);

  SimulatorIF(const char *name, const char *serverName, int timeout = 10);

  ~SimulatorIF();

  ////////////////////////////////////////////////////////////
  // Set current velocity
  long setCurrent(double north, double east);

  ////////////////////////////////////////////////////////////
  // Set propeller speed (rads/sec), elevator (rads), and rudder (rads)
  long command(double propOmega, double elevator, double rudder);

  ////////////////////////////////////////////////////////////
  // Get position vector and Euler angles
  long state(SimulatorIF::Vector position, SimulatorIF::Vector positionRate, SimulatorIF::Vector euler, SimulatorIF::Vector eulerRate);

  ////////////////////////////////////////////////////////////
  // Get rotational velocity components
  long rotationalVelocity(SimulatorIF::Vector velocity, SimulatorIF::Vector backDiff);

  ////////////////////////////////////////////////////////////
  // Get translational velocity components
  long translationalVelocity(SimulatorIF::Vector velocity, SimulatorIF::Vector backDiff);

  ////////////////////////////////////////////////////////////
  // Get translational velocity components
  long translationalBottomVelocity(SimulatorIF::Vector vel_Bo_N_B);

  ////////////////////////////////////////////////////////////
  // Get control surface angles
  long controlSurfaces(double *rudder, double *elevator);

  ////////////////////////////////////////////////////////////
  // Get body force vector
  long force(SimulatorIF::Vector vector);

  ////////////////////////////////////////////////////////////
  // Get body torque vector
  long torque(SimulatorIF::Vector vector);

  ////////////////////////////////////////////////////////////
  // Get prop angular speed
  long propOmega(double *rpm);

  ////////////////////////////////////////////////////////////
  // Get thruster current
  long motorCurrent(double *motor);

  ////////////////////////////////////////////////////////////
  // Get water speed
  long waterSpeed(double *waterSpeed);

  ////////////////////////////////////////////////////////////
  // Get simulation time (seconds)
  double simTime();

  ////////////////////////////////////////////////////////////
  // Get water depth
  double waterDepth();

  ////////////////////////////////////////////////////////////
  // Get integer number of elapsed sample periods
  long nTs();

  
  protected:

  // Message codes for each method
  enum SimulatorIFMsgCode {
    SetCurrentMsgCode,
    CommandMsgCode,
    StateMsgCode,
    RotationalVelocityMsgCode,
    TranslationalVelocityMsgCode,
    TranslationalBottomVelocityMsgCode,
    ControlSurfacesMsgCode,
    ForceMsgCode,
    TorqueMsgCode,
    PropOmegaMsgCode,
    MotorCurrentMsgCode,
    WaterSpeedMsgCode,
    SimTimeMsgCode,
    WaterDepthMsgCode,
    NTsMsgCode
  };

  // Define message structure for each method
  struct SetCurrentMsg : Request, Reply {
    long returnVal;
    double north;
    double east;
  
  } _setCurrentMsg;

  struct CommandMsg : Request, Reply {
    long returnVal;
    double propOmega;
    double elevator;
    double rudder;
  
  } _commandMsg;

  struct StateMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector position;
    SimulatorIF::Vector positionRate;
    SimulatorIF::Vector euler;
    SimulatorIF::Vector eulerRate;
  
  } _stateMsg;

  struct RotationalVelocityMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector velocity;
    SimulatorIF::Vector backDiff;
  
  } _rotationalVelocityMsg;

  struct TranslationalVelocityMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector velocity;
    SimulatorIF::Vector backDiff;
  
  } _translationalVelocityMsg;

  struct TranslationalBottomVelocityMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector vel_Bo_N_B;
  
  } _translationalBottomVelocityMsg;

  struct ControlSurfacesMsg : Request, Reply {
    long returnVal;
    double rudder;
    double elevator;
  
  } _controlSurfacesMsg;

  struct ForceMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector vector;
  
  } _forceMsg;

  struct TorqueMsg : Request, Reply {
    long returnVal;
    SimulatorIF::Vector vector;
  
  } _torqueMsg;

  struct PropOmegaMsg : Request, Reply {
    long returnVal;
    double rpm;
  
  } _propOmegaMsg;

  struct MotorCurrentMsg : Request, Reply {
    long returnVal;
    double motor;
  
  } _motorCurrentMsg;

  struct WaterSpeedMsg : Request, Reply {
    long returnVal;
    double waterSpeed;
  
  } _waterSpeedMsg;

  struct SimTimeMsg : Request, Reply {
    double returnVal;
  
  } _simTimeMsg;

  struct WaterDepthMsg : Request, Reply {
    double returnVal;
  
  } _waterDepthMsg;

  struct NTsMsg : Request, Reply {
    long returnVal;
  
  } _nTsMsg;

};

#endif

