Skip to content

Commit 51211b0

Browse files
committed
add some stats
1 parent 07ee3f4 commit 51211b0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/test_flightpathcontroller1.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ if ! ("ControlPlots" ∈ keys(Pkg.project().dependencies))
44
Pkg.activate(@__DIR__)
55
end
66
using ControlPlots, KiteControllers, Timers; tic()
7+
using Printf: @sprintf
8+
using Statistics: mean
79
using KiteUtils: Settings, load_settings
10+
using Printf: @sprintf
811

912
set::Settings = deepcopy(load_settings("system.yaml"))
1013
fcs::FPCSettings = FPCSettings(dt=1/set.sample_freq)
@@ -47,4 +50,19 @@ p=plotx(TIME, PSI, BETA, PSI_DOT;
4750
fig = "test_fpc1")
4851
display(p)
4952

53+
start_idx = findfirst(t -> t >= 10.0, TIME)
54+
if start_idx !== nothing
55+
psi_dot_slice = @view PSI_DOT[start_idx:end]
56+
psi_dot_avg = mean(psi_dot_slice)
57+
psi_dot_min = minimum(psi_dot_slice)
58+
psi_dot_max = maximum(psi_dot_slice)
59+
psi_dot_avg_deg = rad2deg(psi_dot_avg)
60+
psi_dot_min_deg = rad2deg(psi_dot_min)
61+
psi_dot_max_deg = rad2deg(psi_dot_max)
62+
println("psi_dot stats for t>=10s [deg/s]:")
63+
println("avg: $(@sprintf("%.2f", psi_dot_avg_deg))")
64+
println("min: $(@sprintf("%.2f", psi_dot_min_deg))")
65+
println("max: $(@sprintf("%.2f", psi_dot_max_deg))")
66+
end
67+
5068
# return TIME, PSI, BETA, PHI, PSI_DOT

0 commit comments

Comments
 (0)