Skip to content

Commit 7915c91

Browse files
committed
address @slivingston review comments
1 parent fd3a5e7 commit 7915c91

15 files changed

+35
-36
lines changed

control/freqplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def bode_plot(
184184
config.defaults['freqplot.number_of_samples']. Ignored if data is
185185
not a list of systems.
186186
phase_label : str, optional
187-
Label to use for magnitude axis. Defaults to "Phase [rad]".
187+
Label to use for phase axis. Defaults to "Phase [rad]".
188188
plot : bool, optional
189189
(legacy) If given, `bode_plot` returns the legacy return values
190190
of magnitude, phase, and frequency. If False, just return the

control/phaseplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def vectorfield(
309309
sys._update_params(params)
310310
for i, x in enumerate(points):
311311
vfdata[i, :2] = x
312-
vfdata[i, 2:] = sys._rhs(0, x, 0)
312+
vfdata[i, 2:] = sys._rhs(0, x, np.zeros(sys.ninputs))
313313

314314
with plt.rc_context(rcParams):
315315
out = ax.quiver(

doc/examples.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ online sources.
6666
Google Colab Notebooks
6767
======================
6868

69-
A collection of Jupyter notebooks are available on [Google Colab](),
70-
where they can be executed through a web browser:
69+
A collection of Jupyter notebooks are available on `Google Colab
70+
<https://colab.research.google.com>`_, where they can be executed
71+
through a web browser:
7172

7273
* `Caltech CDS 110 Google Colab notebooks
7374
<https://drive.google.com/drive/folders/1LI2xWVn1kqrZ5lIcM5Ktxr2B7X730cCj?usp=share_link>`_:

examples/cds110-L3_lti-systems.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"\n",
1515
"[Open in Google Colab](https://colab.research.google.com/drive/164yYvB86c2EvEcIHpUPNXCroiN9nnTAa)\n",
1616
"\n",
17-
"In this lecture we describe tools in the Python Control Systems Toolbox ([python-control](https://python-control.org]) that can be used to analyze linear systems, including some of the options available to present the information in different ways.\n"
17+
"In this lecture we describe tools in the Python Control Systems Toolbox ([python-control](https://python-control.org)) that can be used to analyze linear systems, including some of the options available to present the information in different ways.\n"
1818
]
1919
},
2020
{
@@ -106,7 +106,7 @@
106106
"id": "kobxJ1yG4v_1"
107107
},
108108
"source": [
109-
"Another way to get these same dynamics is to define and input/output system:"
109+
"Another way to get these same dynamics is to define an input/output system:"
110110
]
111111
},
112112
{
@@ -141,7 +141,7 @@
141141
"source": [
142142
"### Initial response\n",
143143
"\n",
144-
"The `initial_response` function can be used to compute the response of the system with no input, but starting from a given initial condition. This function returns a response object, we can be used for plotting."
144+
"The `initial_response` function can be used to compute the response of the system with no input, but starting from a given initial condition. This function returns a response object, which can be used for plotting."
145145
]
146146
},
147147
{

examples/cds110-L4a_predprey-statefbk.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"def predprey_update(t, x, u, params):\n",
6464
" \"\"\"Predator prey dynamics\"\"\"\n",
6565
" r, d, b, k, a, c = map(params.get, ['r', 'd', 'b', 'k', 'a', 'c'])\n",
66-
" u = np.atleast_1d(u) # Fix python-control bug\n",
6766
" u = np.clip(u, -r, r)\n",
6867
"\n",
6968
" # Dynamics for the system\n",
@@ -318,7 +317,7 @@
318317
"cell_type": "markdown",
319318
"metadata": {},
320319
"source": [
321-
"We see that the controller no longer stabilizes the equilibrium point (shown with the dashed lines). In particular, the steady state value of the Lynx population does to almost twice the original value.\n",
320+
"We see that the controller no longer stabilizes the equilibrium point (shown with the dashed lines). In particular, the steady state value of the lynx population does to almost twice the original value.\n",
322321
"\n",
323322
"This effect is even worse if we increase $r$ just a bit more (from 1.65 to 1.7)."
324323
]
@@ -375,7 +374,7 @@
375374
"# Simulate with a change in food for the hares\n",
376375
"T = np.linspace(0, 100, 500)\n",
377376
"response = ct.input_output_response(\n",
378-
" predprey_pi, T, xe[1], [25, 25], params={'r': 1.65})\n",
377+
" predprey_pi, T, xe[1], [25, 25, 0], params={'r': 1.65})\n",
379378
"ct.time_response_plot(\n",
380379
" response, plot_inputs=False, overlay_signals=True,\n",
381380
" title=\"I/O response w/ integral action, \" +\n",

examples/cds110-L4b_lqr-tracking.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"\\end{bmatrix}\n",
5656
"u,\n",
5757
"\\qquad\n",
58-
"y = \\begin{bmatrix} 1 \\\\ 1 \\end{bmatrix} x.\n",
58+
"y = \\begin{bmatrix} 1 & 1 \\end{bmatrix} x.\n",
5959
"$$\n",
6060
"\n",
6161
"<!-- This system corresponds to the linearized lateral dynamics of a vehicle driving down a road at 10 m/s. -->"
@@ -220,7 +220,7 @@
220220
"d\n",
221221
"\\end{bmatrix},\n",
222222
"\\qquad\n",
223-
"y = \\begin{bmatrix} 1 \\\\ 1 \\end{bmatrix} x.\n",
223+
"y = \\begin{bmatrix} 1 & 1 \\end{bmatrix} x.\n",
224224
"$$\n",
225225
"\n",
226226
"Our closed loop system becomes:\n",
@@ -240,7 +240,7 @@
240240
"d\n",
241241
"\\end{bmatrix},\n",
242242
"\\qquad\n",
243-
"y = \\begin{bmatrix} 1 \\\\ 1 \\end{bmatrix} x.\n",
243+
"y = \\begin{bmatrix} 1 & 1 \\end{bmatrix} x.\n",
244244
"$$"
245245
]
246246
},
@@ -525,7 +525,7 @@
525525
"id": "f8bfc15c"
526526
},
527527
"source": [
528-
"# Part 2: PVTOL Linear Quadratic Regulator Example\n",
528+
"# Part II: PVTOL Linear Quadratic Regulator Example\n",
529529
"\n",
530530
"Natalie Bernat, 26 Apr 2024 <br>\n",
531531
"Richard M. Murray, 25 Jan 2022\n",
@@ -754,7 +754,7 @@
754754
"u = u_\\text{d} - K (x - x_\\text{d})\n",
755755
"$$\n",
756756
"\n",
757-
"Note that this is slight different than the first equation: here we are using $x_\\text{d}$ instead of $x_\\text{e}$ and $u_\\text{d}$ instead of $u_\\text{e}$. This is because we want our controller to track a desired trajectory $(x_\\text{d}(t), u_\\text{d}(t))$ rather than just stabilize the equilibrium point $(x_\\text{e}, u_\\text{e})$."
757+
"Note that this is slightly different than the first equation: here we are using $x_\\text{d}$ instead of $x_\\text{e}$ and $u_\\text{d}$ instead of $u_\\text{e}$. This is because we want our controller to track a desired trajectory $(x_\\text{d}(t), u_\\text{d}(t))$ rather than just stabilize the equilibrium point $(x_\\text{e}, u_\\text{e})$."
758758
]
759759
},
760760
{
@@ -772,7 +772,7 @@
772772
"cell_type": "markdown",
773773
"metadata": {},
774774
"source": [
775-
"This command will usually generating a warning saying that python control \"cannot verify system output is system state\". This happens because we specified an output function `pvtol_output` when we created the system model, and python-control does not have a way of checking that the output function runs the entire state (which is needed if we are going to do full-state feedback).\n",
775+
"This command will usually generate a warning saying that python control \"cannot verify system output is system state\". This happens because we specified an output function `pvtol_output` when we created the system model, and python-control does not have a way of checking that the output function returns the entire state (which is needed if we are going to do full-state feedback).\n",
776776
"\n",
777777
"This warning could be avoided by passing the argument `None` for the system output function, in which case python-control returns the full state as the output (and it knows that the full state is being returned as the output)."
778778
]
@@ -844,7 +844,7 @@
844844
"cell_type": "markdown",
845845
"metadata": {},
846846
"source": [
847-
"Next we generate a step response and plot the results. Because our closed loop system takes as inputs $x_\\text{d}$ and $u_\\text{d}$, we need to set those variable to values that would corresponding to our step input. In this case, we are taking a step in the $x$ coordinate, so we set $x_\\text{d}$ to be $1$ in that coordinate starting at $t = 0$ and continuing for some sufficiently long period of time ($15$ seconds):"
847+
"Next we generate a step response and plot the results. Because our closed loop system takes as inputs $x_\\text{d}$ and $u_\\text{d}$, we need to set those variable to values that would correspond to our step input. In this case, we are taking a step in the $x$ coordinate, so we set $x_\\text{d}$ to be $1$ in that coordinate starting at $t = 0$ and continuing for some sufficiently long period of time ($15$ seconds):"
848848
]
849849
},
850850
{

examples/cds110-L5_kincar-estimation.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"\n",
1515
"[Open in Google Colab](https://colab.research.google.com/drive/1TESB0NzWS3XBxJa_hdOXMifICbBEDRz8)\n",
1616
"\n",
17-
"In this lecture, we will show how to construct an observer for a system in the presence of noise and distrubances.\n",
17+
"In this lecture, we will show how to construct an observer for a system in the presence of noise and disturbances.\n",
1818
"\n",
1919
"Recall that an observer is a system that takes as input the (noisy) measured output of a system along with the applied input to the system, and produces as estimate $\\hat x$ of the current state:\n",
2020
"\n",
@@ -433,7 +433,7 @@
433433
"cell_type": "markdown",
434434
"metadata": {},
435435
"source": [
436-
"A Kalman filter allows us to estimate the optimal state give measurements of the inputs and outputs, as well as knowldge of the covariance of the signals."
436+
"A Kalman filter allows us to estimate the optimal state given measurements of the inputs and outputs, as well as knowledge of the covariance of the signals."
437437
]
438438
},
439439
{
@@ -658,8 +658,7 @@
658658
"metadata": {},
659659
"outputs": [],
660660
"source": [
661-
"print(\"ct.interconnect(syslist, connections=None, inplist=None, outlist=None, params=None, check_unused=True, add_unused=False, ignore_inputs=None, ignore_outputs=None, warn_duplicate=None, debug=False, **kwargs)\\n\\t\")\n",
662-
"print(ct.interconnect.__doc__)"
661+
"?ct.interconnect"
663662
]
664663
},
665664
{

examples/cds110-L7_bode-nyquist.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,13 @@
538538
"source": [
539539
"### Stability margins\n",
540540
"\n",
541-
"Another standard set of analysis tools is to identify the gain, phase, and stability margins for the sytem:\n",
541+
"Another standard set of analysis tools is to identify the gain, phase, and stability margins for the system:\n",
542542
"\n",
543543
"* **Gain margin:** the maximimum amount of additional gain that we can put into the loop and still maintain stability.\n",
544544
"* **Phase margin:** the maximum amount of additional phase (lag) that we can put into the loop and still maintain stability.\n",
545545
"* **Stability margin:** the maximum amount of combined gain and phase at the critical frequency that can be put into the loop and still maintain stability.\n",
546546
"\n",
547-
"The first two of the items can be computed either by looking at the frequeny response or by using the `margin` command.\n",
547+
"The first two of the items can be computed either by looking at the frequency response or by using the `margin` command.\n",
548548
"\n",
549549
"The stabilty margin is the minimum distance between -1 and $L(jw)$, which is just the minimum value of $|1 - L(j\\omega)|$.\n",
550550
"\n"

examples/cds110-L8b_pvtol-complete-limits.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
"metadata": {},
308308
"outputs": [],
309309
"source": [
310-
"# Find the equiblirum point corresponding to the origin\n",
310+
"# Find the equilibrium point corresponding to the origin\n",
311311
"xe, ue = ct.find_eqpt(\n",
312312
" sys = pvtol_noisy,\n",
313313
" x0 = np.zeros(pvtol_noisy.nstates),\n",
@@ -504,7 +504,7 @@
504504
" iy=[0, 1]\n",
505505
")\n",
506506
"\n",
507-
"# Define the time horizon for the maneuver\n",
507+
"# Define the time horizon for the manuever\n",
508508
"Tf = 5\n",
509509
"timepts = np.linspace(0, Tf, 100, endpoint=False)\n",
510510
"\n",
@@ -525,7 +525,7 @@
525525
"metadata": {},
526526
"outputs": [],
527527
"source": [
528-
"# Re-define the time horizon for the maneuver\n",
528+
"# Re-define the time horizon for the manuever\n",
529529
"Tf = 5\n",
530530
"timepts = np.linspace(0, Tf, 20, endpoint=False)\n",
531531
"\n",
@@ -681,7 +681,7 @@
681681
"id": "89221230"
682682
},
683683
"source": [
684-
"We see that with the addition of disturbances and noise, we sometimes violate the constraint 'nicolas' (if you plot doesn't show an intersection with the bottom dashed curve, try regenerating the noise and running the simulation again). This can be fixed by establishing a more conservative constraint (see commented out constraint in code block above)."
684+
"We see that with the addition of disturbances and noise, we sometimes violate the constraint 'nicolas' (if your plot doesn't show an intersection with the bottom dashed curve, try regenerating the noise and running the simulation again). This can be fixed by establishing a more conservative constraint (see commented out constraint in code block above)."
685685
]
686686
},
687687
{

examples/cds112-L1_python-control.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"* [Python tutorial](https://docs.python.org/3/tutorial/)\n",
6565
"* [NumPy tutorial](https://numpy.org/doc/stable/user/quickstart.html)\n",
6666
"* [NumPy for MATLAB users](https://numpy.org/doc/stable/user/numpy-for-matlab-users.html), \n",
67-
"* [Python Control Systems Library (python-control) documentation](https://python-control.readthedocs.io/en/0.9.3.post2/)"
67+
"* [Python Control Systems Library (python-control) documentation](https://python-control.readthedocs.io/en/latest/)"
6868
]
6969
},
7070
{

examples/cds112-L2a_flatness.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"\n",
1010
"##### Richard M. Murray, 13 Nov 2021 (updated 7 Jul 2024)\n",
1111
"\n",
12-
"This notebook contains an example of using differential flatness as a mechanism for trajectory generation for a nonlinear control system. A differentially flat system is defined by creating an object using the `FlatSystem` class, which has member functions for mapping the system state and input into and out of flat coordinates. The `point_to_point()` function can be used to create a trajectory between two endpoints, written in terms of a set of basis functions defined using the `BasisFamil`y class. The resulting trajectory is return as a `SystemTrajectory` object and can be evaluated using the `eval()` member function. "
12+
"This notebook contains an example of using differential flatness as a mechanism for trajectory generation for a nonlinear control system. A differentially flat system is defined by creating an object using the `FlatSystem` class, which has member functions for mapping the system state and input into and out of flat coordinates. The `point_to_point()` function can be used to create a trajectory between two endpoints, written in terms of a set of basis functions defined using the `BasisFamily` class. The resulting trajectory is return as a `SystemTrajectory` object and can be evaluated using the `eval()` member function. "
1313
]
1414
},
1515
{
@@ -318,7 +318,7 @@
318318
"source": [
319319
"### A look inside the code\n",
320320
"\n",
321-
"The code to solve this problem is inside the file [flatsys.py](https://github.com/python-control/python-control/blob/master/control/flatsys/flatsys.py) in the python-control package. Here is what operative code inside the `point_to_point()` looks like:\n",
321+
"The code to solve this problem is inside the file [flatsys.py](https://github.com/python-control/python-control/blob/main/control/flatsys/flatsys.py) in the python-control package. Here is what operative code inside the `point_to_point()` looks like:\n",
322322
"\n",
323323
" #\n",
324324
" # Map the initial and final conditions to flat output conditions\n",

examples/kincar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@ def plot_lanechange(t, y, u, figure=None, yf=None):
109109
plt.xlabel("Time $t$ [sec]")
110110
plt.ylabel("$\\delta$ [rad]")
111111

112-
plt.suptitle("Lane change manuever")
112+
plt.suptitle("Lane change maneuver")
113113
plt.tight_layout()

examples/pvtol-lqr-nested.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"$$\n",
4949
"\n",
5050
"## LQR state feedback controller\n",
51-
"This section demonstrates the design of an LQR state feedback controller for the vectored thrust aircraft example. This example is pulled from Chapter 6 (Linear Systems, Example 6.4) and Chapter 7 (State Feedback, Example 7.9) of [Astrom and Murray](https://fbsbook.org). The python code listed here are contained the file pvtol-lqr.py.\n",
51+
"This section demonstrates the design of an LQR state feedback controller for the vectored thrust aircraft example. This example is pulled from Chapter 6 (Linear Systems, Example 6.4) and Chapter 7 (State Feedback, Example 7.9) of [Astrom and Murray](https://fbsbook.org). The python code listed here are contained the the file pvtol-lqr.py.\n",
5252
"\n",
5353
"To execute this example, we first import the libraries for SciPy, MATLAB plotting and the python-control package:"
5454
]

examples/steering-optimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ def plot_lanechange(t, y, u, yf=None, figure=None):
7979
plt.xlabel("t [sec]")
8080
plt.ylabel("steering [rad/s]")
8181

82-
plt.suptitle("Lane change manuever")
82+
plt.suptitle("Lane change maneuver")
8383
plt.tight_layout()
8484
plt.show(block=False)
8585

8686
#
8787
# Optimal control problem
8888
#
89-
# Perform a "lane change" manuever over the course of 10 seconds.
89+
# Perform a "lane change" maneuver over the course of 10 seconds.
9090
#
9191

9292
# Initial and final conditions

examples/vehicle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _vehicle_output(t, x, u, params):
8484
states=('x', 'y', 'theta'))
8585

8686
#
87-
# Utility function to plot lane change manuever
87+
# Utility function to plot lane change maneuver
8888
#
8989

9090
def plot_lanechange(t, y, u, figure=None, yf=None):
@@ -107,5 +107,5 @@ def plot_lanechange(t, y, u, figure=None, yf=None):
107107
plt.xlabel("t [sec]")
108108
plt.ylabel("steering [rad/s]")
109109

110-
plt.suptitle("Lane change manuever")
110+
plt.suptitle("Lane change maneuver")
111111
plt.tight_layout()

0 commit comments

Comments
 (0)