Chapter 2: optimization and constrained inverse kinematics

Extract the complete zip into a folder, then open README.html. Keep the folder together. The reading retains all three appendices. A PDF copied out of this folder does not carry its companion files.

Some PDF viewers block local links or drop query parameters. Use the matching links below in README.html when that happens. The browser readings include their mathematical renderer and fonts, so they do not need an internet connection.

Start the browser apps

From this extracted folder run:

python3 launch.py

On Windows use py launch.py. Open the address printed by the command if a browser does not open. This serves only this extracted folder on your computer. It needs Python 3 and no Python packages. Keep the terminal open while using the apps. Stop it with Ctrl+C. Use --port 8766 if port 8765 is already in use.

The two-link and constraint apps also open directly as local HTML files. The optimization explorer uses JavaScript modules and needs the local server. It is already built; students do not need Node.js or npm. The server is also a convenient way to open all the readings and preserve their app query strings.

Reading Companion
Essentials detailed reference
Essentials detailed reference
Essentials environment guide
Essentials local_step.py
Essentials jacobian_transpose.py
Essentials two-link IK calculation
Essentials history-direction calculation
Essentials line-search figure script
Essentials constrained_ik.py
Essentials solver checks
Essentials first program
Essentials figure script
Essentials second
Essentials third
Essentials demonstration guide
Essentials position-update view
Essentials gradient-descent view
Essentials step-size view
Essentials Armijo view
Essentials Newton view
Essentials lecture-arm view
Essentials reach-boundary view
Essentials elbow-clipping view
Essentials L-BFGS view
Essentials BFGS view
Essentials line-search view
Essentials disc view
Essentials line view
Essentials detailed reference’s demonstration appendix
Essentials 1966 paper
Detailed reference Chapter 01 §5.2
Detailed reference bowl_derivatives.py
Detailed reference descent.py
Detailed reference make_vocabulary_figures.py
Detailed reference gradient_descent.py
Detailed reference armijo.py
Detailed reference opening prediction figure
Detailed reference Drake guide
Detailed reference constrained_ik_panda.py
Detailed reference two-link Gauss–Newton module
Detailed reference paused Panda replay
Detailed reference existing replay plots
Detailed reference Panda constrained-IK demonstration
Detailed reference one-limit Panda replay
Detailed reference hard-target Panda replay
Detailed reference kinematics essentials
Detailed reference the corresponding detailed derivations
Detailed reference the corresponding detailed derivations

Python for the numerical examples

The commands in Appendix B run from this folder. The supplied lectures/ and drake/ paths are part of the package. Create its environment on macOS/Linux:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

On Windows use py -m venv .venv, then .venv\Scripts\activate. After activation, use python in place of .venv/bin/python in the appendix’s Bash examples. Set PYTHONUTF8=1 if a Windows terminal cannot print a mathematical character. The small numerical scripts need NumPy; figure generators also need Matplotlib. No robotics package is needed for the two-link calculations.

Each Bash block in the detailed reference is a separate example. Run each from this folder; a block that changes directories does not change the starting directory of the next example. Script outputs may use lecture or source-file names to identify the shared calculations.

Panda demonstrations with Drake

The Panda scripts are optional. Their static observations remain in the reading. They need a Python environment in which Drake can be installed. The course’s tested environment uses Python 3.12 and Drake 1.46.0. To match it:

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-drake.txt

If you already created .venv, install the Drake requirements in that environment only if its Python supports the pinned Drake release. The package does not include Python, Drake or the Panda model. Drake’s first model load may need an internet connection and a model download. Browser readings and the bundled browser apps work without those downloads.

Use the commands in Appendix B.5 for print modes. For the paused web replays, activate the environment and run one command from the demonstration guide. Open the replay address printed in that terminal. Those scripts provide their own Meshcat viewer and controls; the course checkout and its classroom launcher are not needed. Run one replay at a time, and stop it with Ctrl+C before starting another.

The code keeps the source solvers and numerical parameters. The rail replay’s reference helper and saved reference events are included under support/. Its provenance/reference paths are adapted during packaging; its numerical functions are unchanged. The package includes the neighboring helper modules, HTML panels and regression baselines required by the linked scripts. Comments and usage lines in some scripts name files of the course repository, such as its planning records, that are not in this folder; the scripts do not need them.

What the detailed reference adds

The detailed browser reading retains its full derivations and appendices. Its course-launcher links lead to the portable demonstration guide. The two Chapter 1 references lead to included extracts of those sections. References to the two lecture-note discussions lead to the corresponding derivations in this detailed reading. These delivery adaptations preserve the mathematical content while keeping the package independent of the course checkout.

The examples solve local numerical problems. Feasible waypoints do not certify safe motion between them. No physical robot execution or realistic contact simulation is included in this package.

License

See LICENSE.md for the course-material license and licenses/ for the notices of bundled third-party browser dependencies. Drake and its downloaded robot models keep their own licenses and are not redistributed here.