#ifndef SETTINGS_H
#define SETTINGS_H

#include <Indoor/grid/GridPoint.h>
#include <Indoor/data/Timestamp.h>
#include <Indoor/sensors/radio/VAPGrouper.h>

namespace Settings {

    bool useKLB = false;

    const int numParticles = 5000;
    const int numBSParticles = 50;

	namespace IMU {
        const float turnSigma = 2.5;		// 3.5
        const float stepLength = 1.00;
        const float stepSigma = 0.15; //toni changed
	}

	const float smartphoneAboveGround = 1.3;

	const float offlineSensorSpeedup = 2;

	namespace Grid {
		constexpr int gridSize_cm = 20;
	}

    namespace Smoothing {
        const bool activated = true;
        const double stepLength = 0.7;
        const double stepSigma = 0.2;
        const double headingSigma = 25.0;
        const double zChange = 0.0; // mu change in height between two time steps
        const double zSigma = 0.1;
        const int lag = 5;

    }

    namespace KDE {
        const Point2 bandwidth(100,100);
    }

	//const GridPoint destination = GridPoint(70*100, 35*100, 0*100);		// use destination
	const GridPoint destination = GridPoint(0,0,0);							// do not use destination

	namespace SensorDebug {
		const Timestamp updateEvery = Timestamp::fromMS(200);
	}

    namespace WiFiModel {
        constexpr float sigma = 8.0;
		/** if the wifi-signal-strengths are stored on the grid-nodes, this needs a grid rebuild! */
        constexpr float TXP = -45;
        constexpr float EXP = 2.3;
        constexpr float WAF = -11.0;

        const bool optimize = true;

        // how to perform VAP grouping. see
        // - calibration in Controller.cpp
        // - eval in Filter.h
        // NOTE: maybe the UAH does not allow valid VAP grouping? delete the grid and rebuild without!
        const VAPGrouper vg_calib = VAPGrouper(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::MAXIMUM, VAPGrouper::TimeAggregation::AVERAGE, 1);
        const VAPGrouper vg_eval  = VAPGrouper(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::MAXIMUM, VAPGrouper::TimeAggregation::AVERAGE, 1);
	}

    namespace BeaconModel {
        constexpr float sigma = 8.0;
        constexpr float TXP = -71;
        constexpr float EXP = 1.5;
        constexpr float WAF = -20.0; //-5 //20??
    }

	namespace MapView3D {
        const int maxColorPoints = 1000;
		constexpr int fps = 15;
		const Timestamp msPerFrame = Timestamp::fromMS(1000/fps);
	}

	namespace Filter {
		const Timestamp updateEvery = Timestamp::fromMS(500);
		constexpr bool useMainThread = false;						// perform filtering in the main thread
	}

    const std::string mapDir = "D:/Source/Navegadors/maps/museum/";
    const std::string dataDir = "D:/Source/Navegadors/NavData/2018_02_01_museum/measurements/data/";
    const std::string errorDir = "D:/Forschung/2 Fusion 2018/Fusion2018/code/build/results";

    /** describes one dataset (map, training, parameter-estimation, ...) */
    struct DataSetup {
        std::string map;
        std::vector<std::string> training;
        std::string fingerprints;
        std::string wifiModel;
        int numGTPoints;
    };

    /** all configured datasets */
    struct Data {

        DataSetup Path0 = {

            mapDir + "map42_ap_path0.xml",

            {
                dataDir + "Nexus/Path0_4113.csv",
                dataDir + "Nexus/Path0_6563.csv",
                dataDir + "Pixel/Path0_1498.csv",
                dataDir + "Pixel/Path0_2529.csv",
                dataDir + "Pixel/Path0_7380.csv",
                //dataDir + "museum/Samsung/Path0_4208.csv",
                //dataDir + "museum/Samsung/Path0_6812.csv",
            },

            dataDir + "Nexus/fingerprints/wifi_fp.dat",
            dataDir + "wifimodel.dat",
            15
        };

        DataSetup Path1 = {

            mapDir + "map42_ap_path1_hofzu.xml",

            {
                dataDir + "Nexus/Path1_1548.csv",
                dataDir + "Nexus/Path1_9477.csv",
                dataDir + "Pixel/Path1_2468.csv",
                dataDir + "Pixel/Path1_5497.csv",
                dataDir + "Pixel/Path1_8787.csv",
                dataDir + "Samsung/Path1_5745.csv",
                dataDir + "Samsung/Path1_9130.csv"
            },

            dataDir + "Nexus/fingerprints/wifi_fp.dat",
            dataDir + "wifimodel.dat",
            32
        };

        DataSetup Path2 = {

            mapDir + "map42_ap_path2.xml",

            {
                dataDir + "Nexus/Path2_0374.csv",
                dataDir + "Nexus/Path2_4718.csv",
                dataDir + "Nexus/Path2_8766.csv",
                dataDir + "Pixel/Path2_4336.csv",
                dataDir + "Pixel/Path2_4341.csv",
                dataDir + "Pixel/Path2_9038.csv",
                //dataDir + "museum/Samsung/Path2_3326.csv",
                //dataDir + "museum/Samsung/Path2_5814.csv"
            },

            dataDir + "Nexus/fingerprints/wifi_fp.dat",
            dataDir + "wifimodel.dat",
            44
        };

        DataSetup Path3 = {

            mapDir + "map42_ap_path3.xml",

            {
                dataDir + "Nexus/Path3_4519.csv",
                dataDir + "Nexus/Path3_5929.csv",
                dataDir + "Pixel/Path3_6307.csv",
                dataDir + "Pixel/Path3_5451.csv",
                dataDir + "Pixel/Path3_9243.csv",
                //dataDir + "museum/Samsung/Path3_7610.csv",
                //dataDir + "museum/Samsung/Path3_7819.csv"
            },

            dataDir + "Nexus/fingerprints/wifi_fp.dat",
            dataDir + "wifimodel.dat",
            45
        };

    } data;

}




#endif // SETTINGS_H
