Skip to content

Commit 89e0c7d

Browse files
committed
turn off verbosity in tests
1 parent 246b27d commit 89e0c7d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/runtests.jl

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using QuanserInterface
22
using HardwareAbstractions
33
using ControlSystemsBase
44
using QuanserInterface: energy
5+
using Test
56

67

78
rr = Ref([0, pi, 0, 0])
@@ -44,7 +45,7 @@ function swingup(process; Tf = 10, verbose=true, stab=true, umax=5.0)
4445
end
4546
y = QuanserInterface.measure(process)
4647
if verbose && !simulation
47-
@info "Starting $(simulation ? "simulation" : "experiment") from y: $y, waiting for your input..."
48+
verbose && @info "Starting $(simulation ? "simulation" : "experiment") from y: $y, waiting for your input..."
4849
# readline()
4950
end
5051
yo = zeros(2)
@@ -68,17 +69,17 @@ function swingup(process; Tf = 10, verbose=true, stab=true, umax=5.0)
6869
r = rr[]
6970
if !(-deg2rad(110) <= y[1] <= deg2rad(110))
7071
u = [-0.5*y[1]]
71-
@warn "Correcting"
72+
verbose && @warn "Correcting"
7273
control(process, u)
7374
oob += 20
7475
if oob > 600
75-
@error "Out of bounds"
76+
verbose && @error "Out of bounds"
7677
break
7778
end
7879
else
7980
oob = max(0, oob-1)
8081
if stab && abs(normalize_angles(y[2]) - pi) < 0.50
81-
@info "stabilizing"
82+
verbose && @info "stabilizing"
8283
u = clamp.(L*(r - xhn), -10, 10)
8384
else
8485
# xhn = (process.x) # Try with correct state if in simulation
@@ -109,7 +110,7 @@ function swingup(process; Tf = 10, verbose=true, stab=true, umax=5.0)
109110
end
110111

111112
process = QuanserInterface.QubeServoPendulumSimulator(; Ts, p = QuanserInterface.pendulum_parameters(true))
112-
function runplot(process; kwargs...)
113+
function runplot(process; verbose = isinteractive(), kwargs...)
113114
rr[][1] = deg2rad(0)
114115
rr[][2] = pi
115116
y = QuanserInterface.measure(process)
@@ -118,7 +119,7 @@ function runplot(process; kwargs...)
118119
autohome!(process)
119120
end
120121
global D
121-
D = swingup(process; kwargs...)
122+
D = swingup(process; verbose, kwargs...)
122123
isinteractive() && plotD(D)
123124
end
124125

0 commit comments

Comments
 (0)