|
312 | 312 | " clsys = ct.StateSpace(A - B @ K, B, lateral_normalized.C, 0)\n", |
313 | 313 | " \n", |
314 | 314 | " # Compute the feedforward gain based on the zero frequency gain of the closed loop\n", |
315 | | - " kf = np.real(1/clsys.evalfr(0))\n", |
| 315 | + " kf = np.real(1/clsys(0))\n", |
316 | 316 | "\n", |
317 | 317 | " # Scale the input by the feedforward gain\n", |
318 | 318 | " clsys *= kf\n", |
|
488 | 488 | "tau = v0 * T_curvy / b\n", |
489 | 489 | "\n", |
490 | 490 | "# Simulate the estimator, with a small initial error in y position\n", |
491 | | - "t, y_est, x_est = ct.forced_response(est, tau, [delta_curvy, y_ref], [0.5, 0])\n", |
| 491 | + "t, y_est, x_est = ct.forced_response(est, tau, [delta_curvy, y_ref], [0.5, 0], return_x=True)\n", |
492 | 492 | "\n", |
493 | 493 | "# Configure matplotlib plots to be a bit bigger and optimize layout\n", |
494 | 494 | "plt.figure(figsize=[9, 4.5])\n", |
|
596 | 596 | " np.zeros((2,1)))\n", |
597 | 597 | "\n", |
598 | 598 | "# Simulate the system\n", |
599 | | - "t, y, x = ct.forced_response(clsys, tau, y_ref, [0.4, 0, 0.0, 0])\n", |
| 599 | + "t, y, x = ct.forced_response(clsys, tau, y_ref, [0.4, 0, 0.0, 0], return_x=True)\n", |
600 | 600 | "\n", |
601 | 601 | "# Calcaluate the input used to generate the control response\n", |
602 | 602 | "u_sfb = kf * y_ref - K @ x[0:2]\n", |
|
1081 | 1081 | "zc = 0.707\n", |
1082 | 1082 | "eigs = np.roots([1, 2*zc*wc, wc**2])\n", |
1083 | 1083 | "K = ct.place(A, B, eigs)\n", |
1084 | | - "kr = np.real(1/clsys.evalfr(0))\n", |
| 1084 | + "kr = np.real(1/clsys(0))\n", |
1085 | 1085 | "print(\"K = \", np.squeeze(K))\n", |
1086 | 1086 | "\n", |
1087 | 1087 | "# Compute the estimator gain using eigenvalue placement\n", |
|
1126 | 1126 | "zc = 2.6\n", |
1127 | 1127 | "eigs = np.roots([1, 2*zc*wc, wc**2])\n", |
1128 | 1128 | "K = ct.place(A, B, eigs)\n", |
1129 | | - "kr = np.real(1/clsys.evalfr(0))\n", |
| 1129 | + "kr = np.real(1/clsys(0))\n", |
1130 | 1130 | "print(\"K = \", np.squeeze(K))\n", |
1131 | 1131 | "\n", |
1132 | 1132 | "# Construct an output-based controller for the system\n", |
|
0 commit comments