Learning outcomes
- Implement a weighted stochastic-shooting controller.
- Explain sample count, temperature, and exploration scale.
- Separate an MPPI-inspired baseline from formal path-integral assumptions.
Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.
Optimizing with rollouts
A derivative-free predictive controller can evaluate many candidate input sequences by simulation. Start with a nominal sequence
A common weighted update uses
What the baseline does and does not claim
Our runnable exercise is an MPPI-inspired weighted stochastic-shooting baseline. Formal MPPI derivations impose a relationship between stochastic dynamics, control cost, and sampling distributions, and can require importance-sampling correction terms. We do not present the simplified update as that complete derivation.
When bounds clip a candidate, compute the update from the actual candidate minus nominal sequence. Otherwise the weighted perturbation can point toward an input that was never evaluated. Shift the sequence after applying its first command and warm-start with a reasonable terminal command.
Worked two-candidate update
Suppose
Effective sample size,
Constraint handling and computation
Clipping controls enforces input bounds. A large cost for penetrating an obstacle only discourages penetration; it does not establish hard feasibility. Sampling may miss narrow feasible regions, especially with long horizons and independent noise at every time step. Correlated noise, a good nominal trajectory, or a reduced control basis can improve search.
Batching compatible rollouts with MJX is an optional acceleration route MuJoCo MJX. Keep the same sample count and seeds when comparing backends. GPU throughput and single-rollout latency answer different questions.
Practice and exercise
Practice 4 compares constrained MPC, clipped LQR, and weighted shooting on the same vertical-flight task. Record seed sensitivity as well as tracking and violations. Increase sample count while holding the control period fixed and measure deadline overruns.
Check: If every candidate has nearly identical cost, what is the update? Approximately the average perturbation, often near zero for symmetric noise. This can mean a flat local objective, too little exploration, or a cost bug. Inspect trajectories before merely lowering the temperature.