Skip to content

Commit 178cb9c

Browse files
committed
rename some vars
1 parent 3571b77 commit 178cb9c

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/lqg_control_flat_planar.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include("planar_flat.jl") # Get FlatDyadBot
2-
32
using DyadControlSystems
43
import DyadControlSystems as JSC
54
using LinearAlgebra
@@ -56,11 +55,12 @@ end
5655
# - 2 controlled outputs: same as measurements (regulate both)
5756
# - 1 control input: torque (tau)
5857
lqg_spec = JSC.LQGAnalysisSpec(;
59-
name = :SegwayLQG,
58+
name = :DyadBotLQG,
6059
model = plant,
6160
measurement = ["y_x", "y_theta"], # What we measure
6261
controlled_output = ["y_x", "y_xd", "y_theta", "y_thetad"], # What we want to control
6362
control_input = ["u"], # Control input
63+
loop_openings = ["u"],
6464
q1_diag = [10.0, 0.1, 1, 0.1], # Penalty on controlled outputs (x, theta)
6565
q2_diag = [0.0001], # Penalty on control input (tau)
6666
r1_diag = [1.0], # Disturbance noise covariance
@@ -139,22 +139,24 @@ plot(sol, idxs=[
139139

140140
##
141141

142-
# LT = lqg_asol.Cfb*system_mapping(lqg_asol.P_ext)
142+
Lo = system_mapping(lqg_asol.P_ext)*lqg_asol.Cfb
143+
Li = lqg_asol.Cfb*system_mapping(lqg_asol.P_ext)
143144

144145
# ##
145-
# L2 = get_named_looptransfer(lqg_cl, [lqg_cl.u])
146-
# L2 = -minreal(L2, 1e-8)
146+
L2 = get_named_looptransfer(lqg_cl, [lqg_cl.u])
147+
L2 = -minreal(L2, 1e-8)
148+
149+
S2 = get_named_sensitivity(lqg_cl, [lqg_cl.u])
147150

148-
# S2 = get_named_sensitivity(lqg_cl, [lqg_cl.u])
149151

150152

151-
# dmi = diskmargin(LT, offset=0)
152-
# dmi2 = diskmargin(L2, offset=0) # offset due to hard to cancel pole/zero pair in origin
153+
dmi = diskmargin(Li, offset=0)
154+
dmi2 = diskmargin(L2, offset=0) # offset due to hard to cancel pole/zero pair in origin
153155

154-
# plot(dmi)
155-
# plot!(dmi2)
156+
plot(dmi)
157+
plot!(dmi2)
156158

157-
# bodeplot([LT, L2], adjust_phase_start=false) # why not identical?
159+
bodeplot([Li, L2], adjust_phase_start=false) # Verify equal
158160

159161
# ##
160162
# P_ext = system_mapping(lqg_asol.P_ext)

0 commit comments

Comments
 (0)