//////////////////////////////////////////////////////////////// 
// 
// PURPOSE: This contains ServoModule 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). 
// 
//////////////////////////////////////////////////////////////// 

BuoyancyServo.loadAtStartup        = 1 bool;
BuoyancyServo.simulateHardware     = 1 bool;

BuoyancyServo.accel                = 800 n/a;
BuoyancyServo.currLimit            = 100 %;             // Percent of current allowed
BuoyancyServo.limitHi              = 8200 count;        // High physical limit for motor controllers
BuoyancyServo.limitLo              = 475  count;        // Low physical limit for motor controller
BuoyancyServo.overloadTimeout      = 10000 ms;          // ms until an overload is reported
BuoyancyServo.pidW                 = 1500 count;
BuoyancyServo.pidX                 = 0 count;
BuoyancyServo.pidY                 = 3000 count;
BuoyancyServo.powerOffTimeout      = 1.5 second;        // Time to allow system to completely close valve
BuoyancyServo.powerOnTimeout       = 0.8 second;        // Time to allow system to power up before commanding
BuoyancyServo.velocity             = 800 n/a;

// BuoyancyServo-only settings
BuoyancyServo.checkingTimeout      = 240.0 min;         // If the buoyancy is idling, this is how often to check for actual position. If there's a leak, this is when we'll find it.
BuoyancyServo.countsPerCC          = 7.446016 count/cc; // counts on the A/D per ml of fluid pumped
BuoyancyServo.deviationVolume      = 10.0 cc;           // Number of ml deviation allowed between expected and actual
BuoyancyServo.fastPumpCoefficient  = 4 n/a;             // Specifies how many times faster than normal the pump should operate in fast mode (e.g., 2 means twice as fast)
BuoyancyServo.fastPumpDepth        = 1.5 meter;         // Max depth for pumping at a fast rate
BuoyancyServo.offsetVolume         = 98.452 cc;         // Offset of position of motor controller

DockingServo.loadAtStartup          = 0 bool;
DockingServo.simulateHardware       = 1 bool;
DockingServo.countsPerDeg           = 454.666 count/arcdeg; // motor "ticks" per degree of control surface motion
DockingServo.currLimit              = 50 %; // Running higher than older rev H EZ servo cards due to new circuit
DockingServo.deviationAngle         = .1 arcdeg;           // Number of degrees deviation allowed between expected and actual
DockingServo.limitHi                = 25000 count;          // High physical limit for motor controller
DockingServo.limitLo                = 0 count;              // Low physical limit for motor controller
DockingServo.mtrCenter              = 10 count;             // 0 degrees closed control surface
DockingServo.offsetAngle            = 0 degree;
DockingServo.pidW                   = 500 count;            // Proportional gain
DockingServo.pidX                   = 100 count;            // Integral gain
DockingServo.pidY                   = 400 count;            // Differential gain
DockingServo.powerOnTimeout         = 0.5 second;           // Time to allow system to power up before commanding
// NOTE: For rudder/elevator velocity can currently be set as high as 2000000 with acceleration at 4000. 08/11/2009 - Kieft
DockingServo.openAngle              = 30 degree;
DockingServo.closedAngle            = 0 degree;

ElevatorServo.loadAtStartup        = 1 bool;
ElevatorServo.simulateHardware     = 1 bool;

ElevatorServo.countsPerDeg         = 454.666 count/arcdeg; // motor "ticks" per degree of control surface motion
ElevatorServo.currLimit            = 10 %;                 // Percent of current allowed
ElevatorServo.deviationAngle       = .05 arcdeg;           // Number of degrees deviation allowed between expected and actual
ElevatorServo.limitHi              = 16369 count;          // High physical limit for motor controller
ElevatorServo.limitLo              = 0 count;              // Low physical limit for motor controller
ElevatorServo.mtrCenter            = 8184 count;           // 0 degrees "centered" control surface
ElevatorServo.offsetAngle          = 0 degree;
ElevatorServo.pidW                 = 1500 count;           // Proportional gain
ElevatorServo.pidX                 = 100 count;            // Integral gain
ElevatorServo.pidY                 = 400 count;            // Differential gain
ElevatorServo.powerOnTimeout       = 0.8 second;           // Time to allow system to power up before commanding

