Skip to content

Commit

Permalink
display wind speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Fechner committed Nov 9, 2024
1 parent d0946e4 commit b758ed2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/KiteViewers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export clear_viewer, update_system, save_png, stop, pause, set_status # functio
@reexport using GLMakie: on

const KITE_SPRINGS = 8
const POS_Y = 785
const POS_X = 625

function __init__()
if isdir(joinpath(pwd(), "data")) && isfile(joinpath(pwd(), "data", "system.yaml"))
Expand Down
12 changes: 9 additions & 3 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ function init_system(kv::AbstractKiteViewer, scene; show_kite=true)
font=kv.set.fixed_font
end
text!(scene, textnode, position = Point2f(50, 110), fontsize=TEXT_SIZE, font=font, align = (:left, :top), space=:pixel)
text!(scene, textnode2, position = Point2f(630, 735), fontsize=TEXT_SIZE, font=font, align = (:left, :bottom), space=:pixel)
text!(scene, textnode2, position = Point2f(POS_X, POS_Y), fontsize=TEXT_SIZE, font=font, align = (:left, :top), space=:pixel)
end

# update the kite power system, consisting of the tether, the kite and the state (text and numbers)
function update_system(kv::AKV, state::SysState; scale=1.0, kite_scale=1.0, ned=true)
function update_system(kv::AKV, state::SysState; scale=1.0, kite_scale=1.0, ned=true, wind=[:v_wind_200m])
azimuth = state.azimuth
if azimuth 0 # suppress -0 and replace it with 0
azimuth=zero(azimuth)
Expand Down Expand Up @@ -242,8 +242,14 @@ function update_system(kv::AKV, state::SysState; scale=1.0, kite_scale=1.0, ned=
"v_reelout: $(@sprintf("%7.2f", state.v_reelout)) m/s " * "p_mech: $(@sprintf("%8.2f", power)) W\n" *
"force: $(@sprintf("%7.2f", state.force )) N " * "energy: $(@sprintf("%8.2f", kv.energy)) Wh\n"
textnode[] = msg
wind_msg = ""
if :v_wind_gnd in wind
wind_msg = "\nwind_gnd: $(@sprintf("%4.1f", norm(state.v_wind_gnd))) m/s"
elseif :v_wind_200m in wind
wind_msg = "\nwind@200m: $(@sprintf("%4.1f", norm(state.v_wind_200m))) m/s"
end
textnode2[] = "depower: $(@sprintf("%6.2f", state.depower*100)) %\n" *
"steering: $(@sprintf("%6.2f", state.steering*100)) %"
"steering: $(@sprintf("%6.2f", state.steering*100)) %" * wind_msg
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/viewer3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi
text!(scene2D, status, position = Point2f( 20, 0), fontsize = TEXT_SIZE, align = (:left, :bottom), space=:pixel)
text!(scene2D, plot_file, position = Point2f( 420, 0), fontsize = TEXT_SIZE, align = (:left, :bottom), space=:pixel)

textnode2[]="depower\nsteering:"
textnode2[]="depower:\nsteering:\n"

fig[2, 1] = buttongrid = GridLayout(tellwidth=false)
l_sublayout = GridLayout()
Expand Down Expand Up @@ -301,7 +301,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi
on(fig.scene.events.window_area) do x
dx = x.widths[1] - WIDTH
dy = x.widths[2] - HEIGHT
txt2.position[] = Point2f(630.0+dx, 735.0+dy)
txt2.position[] = Point2f(POS_X+dx, POS_Y+dy)
end
status[] = "Stopped"
s
Expand Down

0 comments on commit b758ed2

Please sign in to comment.