---
# local frame must be given in utm coordinates
local_frame:
    east:     &local_frame_east   360284.0
    north:    &local_frame_north 4813595.0
    alt:      &local_frame_alt         0.0
    utm_zone: &local_frame_utm_zone    31N

# flight area in local coordinates
flight_area: &flight_area [[-1000.0, -5000.0, -100.0], [15000.0, 5000.0, 4000.0]]

# allow_warm_start: True
allow_warm_start: False

# database config
database:
    enable_save: True
    filepath: '/PATH/TO/database01.neph'
    overwrite_existing: True

mesonh_files:  &mesonh_files '/PATH/TO/REFHR.1.ARMCu.4D.nc'

# Setting this to true will activate feedback to WORLD_ENV requests
# Do not pass it to True : NOT WORKING...
wind_feedback: False

# Setting this value forces the mesonh variables to read only this time
mesonh_fixed_time: &mesonh_fixed_time 92

# WindMap is constant => no wind here [0, 0]
wind_map:
    type: 'WindMapConstant'
    name: 'Horizontal Wind'
    wind: [-0.0, 0.0]

# DataViews
data_views:
    # View of liquid water content (data from Mesonh)
    humidity:
        type: 'FetchView'
        name: 'Humidity'
        tags: ['RCT']
        displayable: true

    # View of vertical wind (data from Mesonh)
    verticalWind:
        type: 'FetchView'
        name: 'Vertical Wind'
        tags: ['WT']
        displayable: true

    # View of temperature (data from Mesonh)
    temperature:
        type: 'FetchView'
        name: 'Temperature'
        tags: ['THT']
        displayable: true

    # View of altitude (data from the autopilot / registered data)
    altitude:
        type: 'StatusView'
        name: 'Altitude'
        tags: null
        displayable: true

    # View of time (since the task has started / registered data)
    time:
        type: 'StatusView'
        name: 'Time'
        info: 'time'
        tags: null
        displayable: true

# Play with the mesonh origin if you want to have a cloud near your standby
# position [t, x, y ,z]
mesonh_origin: &mesonh_origin [460.0, -1400.0, -3000.0, -280.0]



# Default fields. Used to define yaml aliases, to define values in one single place.
defaults:
    start: &start_defaults
        - Length: [3]
        - SimpleBounds: [*flight_area]
    circle_radius:
        - &circle_radius_min  80.0
        - &circle_radius_max 500.0
        - defaults: &circle_radius_defaults
            - DefaultValue: [120.0]
            - SimpleBounds: [[*circle_radius_min, *circle_radius_max]]
    altitude:
        - &altitude_min  185.0
        - &altitude_max 4000.0
        - defaults: &altitude_defaults
            - SimpleBounds: [[-1000.0, 4000.0]]
    drift:
        - &xdrift_min -10.0
        - &xdrift_max  10.0
        - &ydrift_min -10.0
        - &ydrift_max  10.0
        - &zdrift_min  -3.0
        - &zdrift_max   3.0
        - drift: &drift_defaults
            - DefaultValue: [[0.0,0.0,0.0]]
            - Length: [3]
            - SimpleBounds: [[[*xdrift_min, *ydrift_min, *zdrift_min],
                              [*xdrift_max, *ydrift_max, *zdrift_max]]]
        - hdrift: &hdrift_defaults
            - Length: [2]
            - SimpleBounds: [[[*xdrift_min, *ydrift_min],
                              [*xdrift_max, *ydrift_max]]]
        - zdrift: &zdrift_defaults
            - SimpleBounds: [[*zdrift_min, *zdrift_max]]

    lace: &lace_defaults
        parameters:
            start: *start_defaults
            first_turn_direction:
                - DefaultValue:  [1.0]
                - AllowedValues: [[-1.0, 1.0]]
            circle_radius: *circle_radius_defaults
            drift: *drift_defaults
        updatables:
            hdrift: *hdrift_defaults
            zdrift: *zdrift_defaults

    rosette: &rosette_defaults
        parameters:
            start: *start_defaults
            first_turn_direction:
                - DefaultValue:  [1.0]
                - AllowedValues: [[-1.0, 1.0]]
            circle_radius: *circle_radius_defaults
            drift: *drift_defaults
        updatables:
            hdrift: *hdrift_defaults
            zdrift: *zdrift_defaults

    spiral3d: &spiral3d_defaults
        parameters:
            start: *start_defaults
            alt_stop: *altitude_defaults
            radius_start: *circle_radius_defaults
            radius_stop:  *circle_radius_defaults
            drift: *drift_defaults
        updatables:
            hdrift: *hdrift_defaults
            zdrift: *zdrift_defaults

    trinity: &trinity_defaults
        parameters:
            start: *start_defaults
            first_turn_direction:
                - DefaultValue:  [1.0]
                - AllowedValues: [[-1.0, 1.0]]
            circle_radius: *circle_radius_defaults
            drift: *drift_defaults
        updatables:
            hdrift: *hdrift_defaults
            zdrift: *zdrift_defaults

# List of possible UAVS : 200, 201, 202, 203, 204
# Configuration given : 
# - Autopilot : Paparazzi
# - No replay
aircrafts:
    200:
        replay: false
        type: 'pprz'
        plugins:
            - MesonhProbe:
                mesonhFiles: *mesonh_files
                mesonhVariables: ['RCT', 'RRT', 'WT', 'THT', ['UT','VT']]
                rctFeedback: True
                mesonhOrigin: *mesonh_origin
                fixTime: *mesonh_fixed_time
            - Missions:
                backup_file: '/PATH/TO/backup_200.bin'
                Lace: *lace_defaults
                Rosette: *rosette_defaults
                Spiral3D: *spiral3d_defaults
                Trinity: *trinity_defaults
            - CloudCenterTracker:
                mapWhereCenterIs: 'LWC'
            - MissionWindUpdater:
                period: 10.0
            - Monitor
    201:
        replay: false
        type: 'pprz'
        plugins:
            - MesonhProbe:
                mesonhFiles: *mesonh_files
                mesonhVariables: ['RCT', 'RRT', 'WT', 'THT', ['UT','VT']]
                rctFeedback: True
                mesonhOrigin: *mesonh_origin
                fixTime: *mesonh_fixed_time
            - Missions:
                backup_file: '/PATH/TO/backup_201.bin'
                Lace: *lace_defaults
                Rosette: *rosette_defaults
                Spiral3D: *spiral3d_defaults
                Trinity: *trinity_defaults
            - CloudCenterTracker:
                mapWhereCenterIs: 'LWC'
            - MissionWindUpdater:
                period: 10.0
            - Monitor

maps:
    kernels:
        lwc_kernel:
            type: 'WindKernel'
            length_scales: [120.0, 60.0, 60.0, 60.0]
            variance: 1.0e-8
            noise_variance: 1.0e-10
    LWC:
        name: 'Liquid Water Cyan'
        type: 'GprMap'
        kernel: 'lwc_kernel'
        data_view: 'humidity'
        data_range: [0.0, 1.0e-4]
        threshold: 2.0e-4
        std_map: 'Liquid Water std' # optional
        border_map: 'Liquid Water border' # optional

    clouds:
        name: 'Liquid Water (MesoNH)'
        type: 'MesonhMap'
        mesonh_variable: 'RCT'
        origin: *mesonh_origin
