Fundamentals / Mechanical engineering / Control engineering / Notebooks

Learn a repeatable positioning move from its previous error

An inspection stage follows the same position command on hundreds of nominally identical passes. A small force disturbance returns at the same part of each move. The complete tracking record from the previous pass is available before the next move begins. Derive a learning update that uses the stage dynamics to turn that record into a new feedforward command. Its convergence can be predicted from singular values and tested with a few lines of code.

Interactive calculation · Learning motion

Change the physical and numerical inputs of the notebook model. Compare the updated curves and balance checks with the recorded notebook figures. Each plot uses the same equations and assumptions documented in that notebook; its readout names any analytical or reduced-model reference.

Download this example’s editable notebook

Interactive calculation · Learning errors

Change the physical and numerical inputs of the notebook model. Compare the updated curves and balance checks with the recorded notebook figures. Each plot uses the same equations and assumptions documented in that notebook; its readout names any analytical or reduced-model reference.

Download this example’s editable notebook

Save notebook (.ipynb)

Python runs on this device. The first run loads the scientific libraries.

The optional OneSimulation calculation uses the local OneSimulation installation. Save this notebook to run that comparison in Jupyter.

A stage repeats the same trajectory many times. Predict what happens if the learning update becomes too aggressive. The horizontal coordinate within each motion is distinct from the trial number. Edit the first cell and rerun.

Lift the causal recurrence onto one trial

Model the stage by \(y_{k+1}=a y_k+(1-a)u_k\) with zero initial state. Record \(y_1\) to \(y_N\) for inputs \(u_0\) to \(u_{N-1}\). A deterministic output disturbance returns in the same phase of every trial.

Apply the adjoint of the forward operator

Corrections use the entire previous record. Compare against the theoretically slowest contraction factor; the reference starts at the measured first error. For an intentionally excessive step study only this linear model.

Compare a trajectory to a convergence diagnostic

The dashed bound permits mixtures of error directions and can lie above the actual error. Print the singular values to estimate which components of a tracking error are learned slowly.

Change one assumption

Set the relative step to 1.05 and increase the trial count. A particular reference can show several improving trials even though the worst singular direction grows. Replace the repeatable disturbance by a different vector on each trial, remove the deterministic contraction assertion, and calculate errors against a separate clean trajectory. Explain why the original bound no longer follows.

Identify the worst-case error from an independent eigenproblem

The eigenvalues of the symmetric error-propagation matrix are the gains on independent error directions. OneSimulation can solve that eigenproblem locally. In the browser use the corresponding NumPy solver and cross-check against the earlier singular-value prediction.