Skip to content

Commit

Permalink
improve create_sys_image
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Mar 23, 2024
1 parent 0b57c71 commit b94838c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bin/create_sys_image
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ julia --project -e "using Pkg; Pkg.precompile()"
cd src
touch *.jl # make sure all modules get recompiled in the next step
cd ..
julia --project -J bin/kps-image-${julia_major}-${branch}.so -e "using KiteUtils, KiteControllers, PyPlot"
julia --project -J bin/kps-image-${julia_major}-${branch}.so -e "using KiteUtils, KiteControllers"
julia --project -J bin/kps-image-${julia_major}-${branch}.so -e "using TestEnv; TestEnv.activate(); using PyPlot"
12 changes: 10 additions & 2 deletions examples/autopilot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ function play(stopped=false)
steps = simulate(integrator, stopped)
stopped = ! viewer.sw.active[]
GC.enable(true)
if @isdefined __PRECOMPILE__
break
end
end
end

Expand All @@ -164,13 +167,18 @@ on(viewer.btn_PARKING.clicks) do c; parking(); end
on(viewer.btn_AUTO.clicks) do c; autopilot(); end
on(viewer.btn_STOP.clicks) do c; stop_(); end

play(true)
if @isdefined __PRECOMPILE__
MAX_TIME = 30
play(false)
else
play(true)
end
stop_()
KiteViewers.GLMakie.closeall()

GC.enable(true)

if maximum(DELTA_T) > 0 && haskey(ENV, "PLOT")
if maximum(DELTA_T) > 0 && haskey(ENV, "PLOT") && ! @isdefined __PRECOMPILE__
include("../test/plot.jl")
plotx(T[1:LAST_I], DELTA_T[1:LAST_I], 100*STEERING[1:LAST_I], 100*DEPOWER_[1:LAST_I],
labels=["t_sim [ms]", "steering [%]", "depower [%]"],
Expand Down
4 changes: 2 additions & 2 deletions test/test_for_precompile.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAX_TIME::Float64 = 5
let
__PRECOMPILE__ = true
let
include("test_speedcontroller1.jl")
include("../examples/autopilot.jl")
end
Expand Down

0 comments on commit b94838c

Please sign in to comment.