diff --git a/data/fpc_settings_hydra20.yaml b/data/fpc_settings_hydra20.yaml new file mode 100644 index 00000000..6b937fc1 --- /dev/null +++ b/data/fpc_settings_hydra20.yaml @@ -0,0 +1,27 @@ +fpc_settings: + dt: 0.025 # time step of the flight path controller + log_level: 2 # log level, 0=quiet + prn: false + prn_ndi_gain: false + prn_est_psi_dot: false + prn_va: false + use_radius: true + use_chi: true + + reset_int1: true # reset the main integrator to the last estimated turn rate + reset_int2: false # reset the integrator of the D part at the second time step + reset_int1_to_zero: true + init_opt_to_zero: false # if the root finder should start with zero + + p: 20.0 # P gain of the PID controller + i: 1.2 # I gain of the PID controller + d: 10.0 # D gain of the PID controller + gain: 0.04 # additional factor for P, I and D + c1: 0.0612998898221 # was: 0.0786 + c2: 1.22597628388 # was: 2.508 + + k_c1: 1.6 # correction factor, used by the NDI block; increase k_c1, if the radius is too small; + k_c2: 6.0 # C2 for the reelout phase was: 7.0 + k_c2_high: 12.0 # C2 for the reelout phase at high elevation angles was: 14.0 + k_c2_int: 0.6 # C2 for the intermediate phase LOW_RIGHT, LOW_TURN, LOW_LEFT + k_ds: 2.0 # influence of the depower angle on the steering sensitivity \ No newline at end of file diff --git a/data/system_8000.yaml b/data/system_8000.yaml index 60d6cb51..d97a24bd 100644 --- a/data/system_8000.yaml +++ b/data/system_8000.yaml @@ -1,4 +1,5 @@ system: - sim_settings: "settings_hydra20.yaml" # model and simulator settings - wc_settings: "wc_settings_8000.yaml" # winch controller settings + sim_settings: "settings_hydra20.yaml" # model and simulator settings + wc_settings: "wc_settings_8000.yaml" # winch controller settings + fpc_settings: "fpc_settings_hydra20.yaml" # flight path controller settings \ No newline at end of file diff --git a/examples/autopilot.jl b/examples/autopilot.jl index fef34029..acca2049 100644 --- a/examples/autopilot.jl +++ b/examples/autopilot.jl @@ -57,6 +57,7 @@ function init(app::KiteApp; init_viewer=false) app.wcs.dt = 1/app.set.sample_freq app.dt = app.wcs.dt app.fcs = FPCSettings(); + update(app.fcs) app.fcs.dt = app.wcs.dt; app.fcs.log_level = app.set.log_level app.fpps = FPPSettings(); diff --git a/src/fpc_settings.jl b/src/fpc_settings.jl index 260f4e3c..9cd201cd 100644 --- a/src/fpc_settings.jl +++ b/src/fpc_settings.jl @@ -38,4 +38,20 @@ Settings of the FlightPathController k_c2_int = 0.6 "influence of the depower angle on the steering sensitivity" k_ds = 2.0 +end + +StructTypes.StructType(::Type{FPCSettings}) = StructTypes.Mutable() + +function update(fcs::FPCSettings) + config_file = joinpath(get_data_path(), "fpc_settings_hydra20.yaml") + if Sys.iswindows() + config_file = replace(config_file, "/" => "\\") + end + if ! isfile(config_file) + println("Warning: $config_file not found, using default settings.") + return + end + dict = YAML.load_file(config_file) + sec_dict = Dict(Symbol(k) => v for (k, v) in dict["fpc_settings"]) + StructTypes.constructfrom!(fcs, sec_dict) end \ No newline at end of file