////////////////////////////////////////////////////////////////
//
// PURPOSE: This contains ControlModule parameters for Tethys.
//
// NOTES:   All values (except "strings") must be followed by
//          a unit abbreviation (or one of the unit-like
//          abbreviations: n/a, bool, enum, count).
//
////////////////////////////////////////////////////////////////

HorizontalControl_enable = 1 bool;

   kdHeading             = 0.05 s;            // Rate gain
   kiHeading             = 0.001 1/s;         // Integral gain
   kpHeading             = 0.4 n/a;           // Position gain,
// kwpHeading            = 0.00157 rad/m;     // Cross-track error gain - converts to 45 degrees at 500 meters
   kwpHeading            = .05 rad/m;         // Cross-track error gain
   kiwpHeading           = 0.0005 rad/s/m;    // Cross-track integral error gain
   maxHdgAccel           = 7.5 arcdeg/s2;     // Max turn accel
   maxHdgInt             = 0.0872664 rad;     // Max cmded rudder from hdg int
   maxHdgRate            = 12.0 arcdeg/s;     // Max turn rate
   maxKxte               = 45. arcdeg;        // Max heading correction due to kwpHeading
   rudDeadband           = 0.0 arcdeg;        // Degree of rounding in output values
   rudLimit              = 15 arcdeg;         // Max rudder angle

LoopControl_enable = 1 bool;

   nominalDt             = 0.400 s;           // Nominal control cycle period used in determining control constants

SpeedControl_enable = 1 bool;

VerticalControl_enable = 1 bool;

   buoyancyDefault       = 945.0 cc;          // Default amount of oil to be stored in the bladder
   buoyancyLimitHiCC     = 955 cc;            // High limit for oil. Should be less than the above physical limit for motor controller
   buoyancyLimitLoCC     = 80  cc;            // Low limit for oil. Should be less than the above physical limit for motor controller
   buoyancyNeutral       = 418.0 cc;          // Amount of oil stored in the bladder when the vehicle is neutral
   buoyancyPumpDepth     = 85.0 m;            // Depth must be <= this value in order to safely pump
   depthDeadband         = 0.01 m;            // Buoy loop off within deadband
   depthRateDeadband     = 0.015 m/s;         // Values less than this value are
                                              // considered to be zero.
   depthRateSamples      = 50 count;          // Number of depth rate samples to average.
   dropWtDepthExcursion  = 10 meter;          // If we are requesting upwards motion,
                                              // and haven't achieved it within this time
                                              // drop the drop weight to go up.
   dropWtOverrideDelay   = 18 min;            // If we are requesting upwards motion,
                                              // and haven't achieved it within this time
                                              // drop the drop weight to go up.
   elevDeadband          = 0.0 arcdeg;        // Degree of rounding in output values
   elevLimit             = 15. arcdeg;        // max elevator angle
   elevTurnTime          = 5.0 s;             // Time to reach inflection in elevator mode
   kdDepth               = 0.0 rad-s/m;       // Dive loop deriv. gain // was 0.12
   kdDepthBuoy           = 0.0 s;             // Buoy loop deriv. gain cc/(m/s)
   kdDepthRateBuoy       = 0.0 s;             // Buoy loop deriv. gain cc/(m/s)
   kdPitchElevator       = 0.05 s;            // Derivative gain
   kdPitchMass           = 0.20 s;            // Derivative gain
   kiDepth               = 0.002 rad/s/m;     // Dive loop int. gain  // was 0.0008
   kiDepthBuoy           = 0.60 1/s;          // Buoyancy loop int. gain
   kiDepthOff            = 0.20 m/s;          // Integrator shut-off
   kiDepthRateBuoy       = 15.0 1/s;          // Buoyancy loop int. gain
   kiPitchElevator       = 0.008 1/s;         // Integral gain
   kiPitchMass           = 0.002 1/s;         // Integral gain
   kpDepth               = 0.08 rad/m;        // Dive loop pos'n gain  // was 0.09
   kpDepthBuoy           = 120. ratio;        // Buoyancy loop pos'n gain cc/m
   kpDepthRateBuoy       = 1500. ratio;       // Buoyancy loop pos'n gain cc/m
   kpPitchElevator       = 0.25 n/a;          // Proportional gain
   kpPitchMass           = 0.10 n/a;          // Proportional gain
   massDeadband          = 0.0 mm;            // Degree of rounding in output values
   massDefault           = 0.15 cm;              // Position of mass at pitch=0 at neutral buoyancy
   massFilterLimit       = 5 degree;          // Don't use the filter if error exceeds this value
   massFilterWidth       = 17 second;         // Size of filter for pitch error values
   massPositionLimit     = 28 mm;             // max offset forward or aft of center
   massTurnTime          = 17.0 s;            // Time to reach inflection in mass-only mode
   maxBuoyDiveAccel      = 0.00025 m/s2;      // Maximum dive accel with prop off
   maxBuoyDiveRate       = 0.0500 m/s;        // Maximum dive rate with prop off
   maxBuoyInt            = 200.0 cc;          // Maximum buoyancy int. value
   maxDepthInt           = 20. arcdeg;        // max cmded pitch frm depth int
   maxDiveAccel          = 0.001 m/s2;        // Maximum dive accel
   maxDiveRate           = 0.500 m/s;         // Maximum dive rate
   maxPitchElevatorInt   = 15. arcdeg;        // max cmded elev from pitch int
   maxPitchMassInt       = 30 mm;             // max cmded mass posn from pitch int
   minDepthExcursion     = 1 meter;           // Excursions less than this are ignored when
                                              // determining if up/downward motion is needed
   pitchLimit            = 30.0 arcdeg;       // Max pitch
   pitchRateSamples      = 3 count;           // Number of pitch rate samples to average.
   stopDepthExcursion    = 5 meter;           // If we are requesting upwards motion,
                                              // and haven't achieved it within this depth
                                              // stop the mission (run default mission) to go up.
   stopOverrideDelay     = 5 min;             // If we are requesting upwards motion,
                                              // and haven't achieved it within this time
                                              // stop the mission (run default mission) to go up.
   stopOverrideDelayBuoy = 14 min;            // If we are requesting upwards motion,
                                              // and haven't achieved it within this time with the prop off
                                              // stop the mission (run default mission) to go up.
