The maths behind the collapsing-canyon drone, one formula per failure: returns to go, why a reward that is negative everywhere makes crashing the best move, potential-based shaping and the geodesic distance it should be measured on, the lidar fan and the stacked scans that turn it into motion, running observation normalisation, then the TD error, GAE, explained variance, the PPO clipped objective and the policy entropy that keeps it exploring.