control.blending

Smooth element swaps: one set of virtual elements replaces another with a quintic blend.

The old torque fades out while the new one fades in over duration [s],

u = (1 - w) u_old + w u_new, w = 10 s^3 - 15 s^4 + 6 s^5, s = t / duration,

so the torque and its first two time derivatives stay continuous. A planner uses the same blend_weight, so it plans what the controller executes.

Functions

blend_weight(t, duration)

w(t) in [0, 1]: 0 at t <= 0, 1 at t >= duration (and at once for a zero duration).

Classes

SwapController(controller)

A controller whose virtual elements can be swapped for another controller's, smoothly.