#ifndef _moogdef_H
#define _moogdef_H
/****************************************************************************/
/* Copyright 1991 to 1993 MBARI                                             */
/****************************************************************************/
/* Summary  : Moog Motor Micro - Public Data Structues and Constants        */
/* Filename : moogdef.h                                                     */
/* Author   : Andrew Pearce                                                 */
/* Project  : Tiburon ROV                                                   */
/* Version  : Version 1.0                                                   */
/* Created  : 07/07/93                                                      */
/* Modified : 07/07/93                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: moogdef.h,v 1.4 95/09/21 10:38:41 pean Exp $
 * $Log:        moogdef.h,v $
 * Revision 1.4  95/09/21  10:38:41  10:38:41  pean (Andrew Pearce)
 * Fixed intermittent water alarms caused by error in K Ohm calculation
 *
 * Revision 1.3  94/08/26  16:30:12  16:30:12  pean (Andrew Pearce)
 * Master/Slave version of serial protocol.
 * Added warning and alarm levels for temperature alarm
 * Water alarm threshold now externally settable in K Ohms
 *  Alarm added for NV RAM Initialization
 *
 * Revision 1.2  94/02/01  10:41:32  10:41:32  pean (Andrew Pearce)
 * Added commands to set Frame Acknowledge Timeout, get Retransmission
 * statistics, and to enable automatic motor disable on serial link failure.
 * Added MOTOR_DISABLE_SRQ alarm reporting if motor auto disables
 *
 * Revision 1.1  93/11/12  11:02:50  11:02:50  pean (Andrew Pearce)
 * Initial revision
 *
*/
/****************************************************************************/

typedef enum                        /* Motor Control Modes                  */
{
    CURRENT,                        /* Basic current mode                   */
    TORQUE,                         /* Torque mode (uncompensated)          */
    VELOCITY,                       /* Velocity mode                        */
    LINEARIZED,                     /* Linearizing mode                     */
    COMP_TORQUE_1,                  /* Computed Torque mode 1               */
    COMP_TORQUE_2                   /* Computer Torque mode 2               */
} motorCtrlMode;

typedef enum                        /* Motor Status Reports                 */
{
    STATUS_UNKNOWN,                 /* Motor status unknown                 */
    MOTOR_NO_FAULT,                 /* No fault detected                    */
    MOTOR_CONTROLLER_VOLTS,         /* Motor controller under-voltage       */
    MOTOR_CONTROLLER_TEMP,          /* Motor controller temperature         */
    MOTOR_STALL,                    /* Motor has stalled                    */
    MOTOR_RESOLVER,                 /* Motor Resolver Failure               */
    MOTOR_OVERCURRENT,              /* Motor overcurrent                    */
    MOTOR_FAULT                     /* Other motor fault condition          */
} motorFaultStatus;

#define MAX_CMD_THRUST  1245        /* Maxiumum thrust value sent to motor  */

#define NV_RAM_DATE_LEN        22   /* Length of Date/Time in NV RAM        */
#define MOTOR_SERNO_LEN        10   /* Length of Motor Serial Number        */

#define VELOCITY_GAIN_SIZE      3   /* Number of gains for velocity mode    */
#define LINEARIZED_GAIN_SIZE    2   /* Number of gains for linear mode      */

#define VEL_PROP_GAIN           0   /* Velocity Mode Proportional Gain Index*/
#define VEL_DERIV_GAIN          1   /* Velocity Mode Derivative Gain Index  */
#define VEL_POWER_GAIN          2   /* Velocity Mode Power Gain Index       */

                                    /* Velocity control mode gains          */
typedef Int16 velocity_gains[VELOCITY_GAIN_SIZE];
                                    /* Linearized control mode gains        */
typedef Int16 linearized_gains[LINEARIZED_GAIN_SIZE];


#define LINEAR_THRUST_GAIN      0   /* Linear Mode Thrust Gain Index        */
#define LINEAR_VELOCITY_GAIN    1   /* Linear Mode Velocity Gain Index      */

#define MOTOR_DAS_BUF_SIZE    512   /* Number of measurements for DAS mode  */
#define DAS_SAMPLES_PER_PKT    32   /* Number DAS Measurements per pkt      */

#define MOTOR_BYPASS_CAPACITANCE 4  /* 4 uF bypass capacitor per motor      */

#endif /* _moogdef_H */
