Skip to content

Commit

Permalink
use hydra20 fpc settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Fechner committed Apr 16, 2024
1 parent 24a2a8f commit da8a4f0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
27 changes: 27 additions & 0 deletions data/fpc_settings_hydra20.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions data/system_8000.yaml
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions examples/autopilot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions src/fpc_settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit da8a4f0

Please sign in to comment.