# Task IDL Specifications

AdvIF
AltimeterIF
BatteryIF
BuoyLauncherIF
CompassIF
CtdIF
DepthSensorIF
DropWeightIF
DynamicControlIF
ExternalCommsIF
FuelCellIF
InclinometerIF
LayeredControlIF
LblIF
MissionPlanIF
NavigationIF
PowerSystemIF
TailConeIF
VehicleConfigurationIF
WorkSiteIF

    /*
    CLASS
    AdvIF

    DESCRIPTION
    TaskInterface to Adv ("Acoustic Doppler Velocimeter") device driver

    AUTHOR
    Tom O'Reilly

    */
    interface AdvIF {

      /////////////////////////////////////////////////////////
      // Water speed
      // [output] speed: Speed (m/sec)
      // [output] time: Sample time
      long waterSpeed(out float speed, out long time);

      /////////////////////////////////////////////////////////
      // Velocity vector
      // [output] dx: Velocity x component
      // [output] dy: Velocity y component
      // [output] dz: Velocity z component
      // [output] quality: Data quality
      // [output] time: Sample time
      long velocity(out double dx, out double dy, out double dz,
                    out short quality,
                    out long time);
    };

    /*
    CLASS
    AltimeterIF

    DESCRIPTION
    TaskInterface to Altimeter device driver

    AUTHOR
    Tom O'Reilly

    */
    interface AltimeterIF {

      /////////////////////////////////////////////////////////
      // Altitude in meters
      // [output] meters: Altitude in meters
      // [output] time: Sample time
      // [output] quality: Data quality
      long altitude(out float meters, out long time, out short quality);
    };

    /*
    CLASS
    BatteryIF

    DESCRIPTION
    TaskInterface to Battery device driver

    AUTHOR
    Tom O'Reilly

    */
    interface BatteryIF {

      ////////////////////////////////////////////////////////////
      // Events generated by Battery device driver
      enum Events {
        LowPower,
        OverVoltage,
        UnderVoltage
      };

      ///////////////////////////////////////////////////////////////////
      // Return life in amp-hours
      long life();

      ///////////////////////////////////////////////////////////////////
      // Get cutoff voltage
      float cutoffVoltage();

      ///////////////////////////////////////////////////////////////////
      // Set cutoff voltage
      // [input] voltage: cutoff voltage
      long setCutoffVoltage(in float voltage);

    };

    /*
    CLASS
    BuoyLauncherIF

    DESCRIPTION
    TaskInterface to BuoyLauncher device driver

    AUTHOR
    Tom O'Reilly

    */
    interface BuoyLauncherIF {

      ////////////////////////////////////////////////////////////
      // Events generated by BuoyLauncher device driver
      enum Events {
        Launched,
        Misfired
      };

      ///////////////////////////////////////////////////////////////////
      // Total number of buoys (launched + unlaunched)
      short nBuoys();

      ///////////////////////////////////////////////////////////////////
      // Number of buoys launched
      short nBuoysLaunched();

      ///////////////////////////////////////////////////////////////////
      // Number of buoys remaining
      short nBuoysRemaining();

      ///////////////////////////////////////////////////////////////////
      // Launch specified buoy
      // [input] buoyNo: Buoy to be launched
      long launch(in short buoyNo);

      ///////////////////////////////////////////////////////////////////
      // Has specified buoy been launched?
      // [input] buoyNo: Buoy to check
      boolean launched(in short buoyNo);
    };

    /*
    CLASS
    CompassIF

    DESCRIPTION
    TaskInterface to Compass device driver

    AUTHOR
    Tom O'Reilly

    */

    interface CompassIF {

      enum Event {
        Online,
        Offline,
        CommsFailure
      };

      /////////////////////////////////////////////////////////
      // Get heading value
      // [output] value: Heading in degrees
      // [output] time: Sampling time
      // [output] quality: Data quality
      long heading(out double value, out long time, out short quality);

      /////////////////////////////////////////////////////////
      // Get heading value and rate
      // [output] value: Heading in degrees
      // [output] value: Heading rate in degrees/sec
      // [output] time: Sampling time
      // [output] quality: Data quality
      long heading(out double value, out double rate,
                   out long time, out short quality);

      ///////////////////////////////////////////////////////////////////
      // Initiate calibration routine
      long calibrate();
    };

    /*
    CLASS
    CtdIF

    DESCRIPTION
    TaskInterface to Ctd device driver

    AUTHOR
    Tom O'Reilly

    */
    interface CtdIF {

      enum Event {
        Online,
        Offline
      };

      /////////////////////////////////////////////////////////
      // Salinity
      // [output] value: Salinity in PSU's
      // [output] time: Sample time
      long salinity(out double value, out long time);

      /////////////////////////////////////////////////////////
      // [output] value: Conductivity
      // [output] time: Sample time
      long conductivity(out double value, out long time);

      /////////////////////////////////////////////////////////
      // [output] value: temperature
      // [output] time: Sample time
      long temperature(out float value, out long time);

      /////////////////////////////////////////////////////////
      // [output] value: depth
      // [output] time: Sample time
      long depth(out double value, out long time);

      /////////////////////////////////////////////////////////
      // [output] value: pressure
      long pressure(out float value, out long time);

      /////////////////////////////////////////////////////////
      // Calculated speed of sound
      // [output] value: Speed of sound, in meters per second
      // [output] time: Sample time
      long speedOfSound(out double value, out long time);

      /////////////////////////////////////////////////////////
      // Set atmospheric pressure
      // [input] pressure: Atmospheric (surface) pressure
      long setAtmPressure(in float pressure);

      ///////////////////////////////////////////////////////////////////
      // Get raw values
      // [output] conductFreq: Conductivity frequency
      // [output] tempFreq: Temperature frequency
      // [output] time: Sample time
      long rawValues(out float conductFreq, out float tempFreq, out long time);

      ///////////////////////////////////////////////////////////////////
      // Start pump
      long startPump();

      ///////////////////////////////////////////////////////////////////
      // Stop pump
      long stopPump();
    };

    /*
    CLASS
    DepthSensorIF

    DESCRIPTION
    TaskInterface to DepthSensor device driver

    AUTHOR
    Tom O'Reilly

    */
    interface DepthSensorIF {

      /////////////////////////////////////////////////////////
      // Pressure
      // [output] value: Pressure (units?)
      // [output] time: Sample time
      long pressure(out float value, out long time);

      /////////////////////////////////////////////////////////
      // Temperature
      // [output] value: Temperature (units?)
      // [output] time: Sample time
      long temperature(out float value, out long time);

      // There may be lots of commands to setup the sensor
    };

    /*
    CLASS
    DropWeightIF

    DESCRIPTION
    TaskInterface to DropWeight device driver

    AUTHOR
    Tom O'Reilly

    */
    interface DropWeightIF {

      enum Event {
        Online,
        Offline,
        Installed,
        Released
      };

      /////////////////////////////////////////////////////////
      // Release drop-weight
      long release();

      /////////////////////////////////////////////////////////
      // Weight released?
      boolean released();

      ///////////////////////////////////////////////////////////////////
      // Set watchdog timeout
      // [input] timeout: Timeout (seconds)
      long setWatchdogTimeout(in long timeout);

      ///////////////////////////////////////////////////////////////////
      // Get watchdog timeout
      long watchdogTimeout();

      ///////////////////////////////////////////////////////////////////
      // Reset watchdog timer
      long resetWatchdog();
    };

    /*
    CLASS
    DynamicControlIF

    DESCRIPTION
    TaskInterface to DynamicControl

    AUTHOR
    Tom O'Reilly
    */
    interface DynamicControlIF {

      ////////////////////////////////////////////////////////////
      // Events generated by DynamicControl
      enum Event {
        Update
      };

      enum DepthMode { DmInitial = -1, Elevator, Depth, Pitch };
      enum HeadingMode { HmInitial = -1, Rudder, Heading, Waypoint };
      enum SpeedMode { SmInitial = -1, Current, Speed };

      /////////////////////////////////////////////////////////
      // Describes command output of LayeredControl
      struct Command {

        double depth;
        double heading;
        double speed;

        DepthMode depthMode;
        HeadingMode headingMode;
        SpeedMode speedMode;
      };

      ///////////////////////////////////////////////////////////////////
      // Command depth, heading, speed
      void setCommand(in Command command);

      ///////////////////////////////////////////////////////////////////
      // Set maximum heading rate
      // [input] rate: Maximum heading rate (meters/sec)
      void setMaxHeadingRate(in double rate);

      ///////////////////////////////////////////////////////////////////
      // Get maximum heading rate (meters/sec)
      double maxHeadingRate();

      ///////////////////////////////////////////////////////////////////
      // Set maximum depth rate
      // [input] rate: Maximum depth rate (meters/sec)
      void setMaxDepthRate(in double rate);

      ///////////////////////////////////////////////////////////////////
      // Get maximum depth rate (meters/sec)
      double maxDepthRate();

      ///////////////////////////////////////////////////////////////////
      // Set tau
      void setTau(in float tau);

      ///////////////////////////////////////////////////////////////////
      // Get tau
      float tau();

      ///////////////////////////////////////////////////////////////////
      // Set pitch servo gains
      void setPitchServoGains(in double proportional, in double integral,
                              in double derivative);

      ///////////////////////////////////////////////////////////////////
      // Get pitch servo gains
      void pitchServoGains(out double proportional, out double integral,
                           out double derivative);

      ///////////////////////////////////////////////////////////////////
      // Set heading servo gains
      void setHeadingServoGains(in double proportional, in double integral,
                                in double derivative);

      ///////////////////////////////////////////////////////////////////
      // Get heading servo gains
      void headingServoGains(out double proportional, out double integral,
                             out double derivative);

    };

    /*
    CLASS
    ExternalCommsIF

    DESCRIPTION
    TaskInterface to ExternalComms

    AUTHOR
    Tom O'Reilly

    */

    interface ExternalCommsIF {

      /////////////////////////////////////////////////////////////////
      // Events generated by ExternalComms
      enum Event {
        LinkChange,
        LinkUp,
        LinkDown
      };

      /////////////////////////////////////////////////////////////////
      // Communications link state
      enum Channel {
        NoLink,
        Ethernet,
        Radio,
        Acoustic
      };

      /////////////////////////////////////////////////////////////////
      // Set communications Channel
      // [input] channel: Channel to use
      long setChannel(in Channel channel);

      /////////////////////////////////////////////////////////////////
      // Get communications Channel
      // [output] channel: Channel currently in use
      void channel(out Channel channel);
    };

    /*
    CLASS
    FuelCellIF

    DESCRIPTION
    TaskInterface to FuelCell device driver

    AUTHOR
    Tom O'Reilly

    */
    interface FuelCellIF {

      ////////////////////////////////////////////////////////////
      // Events generated by FuelCell device driver
      enum Events {
        LowPower,
        OverVoltage,
        UnderVoltage
      };

      ///////////////////////////////////////////////////////////////////
      // Return life in amp-hours
      long life(out long ampHours);

      ///////////////////////////////////////////////////////////////////
      // Get cutoff voltage
      long cutoffVoltage(out float voltage);

      ///////////////////////////////////////////////////////////////////
      // Set cutoff voltage
      // [input] voltage: Cutoff voltage
      long setCutoffVoltage(in float voltage);

      ///////////////////////////////////////////////////////////////////
      // Prepare to launch
      long launch();

      ///////////////////////////////////////////////////////////////////
      // Hold (?)
      long hold();

      ///////////////////////////////////////////////////////////////////
      // Start generating power
      // [output] healthy: FuelCell healthy?
      // [output] safe: FuelCell safe?
      long start(out boolean healthy, out boolean safe);

      ///////////////////////////////////////////////////////////////////
      // Stop generating power
      long stop();

      ///////////////////////////////////////////////////////////////////
      // Perform self-test
      // [output] passed: Passed self-test?
      long selfTest(out boolean passed);

    };

    /*
    CLASS
    InclinometerIF

    DESCRIPTION
    TaskInterface to Inclinometer device driver

    AUTHOR
    Tom O'Reilly

    */
    interface InclinometerIF {

      /////////////////////////////////////////////////////////
      // Attitude
      // [output] roll: Roll (deg)
      // [output] pitch: Pitch (deg)
      // [output] yaw: Yaw (deg)
      // [output] quality: Data quality
      // [output] time: Sample time
      long attitude(out double roll, out double pitch, out double yaw,
                      out short quality, out long time);

      /////////////////////////////////////////////////////////
      // Attitude rates
      // [output] rollRate: Roll rate (deg)
      // [output] pitchRate: Pitch rate (deg)
      // [output] yawRate: Yaw rate (deg)
      // [output] quality: Data quality
      // [output] time: Sample time
      long rates(out double rollRate, out double pitchRate, out double yawRate,
                 out short quality, out long time);
    };

    /*
    CLASS
    LayeredControlIF

    DESCRIPTION
    TaskInterface to LayeredControl

    AUTHOR
    Tom O'Reilly

    */

    interface LayeredControlIF {

      /////////////////////////////////////////////////////////
      // Events generated by LayeredControl
      enum Event {
        MissionStatusChange,
        BadMissionPlan
      };

      enum DepthMode { DmInitial = -1, Elevator, Depth, Pitch };
      enum HeadingMode { HmInitial = -1, Rudder, Heading, Waypoint };
      enum SpeedMode { SmInitial = -1, Current, Speed };

      /////////////////////////////////////////////////////////
      // Describes command output of LayeredControl
      struct OutputCommand {

        double depth;
        double heading;
        double speed;

        DepthMode depthMode;
        HeadingMode headingMode;
        SpeedMode speedMode;
      };

      ///////////////////////////////////////////////////////
      // Get current LayeredControl output command
      // [output] command: Current OutputCommand
      void getCommand(out OutputCommand command);

      ///////////////////////////////////////////////////////
      // Elapsed mission time (seconds)
      long elapsedMissionTime();

      ///////////////////////////////////////////////////////
      // Abort mission
      void abort();

    };

    /*
    CLASS
    LblIF

    DESCRIPTION
    TaskInterface to Lbl device driver

    AUTHOR
    Tom O'Reilly
    */

    interface LblIF {

      enum Event {
        NewData
      };

      ///////////////////////////////////////////////////////////////////
      // Get position
      // [output] northing: Northing (meters)
      // [output] easting: Easting (meters)
      // [output] nRanges: Number of transponders used in calculation
      // [output] quality: Data quality
      long position(out double northing, out double easting, out short nRanges,
                    out double quality);

      ///////////////////////////////////////////////////////////////////
      // Get slantRanges - NEED TO IMPLEMENT ARRAYS FOR IDL
      long slantRanges();

      ///////////////////////////////////////////////////////////////////
      // Update request
      // [input] timeout: Timeout (secs) for update request
      // [input] lockout: ???
      long update(in long timeout, in long lockout);

    };

    /*
    CLASS
    MissionPlanIF

    DESCRIPTION
    TaskInterface to MissionPlan

    AUTHOR
    Tom O'Reilly
    */

    interface MissionPlanIF {

      typedef sequence BehaviorArgs;

      struct Behavior {

        /////////////////////////////////////////////////////////
        // Unique identifier for Behavior
        long id;

        /////////////////////////////////////////////////////////
        // Arguments to Behavior
        BehaviorArgs args;

        /////////////////////////////////////////////////////////
        // Priority within plan
        short priority;

        /////////////////////////////////////////////////////////
        // Starting mission time of behavior
        long startTime;

        /////////////////////////////////////////////////////////
        // Duration of behavior
        long duration;
      };

      typedef sequence Behaviors;

      /////////////////////////////////////////////////////////
      // Get entire plan
      // [output] nBehaviors: Number of Behaviors in plan
      // [output] Behaviors: Array of Behaviors
      short getPlan(out short nBehaviors, out Behaviors behaviors);

      /////////////////////////////////////////////////////////
      // Number of Behaviors
      short nBehaviors();

      /////////////////////////////////////////////////////////
      // Get nth Behavior
      short nthBehavior(in short n, out Behavior behavior);
    };

    /*
    CLASS
    NavigationIF

    DESCRIPTION
    TaskInterface to Navigation

    AUTHOR
    Tom O'Reilly

    */
    interface NavigationIF {

      ////////////////////////////////////////////////////////////
      // Defined events
      enum Event {
        NewAttitude,
        NewPosition
      };

      ////////////////////////////////////////////////////////////
      // Vehicle attitude and rates
      struct Attitude {
        double roll;
        double pitch;
        double yaw;
        double rollRate;
        double pitchRate;
        double yawRate;
        long updateTime;
        short quality;
      };

      ////////////////////////////////////////////////////////////
      // Vehicle position and rates
      struct Position {
        double x;
        double y;
        double z;
        double depth;
        double altitude;
        double xRate;
        double yRate;
        double zRate;
        double depthRate;
        double altitudeRate;
        long updateTime;
        short quality;
      };

      ////////////////////////////////////////////////////////////
      // Get current navigation State
      // [output] position: Vehicle Position
      // [output] attitude: Vehicle Attitude
      void state(out Position position, out Attitude attitude);

      ////////////////////////////////////////////////////////////
      // Get vehicle heading
      // [output] heading: Heading (degrees)
      void heading(out double heading);

      ////////////////////////////////////////////////////////////
      // Get vehicle location
      // [ouput] latitude: Latitude (degrees)
      // [output] longitude: Longitude (degrees)
      // [output] depth: Depth (meters)
      // [output] altitude: Altitude (meters)
      void location(out double latitude, out double longitude,
                    out double depth, out double altitude);

      ////////////////////////////////////////////////////////////
      // Get speed
      // [output] speed: meters/sec
      void speed(out float speed);

      ////////////////////////////////////////////////////////////
      // Get vehicle course
      // [output] angle: Course angle (degrees)
      void course(out double angle);

      ////////////////////////////////////////////////////////////
      // Get vehicle depth
      // [output] depth: meters
      void depth(out double depth);

      ////////////////////////////////////////////////////////////
      // Get vehicle altitude
      // [output] altitude: meters
      void altitude(out double altitude);

      ////////////////////////////////////////////////////////////
      // Set magnetic variation
      // [input] angle: variation (degrees)
      void setMagneticVariation(in double angle);

      ////////////////////////////////////////////////////////////
      // Get magnetic variation angle (degrees)
      double magneticVariation();

      ////////////////////////////////////////////////////////////
      // Calculation mode
      enum Mode {
        DeadReckoning,
        Measured
      };

      ///////////////////////////////////////////////////////////////////
      // Get calculation mode
      void mode(out Mode mode);

    };

    /*
    CLASS
    PowerSystemIF

    DESCRIPTION
    TaskInterface to PowerSystem

    AUTHOR
    Tom O'Reilly
    */

    interface PowerSystemIF {

      ////////////////////////////////////////////////////////////
      // Events generated by PowerSystem
      enum Event {
        Critical
      };

    };

    /*
    CLASS
    TailConeIF

    DESCRIPTION
    TaskInterface to TailCone device driver

    AUTHOR
    Tom O'Reilly

    */
    interface TailConeIF {

      enum Event {
        Reset,
        Online,
        Offline,
        CommsFailure,
        GroundFault,
        WaterAlarm,
        MotorOverTemperature,
        MotorOverCurrent,
        ActuatorOverCurrent
      };

      enum MotorType {
        MbariMotor
      };

      /////////////////////////////////////////////////////////
      // Set propeller speed
      // [input] rpm: Propeller speed in rpm
      long setPropellerSpeed(in long rpm);

      /////////////////////////////////////////////////////////
      // Set elevator angle
      // [input] angle: Angle in degrees
      long setElevator(in double angle);

      /////////////////////////////////////////////////////////
      // Set rudder angle
      // [input] angle: Angle in degrees
      long setRudder(in double angle);

      /////////////////////////////////////////////////////////
      // Command speed, elevator, and rudder angles
      // [input] speed: Propeller speed in rpm
      // [input] elevator: Elevator angle in degrees
      // [input] rudder: Rudder angle in degrees
      long command(in long speed, in double elevator, in double rudder);

      /////////////////////////////////////////////////////////
      // Return status
      long initialize();

      /////////////////////////////////////////////////////////
      // Set deadman timer
      long setDeadman(in short seconds);

      /////////////////////////////////////////////////////////
      // Configure tailcone
      // [input] serialNo: Serial number
      // [input] type: MotorType
      // [input] slewRate: Slew rate of actuators (deg/sec)
      // [input] currentLimit: current limit of actuators and motor
      long configure(in short serialNo, in MotorType type,
                       in double slewRate, in long currentLimit);

      /////////////////////////////////////////////////////////
      // Get tailcone configuration
      // [output] serialNo: Serial number
      // [output] type: MotorType
      // [output] slewRate: Slew rate of actuators (deg/sec)
      // [output] currentLimit: current limit of actuators and motor
      long configuration(out short serialNo, out MotorType type,
                          out double slewRate, out long currentLimit);

      /////////////////////////////////////////////////////////
      // Propeller speed
      // [output] speed: Propeller speed (rpm)
      // [output] time: Sample time
      long propellerSpeed(out long speed, out long time);

      /////////////////////////////////////////////////////////
      // Elevator angle
      // [output] angle: Elevator angle (deg)
      // [output] time: Sample time
      long elevator(out double angle, out long time);

      /////////////////////////////////////////////////////////
      // Rudder angle
      // [output] angle: Rudder angle (deg)
      // [output] time: Sample time
      long rudder(out double angle, out long time);

      /////////////////////////////////////////////////////////
      // Get propeller speed, elevator, and rudder angles
      // [output] speed: Propeller speed (rpm)
      // [output] elevator: Elevator angle (deg)
      // [output] rudder: Rudder angle (deg)
      // [output] time: Sample time
      long actual(out long speed, out double elevator, out double rudder,
                   out long time);

      /////////////////////////////////////////////////////////
      // Get status word
      // [output] statusWord: health status word
      // [output] time: Sample time
      long health(out long statusWord, out long time);

      /////////////////////////////////////////////////////////
      //
      // long engineeringTelemetry(long counts, etc....);

      /////////////////////////////////////////////////////////
      // Get temperatures
      // [output] motor: Motor temperature (deg C)
      // [output] actuator: Actuator temperature (deg C)
      // [output] time: Sample time
      long temperatures(out float motor, out float actuator, out long time);

      /////////////////////////////////////////////////////////
      // Get currents
      // [output] motor: Motor current
      // [output] actuator: Actuator current
      // [output] time: Sample time
      long currents(out float motor, out float actuator, out long time);

      /////////////////////////////////////////////////////////
      // Ground-fault current
      // [output] current: Ground-fault current
      long groundFault(out float current);
    };

    /*
    CLASS
    VehicleConfigurationIF

    DESCRIPTION
    TaskInterface to VehicleConfiguration

    AUTHOR
    Tom O'Reilly
    */

    interface VehicleConfigurationIF {

      typedef sequence Name;

      ///////////////////////////////////////////////////////////////////
      // Get vehicle name
      void vehicleName(out Name name);

      ///////////////////////////////////////////////////////////////////
      // Get propeller pitch
      double propPitch();

      ///////////////////////////////////////////////////////////////////
      // Get vehicle drag coefficient
      double dragCoefficient();

    };

    /*
    CLASS
    WorksiteIF

    DESCRIPTION
    TaskInterface to WorkSite

    AUTHOR
    Tom O'Reilly
    */

    interface WorkSiteIF {

      ///////////////////////////////////////////////////////////////////
      // Approximate latitude
      double latitude();

      ///////////////////////////////////////////////////////////////////
      // Approximte longitude
      double longitude();

      ///////////////////////////////////////////////////////////////////
      // Surface pressure
      double magneticVariation();

      ///////////////////////////////////////////////////////////////////
      // Number of LBL transponders
      short nLblTransponders();

      ///////////////////////////////////////////////////////////////////
      // Parameters for nth LBL transponder
      // [input] transponderNo: Transponder number
      // [output] easting: Transponder easting
      // [output] northing: Transponder northing
      // [output] depth: Transponder depth
      // [output] turnaroundTime: Transponder turnaround
      void getTransponder(in short transponderNo,
                          out double easting, out double northing,
      		      out double depth, out long turnaroundTime);
    };