#------------------------------------------------------------
# Config file for the "ICP-SLAM" application
# See: http://www.mrpt.org/list-of-mrpt-apps/application-icp-slam/
#------------------------------------------------------------



#=======================================================
# Section: [ICP]
#  Parameters of ICP inside the ICP-based SLAM class
# Parameters of ICP inside the ICP-based SLAM class
#=======================================================
[ICP]
maxIterations    = 100   // The maximum number of iterations to execute if convergence is not achieved before
minAbsStep_trans = 1e-6  // If the correction in all translation coordinates (X,Y,Z) is below this threshold (in meters), iterations are terminated:
minAbsStep_rot   = 1e-6  // If the correction in all rotation coordinates (yaw,pitch,roll) is below this threshold (in radians), iterations are terminated:

thresholdDist    = 0.4   // Initial maximum distance for matching a pair of points
thresholdAng_DEG = 3     // An angular factor (in degrees) to increase the matching distance for distant points.

ALFA             = 0.5   // After convergence, the thresholds are multiplied by this constant and ICP keep running (provides finer matching)

smallestThresholdDist=0.05 // This is the smallest the distance threshold can become after stopping ICP and accepting the result.
onlyClosestCorrespondences=true // 1: Use the closest points only, 0: Use all the correspondences within the threshold (more robust sometimes, but slower)

# 0: icpClassic
# 1: icpLevenbergMarquardt
ICP_algorithm = icpClassic

# decimation to apply to the point cloud being registered against the map
# Reduce to "1" to obtain the best accuracy
corresponding_points_decimation = 5


#=======================================================
# Section: [MappingApplication]
# Use: Here comes global parameters for the app.
#=======================================================
[MappingApplication]
# The source file (RAW-LOG) with action/observation pairs
#rawlog_file = D:\WORK\3- DATASETS\Dataset_MCEnose\Rhodon\Mapas_33b1_empty\enose_20cms\dataset_2011-02-07_12h50m49s_enose_20cms_LASER1_half.rawlog
#rawlog_file = D:\WORK\3- DATASETS\Dataset_MCEnose\GasMap 3D enose+MCenose\corridor_236\corridor_enose_dataset_2011-11-11_09h59m06s.rawlog
rawlog_file = D:\WORK\3- DATASETS\Dataset_MCEnose\GasMap 3D enose+MCenose\lab237\lab237_enose+MCEnose+MOXmodel_dataset_gasmap_lab237_2011-11-08_12h32m59s.rawlog

rawlog_offset=0	

# The directory where the log files will be saved (left in blank if no log is required)
logOutput_dir=LOG_ICP-SLAM
LOG_FREQUENCY=150			// The frequency of log files generation:
SAVE_3D_SCENE=1
SAVE_POSE_LOG=0
CAMERA_3DSCENE_FOLLOWS_ROBOT=1

SHOW_PROGRESS_3D_REAL_TIME=0			//Indicates if the 3D real time map should be displayed 0-> false , 1-> true
SHOW_PROGRESS_3D_REAL_TIME_DELAY_MS=2	//

insertionLinDistance=1.0		// The distance threshold for inserting observations in the map (meters)
insertionAngDistance=30.0		// The distance threshold for inserting observations in the map (degrees)
+localizationLinDistance= 0.25		// The distance threshold for correcting odometry with ICP (meters)  
+localizationAngDistance= 10		// The distance threshold for correcting odometry with ICP (degrees)


matchAgainstTheGrid = true

alwaysInsertByClass = CObservationGasSensors

# ========================================================
#            MULTIMETRIC MAP CONFIGURATION
# See docs for (Google for) mrpt::maps::CMultiMetricMap
# ========================================================
# Creation of maps:
occupancyGrid_count=1
gasGrid_count=1		;number of gridmaps to generate
wifiGrid_count=0	;number of gridmaps to generate
landmarksMap_count=0
beaconMap_count=0
pointsMap_count=1

# Selection of map for likelihood: (fuseAll=-1,occGrid=0, points=1,landmarks=2,gasGrid=3)
likelihoodMapSelection=-1


# ====================================================
#   MULTIMETRIC MAP: PointsMap #00
# ====================================================
# Creation Options for PointsMap 00:
[MappingApplication_pointsMap_00_insertOpts]
minDistBetweenLaserPoints=0.03
fuseWithExisting=0
isPlanarMap=1


# ====================================================
#   MULTIMETRIC MAP: OccGrid #00
# ====================================================
# Creation Options for OccupancyGridMap 00:
[MappingApplication_occupancyGrid_00_creationOpts]
resolution=0.1
disableSaveAs3DObject=0

# Insertion Options for OccupancyGridMap 00:
[MappingApplication_occupancyGrid_00_insertOpts]
mapAltitude=0
useMapAltitude=0
maxDistanceInsertion=25
maxOccupancyUpdateCertainty=0.65
considerInvalidRangesAsFreeSpace=false
minLaserScanNoiseStd=0.001


