Skip to content

Commit

Permalink
get rid of se()
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Fechner committed Aug 12, 2024
1 parent 036b7ae commit de07688
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
9 changes: 7 additions & 2 deletions examples/autopilot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/flightpathcontroller.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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

"""
Expand Down
2 changes: 1 addition & 1 deletion src/fpc_settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/systemstatecontrol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit de07688

Please sign in to comment.