Drone (flown path) Reference path Sampled rollout cloud Obstacle safety zone

MPC Drone Trajectory Planner — 2D Sample-Cloud MPPI

This 2D companion to the 3D MPC drone planner keeps the exact same control algorithm — sampling-based Model Predictive Path Integral control (MPPI) driving a double-integrator drone around an obstacle toward a moving reference — but computes and renders it as a genuinely planar object instead of a 3D camera scene. Rather than showing only the final blended flight horizon, this version draws the entire population of sampled rollouts each replan, faded by its own softmax importance weight, alongside a live weight histogram and an effective-sample-size readout that exposes exactly how concentrated or diffuse the MPPI sampling distribution is at any instant. Tune the prediction horizon, sample count and obstacle-avoidance weight to watch the sample cloud collapse around the handful of rollouts that best thread the obstacle.