# ====================================================
#   MULTIMETRIC MAP: GasMap #00
# ====================================================
# Creation Options for CGasConcentrationGridMap2D 00:
[MappingApplication_gasGrid_00_creationOpts]
mapConfig	= onlyGasMap				// onlyGasMap, gasWindMap
mapType		= mrKernelDMV				// mrKernelDM, mrKernelDMV, mrKalmanFilter, mrKalmanApproximate
disableSaveAs3DObject=false
#Initial map dimensions [m]
min_x      = -2
max_x      = 4
min_y      = -5
max_y      = 1
resolution = 0.25  						//m longitud del lado de celda (must be small for mapType=0)

# Insertion Options for CGasConcentrationGridMap2D 00:
[MappingApplication_gasGrid_00_insertOpts]
gasSensorLabel = GDM					//The label of the CObservationGasSensor used to generate the map (Full_MCEnose, MCEnose, GDM, ENOSE_SIMUL)
enose_id = 0							// id of the enose used to generate this map (must be < gasGrid_count) (usually is 0)
gasSensorType = 0x2602					// Sensor type to generate the map  0=mean of all sensors
windSensorLabel = windSensor			//The label of the CObservationWindSensor used to generate the map

[MappingApplication_gasGrid_00_insertOpts_gas]
sigma = 0.4							// [mrKernelDM,mrKernelDMV] The sigma of the "Parzen"-kernel Gaussian. 
cutoffRadius = 0.7 					// [mrKernelDM,mrKernelDMV] The cutoff radius for updating cells. 
KF_covSigma = 0.5 					// [KF model] The "sigma_d" for the initial covariance value between cells (in meters). Is the sigma of the gaussian that models the initial covariance between cells.
KF_observationModelNoise = 0.3 		// [KF model] The sensor model noise (in normalized concentration units). 
KF_initialCellStd=1 				// [KF model] The initial standard deviation of each cell's concentration (will be stored both at each cell's structure and in the covariance matrix as variances in the diagonal) (in normalized concentration units). 
KF_defaultCellMeanValue = 0.10 		// [KF model] The default/initial mean of each cell's concentration
KF_W_size=15						// [KFapprox model] The size of the window that restricts the correlation between cells w>= ceil(7*KF_covSigma/resolution)
R_min = 0.05						// Minimum normalization value.
R_max = 1.34						// Maximum normalization value.

[MappingApplication_gasGrid_00_insertOpts_modwind]
sigma = 0.4							// [mrKernelDM,mrKernelDMV] The sigma of the "Parzen"-kernel Gaussian. 
cutoffRadius = 0.7 					// [mrKernelDM,mrKernelDMV] The cutoff radius for updating cells. 
KF_covSigma = 0.5 					// [KF model] The "sigma_d" for the initial covariance value between cells (in meters). Is the sigma of the gaussian that models the initial covariance between cells.
KF_observationModelNoise = 0.3 		// [KF model] The sensor model noise (in normalized concentration units). 
KF_initialCellStd=1 				// [KF model] The initial standard deviation of each cell's concentration (will be stored both at each cell's structure and in the covariance matrix as variances in the diagonal) (in normalized concentration units). 
KF_defaultCellMeanValue = 0.10 		// [KF model] The default/initial mean of each cell's concentration
KF_W_size=15						// [KFapprox model] The size of the window that restricts the correlation between cells w>= ceil(7*KF_covSigma/resolution)
R_min = 0.00						// Minimum normalization value.
R_max = 21.34						// Maximum normalization value.

[MappingApplication_gasGrid_00_insertOpts_dirwind]
sigma = 0.4							// [mrKernelDM,mrKernelDMV] The sigma of the "Parzen"-kernel Gaussian. 
cutoffRadius = 0.7 					// [mrKernelDM,mrKernelDMV] The cutoff radius for updating cells. 
KF_covSigma = 0.5 					// [KF model] The "sigma_d" for the initial covariance value between cells (in meters). Is the sigma of the gaussian that models the initial covariance between cells.
KF_observationModelNoise = 0.3 		// [KF model] The sensor model noise (in normalized concentration units). 
KF_initialCellStd=1 				// [KF model] The initial standard deviation of each cell's concentration (will be stored both at each cell's structure and in the covariance matrix as variances in the diagonal) (in normalized concentration units). 
KF_defaultCellMeanValue = 0.10 		// [KF model] The default/initial mean of each cell's concentration
KF_W_size=15						// [KFapprox model] The size of the window that restricts the correlation between cells w>= ceil(7*KF_covSigma/resolution)
R_min = -180						// Minimum normalization value.
R_max = 180							// Maximum normalization value.