MassServo.loadAtStartup            = 1 bool;
MassServo.simulateHardware         = 1 bool;

MassServo.accel                    = 20000 n/a;          // Encoder ticks / 32.768 per second squared
MassServo.currLimit                = 100 %;              // Percent of current allowed
MassServo.limitHi                  = 427054 count;       // High physical limit for mass motor controller
MassServo.limitLo                  = -403367 count;      // Low physical limit for mass motor controller
MassServo.overloadTimeout          = 1000 ms;            // ms until an overload is reported
MassServo.powerOnTimeout           = 0.8 second;         // Time to allow system to power up before commanding
MassServo.velocity                 = 280000 n/a;         // Encoder ticks / 32.768 per second (should probably be in units of counts per second)

// MassServo-only settings
MassServo.deviationDistance        = 0.05 mm;            // Deviation allowed between expected and actual
MassServo.tksPerMM                 = 10901.811 count/mm; // Number of ticks for one rotation (1 mm of travel)
MassServo.totalTks                 = 1105329 count;      // Total encoder ticks for full mass shift travel


RudderServo.loadAtStartup          = 1 bool;
RudderServo.simulateHardware       = 1 bool;

RudderServo.countsPerDeg           = 454.666 count/arcdeg; // motor "ticks" per degree of control surface motion
RudderServo.currLimit              = 10 %;                 // Percent of current allowed
RudderServo.deviationAngle         = .05 arcdeg;           // Number of degrees deviation allowed between expected and actual
RudderServo.limitHi                = 16369 count;          // High physical limit for motor controller
RudderServo.limitLo                = 0 count;              // Low physical limit for motor controller
RudderServo.mtrCenter              = 8184 count;           // 0 degrees "centered" control surface
RudderServo.offsetAngle            = 0 degree;
RudderServo.pidW                   = 500 count;            // Proportional gain
RudderServo.pidX                   = 100 count;            // Integral gain
RudderServo.pidY                   = 400 count;            // Differential gain
RudderServo.powerOnTimeout         = 0.5 second;           // Time to allow system to power up before commanding
// NOTE: For rudder/elevator velocity can currently be set as high as 2000000 with acceleration at 4000. 08/11/2009 - Kieft

ThrusterHE.loadAtStartup        = 0 bool;
ThrusterHE.simulateHardware     = 1 bool;
// ThrusterHE-only settings
ThrusterHE.deviation            = 25 count;       // Allowed between actual and commanded speed
ThrusterHE.allowableBadVelocity = 5 count;        // Number of bad "getVelocity" readings allowed before throwing a fault.
ThrusterHE.ratedSpeed           = 600 count;      // Holds the rated speed set in the AMT49406
ThrusterHE.powerOnTimeout       = 2 second;        // Time to allow system to power up before commanding


ThrusterServo.loadAtStartup        = 1 bool;
ThrusterServo.simulateHardware     = 1 bool;

ThrusterServo.accel                = 1 n/a;             // Encoder ticks / 32.768 per second squared NOTE: this value is not valid from 0 - 65000 as
                                                        // noted in the spec. A value of 0 will return a bad operand error
ThrusterServo.currLimit            = 50 %;              // Percent of current allowed
ThrusterServo.overloadTimeout      = 1000 ms;           // Timeout in ms to wait before throwing overload error
ThrusterServo.pidW                 = 8000 count;
ThrusterServo.pidX                 = 100 count;
ThrusterServo.pidY                 = 60000 count;
ThrusterServo.powerOnTimeout       = 0.5 second;        // Time to allow system to power up before commanding

// ThrusterServo-only settings
ThrusterServo.allowableBadVelocity = 5 count;        // Number of bad "getVelocity" readings allowed before throwing a fault.
ThrusterServo.deviation            = 25 count;       // Number of encoder ticks deviation allowed between expected and actual
ThrusterServo.encoderTks           = 32.768 count/s; // encoder tick/second multiplier
ThrusterServo.tksPerRev            = 32 count/rev;   // encoder ticks/revolution as seen by the controller from HALL A&B

// NOTE: 10" prop = .187706 m per revolution in wake
// 300 rpm == 1m/sec and 150 rpm == .5m/sec. See propPitch