From de07688a06b2aad0e2d3153e9dba46a9d69f4bc5 Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Mon, 12 Aug 2024 17:35:38 +0200 Subject: [PATCH] get rid of se() --- examples/autopilot.jl | 9 +++++++-- src/flightpathcontroller.jl | 8 ++++---- src/fpc_settings.jl | 2 +- src/systemstatecontrol.jl | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/autopilot.jl b/examples/autopilot.jl index d5c593bb..e5c81b3b 100644 --- a/examples/autopilot.jl +++ b/examples/autopilot.jl @@ -67,19 +67,24 @@ app.next_max_time = app.max_time function init(app::KiteApp; init_viewer=false) app.max_time = app.next_max_time app.kcu = KCU(app.set) + project=(KiteUtils.PROJECT) app.kps4 = KPS4(app.kcu) + KiteUtils.PROJECT = project app.wcs = WCSettings() update(app.wcs) + app.wcs.dt = 1/app.set.sample_freq app.dt = app.wcs.dt - app.fcs = FPCSettings() + app.fcs = FPCSettings(dt=app.dt) update(app.fcs) app.fcs.dt = app.wcs.dt app.fcs.log_level = app.set.log_level app.fpps = FPPSettings() update(app.fpps) app.fpps.log_level = app.set.log_level - app.ssc = SystemStateControl(app.wcs, app.fcs, app.fpps) + u_d0 = 0.01 * se(project).depower_offset + u_d = 0.01 * se(project).depower + app.ssc = SystemStateControl(app.wcs, app.fcs, app.fpps; u_d0, u_d) if init_viewer app.viewer= Viewer3D(app.set, app.show_kite; menus=true) app.viewer.menu.options[]=["plot_main", "plot_power", "plot_control", "plot_control_II", "plot_winch_control", "plot_aerodynamics", diff --git a/src/flightpathcontroller.jl b/src/flightpathcontroller.jl index d9c5c8a6..03aa044d 100644 --- a/src/flightpathcontroller.jl +++ b/src/flightpathcontroller.jl @@ -52,7 +52,7 @@ docs/flight_path_controller_III.png "desired flight direction (bearing)" chi_set = 0 "minimal value of the depower setting, needed for the fully powered kite" - u_d0 = 0.01 * se().depower_offset + u_d0 # = 0.01 * se().depower_offset "maximal value of the depower setting, needed for the fully depowered kite" u_d_max = 0.01 * 42.2 # TODO: add this to settings.yaml "normalized depower settings" @@ -62,7 +62,7 @@ docs/flight_path_controller_III.png "maximal value of the turn rate in radians per second" psi_dot_max = 3.0 "actual depower setting (0..1)" - u_d = 0.01 * se().depower + u_d # = 0.01 * se().depower k_c2 = fcs.k_c2 k_c2_int = fcs.k_c2_int k_c2_hight = fcs.k_c2_high @@ -104,8 +104,8 @@ docs/flight_path_controller_III.png _i = 0 end -function FlightPathController(fcs::FPCSettings) - FlightPathController(fcs=fcs) +function FlightPathController(fcs::FPCSettings; u_d0, u_d) + FlightPathController(fcs=fcs, u_d0=u_d0, u_d=u_d) end """ diff --git a/src/fpc_settings.jl b/src/fpc_settings.jl index e7b6f0fc..69b48ab2 100644 --- a/src/fpc_settings.jl +++ b/src/fpc_settings.jl @@ -3,7 +3,7 @@ Settings of the FlightPathController """ @with_kw mutable struct FPCSettings @deftype Float64 "period time" - dt::Float64 = 1.0 / se().sample_freq + dt::Float64 log_level::Int64 = 2 prn::Bool = false prn_ndi_gain::Bool = false diff --git a/src/systemstatecontrol.jl b/src/systemstatecontrol.jl index f74a2829..8ddff802 100644 --- a/src/systemstatecontrol.jl +++ b/src/systemstatecontrol.jl @@ -12,8 +12,8 @@ tether_length::Union{Nothing, Float64} = nothing end -function SystemStateControl(wcs::WCSettings, fcs::FPCSettings, fpps::FPPSettings) - fpc = FlightPathController(fcs) +function SystemStateControl(wcs::WCSettings, fcs::FPCSettings, fpps::FPPSettings; u_d0, u_d) + fpc = FlightPathController(fcs; u_d0, u_d) fpca = FlightPathCalculator(fpc, fpps) fpp = FlightPathPlanner(fpps, fpca) res = SystemStateControl(wc=WinchController(wcs), fpp=fpp)