//
// vn100_300kHzDVL.cfg
//
// This config file should reside in $AUV_CONFIG_DIR. Driver can be launched with
// `$ vn100Server -serial /dev/ser10,115200,8,n,1 -cfg vn100_300kHzDVL.cfg`
// Copyright MBARI 2020
//

//Polled data rate (Hz), should be: 1,2,4,5,10,20,25,40,50,100,200
ahrsRate = 10;
rawMeasRate = 10;

// HSI logging is disabled currently, as we moved away from using the onboard cts. HSI estimator.
hsiLogInterval_sec = 2;

//Should the below Hard/Soft Iron calibration parameters be loaded and saved to EEPROM for this mission?
LoadNewHSICalibration = True;
SaveNewHSICalibration = True;

//This is only relavent if performing a hard/soft iron calibration of the compass.
WriteHSIToEEPROM = True;

// The HSI Calibration Library has two primary modes, 3D and 2D. See 
// ./vnc_driver/include/vn/hsi/README.txt for details. If this is set
// to false, then the 2D calibration routine is selected.
Use_HSI_MODE_3D = True;

//Hard & Soft Iron (HSI) Subsystem Settings (pg 110 User Manual, v 2.43)
//HSIMode
//  0: Real-time hard/soft cal. algo. turned off
//  1: Real-time hard/soft cal. algo. runs.
//  2: Real-time hard/soft calibration reset
HSIMode = 0;
//HSIOutput
//  1: Onboard HSI is not applied to magnetic measurements
//  3: Onboard HSI is applied to magnetic measurements
HSIOutput = 1;
//HSIConvergeRate
//  Range 1-5 (int), 1-Solution converges slowly over 60-90 seconds
//                   5-Solution converges quickly over 15-20 seconds
HSIConvergeRate = 5;

//Reference Frame Rotation (instrument to vehicle rotation matrix), where 
//R \in SO(3) := {det(R) = +1, inv(R) = transpose(R)}
//diag(-1, -1, 1) corresponds to 180 degree rotation about Z aixs, 
//and is approximatly correct given compass mounting in MVC
Rot00 = -1.0;
Rot01 = 0.0;
Rot02 = 0.0;
Rot10 = 0.0;
Rot11 = -1.0;
Rot12 = 0.0;
Rot20 = 0.0;
Rot21 = 0.0;
Rot22 = 1.0;

//VPE Basic Control (pg. 104 of User Manual, v 2.43)
VPEBasic_Enable = 1;
VPEBasic_HeadingMode = 0;
VPEBasic_FilteringMode = 1;
VPEBasic_TuningMode = 1;

//VPE Magnetometer Basic Tuning, float: 0-10 (pg 105 of User Manual, v 2.43)
VPEMag_BaseTuningX = 4.0;
VPEMag_BaseTuningY = 4.0;
VPEMag_BaseTuningZ = 4.0;
VPEMag_AdaptiveTuningX = 5.0;
VPEMag_AdaptiveTuningY = 5.0;
VPEMag_AdaptiveTuningZ = 5.0;
VPEMag_AdaptiveFilteringX = 5.5;
VPEMag_AdaptiveFilteringY = 5.5;
VPEMag_AdaptiveFilteringZ = 5.5;

//VPE Accelerometer Basic Tuning, float: 0-10  (pg 106 of User Manual, v 2.43)
VPEAccel_BaseTuningX = 6.0;
VPEAccel_BaseTuningY = 6.0;
VPEAccel_BaseTuningZ = 6.0;
VPEAccel_AdaptiveTuningX = 3.0;
VPEAccel_AdaptiveTuningY = 3.0;
VPEAccel_AdaptiveTuningZ = 3.0;
VPEAccel_AdaptiveFilteringX = 5.0;
VPEAccel_AdaptiveFilteringY = 5.0;
VPEAccel_AdaptiveFilteringZ = 5.0;

//Filter Startup Gyro Bias, float rad/s (pg 107 of User Manual, v 2.43)
GyroStartupBiasEst_X = 0.0;
GyroStartupBiasEst_Y = 0.0;
GyroStartupBiasEst_Z = 0.0;

//Filter Startup Accel Bias, float (assuming m/s^2. Not documented in user manual, but in VN C/C++ API)
AccelStartupBiasEst_X = 0.0;
AccelStartupBiasEst_Y = 0.0;
AccelStartupBiasEst_Z = 0.0;

//VPE Gyro Basic Tuning, float: 0-10  (pg 108 of User Manual, v 2.43)
VPEGyro_VAngularWalkX = 8.0;
VPEGyro_VAngularWalkY = 8.0;
VPEGyro_VAngularWalkZ = 8.0;
VPEGyro_BaseTuningX = 4.0;
VPEGyro_BaseTuningY = 4.0;
VPEGyro_BaseTuningZ = 4.0;
VPEGyro_AdaptiveTuningX = 0.0;
VPEGyro_AdaptiveTuningY = 0.0;
VPEGyro_AdaptiveTuningZ = 0.0;

//Gyro Compensation (pg 84 of User Manual, v 2.43)
Gyro_C00 = 1.0;
Gyro_C01 = 0.0;
Gyro_C02 = 0.0;
Gyro_C10 = 0.0;
Gyro_C11 = 1.0;
Gyro_C12 = 0.0;
Gyro_C20 = 0.0;
Gyro_C21 = 0.0;
Gyro_C22 = 1.0;
Gyro_B0 = 0.0;
Gyro_B1 = 0.0;
Gyro_B2 = 0.0;
//See https://bitbucket.org/mbari/vn100/issues/41/considder-saving-bias-values-to-log-file
//for provenance of below 3 values.
// Gyro_B0 = 0.141;
// Gyro_B1 = -0.036;
// Gyro_B2 = -0.228;

//Accelerometer Compensation (pg 83 of User Manual, v 2.43)
Accel_C00 = 1.0;
Accel_C01 = 0.0;
Accel_C02 = 0.0;
Accel_C10 = 0.0;
Accel_C11 = 1.0;
Accel_C12 = 0.0;
Accel_C20 = 0.0;
Accel_C21 = 0.0;
Accel_C22 = 1.0;
Accel_B0 = 0.0;
Accel_B1 = 0.0;
Accel_B2 = 0.0;
//See https://bitbucket.org/mbari/vn100/issues/41/considder-saving-bias-values-to-log-file
//for provenance of below 3 values.
// Accel_B0 = -0.43;
// Accel_B1 = -1.3;
// Accel_B2 = 29.23;

//Magnetometer Compensation (pg 84 of User Manual, v 2.43)
Mag_C00 = 1.0;
Mag_C01 = 0.0;
Mag_C02 = 0.0;
Mag_C10 = 0.0;
Mag_C11 = 1.0;
Mag_C12 = 0.0;
Mag_C20 = 0.0;
Mag_C21 = 0.0;
Mag_C22 = 1.0;
Mag_B0 = 0.0;
Mag_B1 = 0.0;
Mag_B2 = 0.0;