sky

minilink

Abstract

Write the equations once. Then compile, differentiate, and close the loop.

You write a custom dynamical system in ordinary Python — f reads like the textbook. Diagrams of those systems (ctl @ plant, sources) flatten to one f. That same graph is JIT-compiled and autodifferentiated under JAX: exact ∂f/∂x, ∂f/∂u, ∂f/∂p, gradients through a rollout, batches of plants or parameters.

That is what makes modern control, fast trajectory optimization, model predictive control, and learning practical on the model you actually wrote. Minilink is the successor of Pyro.

Custom systems, arbitrary diagrams

A model is three functions of the state x, the input u, the time t and the parameters p:

dx/dt = f(x, u, t; p)  ·  y = h(x, u, t; p)  ·  T = tf(x, u, t; p)

There is no hidden state on the object. That one convention is what lets a model compose into diagrams, run in batches and differentiate later. A diagram flattens to one state vector and one f, so a closed loop linearizes and nests like a plant.

A System is f, h, tf and ports; a diagram is a System

from minilink import ImpedanceController, Pendulum plant = Pendulum() plant.x0[0] = 2.0 plant.params["l"] = 5.0 diagram = ImpedanceController() @ plant diagram.compute_trajectory(tf=10.0)

Compile, autodiff, JAX

The same f traces under JAX. One evaluator gives exact derivatives, batched rollouts and gradients through a whole simulation:

ev = plant.compile(backend="jax") A = plant.jacobian("f", "x", x_bar) # exact linearization S = plant.jacobian("f", "params", x_bar) # sensitivity to each parameter xs = ev.rollout_batch(x0s, n_steps=1000, dt=0.005, params=dict(plant.params, l=lengths)) gains = gains - lr * jax.grad(loss)(gains) # tune through the simulation

Measured in the showcase notebook on an Apple M4 Max: 1000 rollouts of 1000 RK4 steps take 27 ms as a compiled batch and about 32 s one step at a time in Python. Derivatives are exact to machine precision.

What that unlocks on the plant you wrote:

  • modern control on a compiled diagram
  • fast trajectory optimization — exact defects, jitted residuals
  • MPC that re-solves the same program at the control rate
  • learning on the model — gain tuning, identification, neural controllers, RL

Project Media

Cart-pole swing-up by trajectory optimization
Swing-up by trajectory optimization
Car under model predictive control
Model predictive control, sampled at 5 Hz
UR5 arm in the meshcat 3D viewer
UR5, task-space impedance, meshcat 3D viewer
Pendulum under impedance control
ImpedanceController() @ Pendulum()

Project Details

Status
Active open-source library
Date
2025–present
Team
Prof. Alexandre Girard
License
MIT
Keywords
JAX, automatic differentiation, compiled simulation, diagrams, trajectory optimization, MPC, learning.