//////////////////////////////////////////////////////////////// 
// 
// 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.powerOnTimeout  = 0.5 second;       // Time to allow system to power up before commanding
BuoyancyServo.powerOffTimeout = 1.5 second;       // Time to allow system to completely close valve
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.pidW            = 1500 count;
BuoyancyServo.pidX            = 0 count;
BuoyancyServo.pidY            = 3000 count;
BuoyancyServo.overloadTimeout = 10000 ms;          // ms until an overload is reported   
BuoyancyServo.accel           = 800 n/a;
BuoyancyServo.velocity        = 800 n/a;
// BuoyancyServo-only settings
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.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.offsetVolume    = 98.452 cc;        // Offset of position of motor controller
BuoyancyServo.fastPumpDepth   = 1.5 meter;        // Max depth for pumping at a fast rate
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)

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

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


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

MassServo.powerOnTimeout    = 0.5 second;        // Time to allow system to power up before commanding
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.accel             = 20000 n/a;         // Encoder ticks / 32.768 per second squared
MassServo.velocity          = 280000 n/a;        // Encoder ticks / 32.768 per second (should probably be in units of counts per second)
// MassServo-only settings
MassServo.totalTks          = 1105329 count;     // Total encoder ticks for full mass shift travel
MassServo.tksPerMM          = 10901.811 count/mm;// Number of ticks for one rotation (1 mm of travel)
MassServo.deviationDistance = 0.05 mm;           // Deviation allowed between expected and actual


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

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


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

ThrusterServo.powerOnTimeout  = 0.5 second;        // Time to allow system to power up before commanding
ThrusterServo.currLimit       = 50 %;              // Percent of current allowed
ThrusterServo.pidW            = 8000 count;
ThrusterServo.pidX            = 100 count;
ThrusterServo.pidY            = 60000 count;
ThrusterServo.overloadTimeout = 1000 ms;           // Timeout in ms to wait before throwing overload error
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-only settings
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
ThrusterServo.deviation       = 25 count;          // Number of encoder ticks deviation allowed between expected and actual
ThrusterServo.allowableBadVelocity = 5 count;      // Number of bad "getVelocity" readings allowed before throwing a fault.

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