Suicide-burn height. With thrust T, mass m and gravity g the net braking deceleration is a = T/m - g. Stopping from speed v takes distance v^2 / (2a), so the latest safe ignition height is
h_burn = v^2 / (2 (T/m - g))
Igniting higher wastes propellant and, with a 40 % minimum throttle, the engine can stop the vehicle in the air and then push it back up. Igniting lower cannot stop it at all.
No hover. With dry mass 25 t, T_max = 850 kN and 40 % minimum, the lowest thrust is 340 kN, a thrust-to-weight ratio of about 1.4 even when nearly empty. So the last seconds are a controlled fall onto the deck rather than a hover.
Mass loss. Propellant flow is mdot = T / (Isp g0). The velocity change from burning m0 to m1 follows Tsiolkovsky:
dv = Isp g0 ln(m0 / m1)
Drag and wind. Axial drag 1/2 rho v_rel^2 CdA with exponential density rho = 1.225 exp(-h/8500 m), plus a normal force from angle of attack 2 q A_ref sin(a)cos(a). Wind follows a power-law profile with gusts. Grid fins and gimbal act as torques on a rigid body; steering tilts the thrust or the aerodynamic normal force.
Moving deck. The platform heaves (sum of two sines, amplitude 0 to 2.4 m by sea state) and rolls up to about 3 degrees. What matters is velocity relative to the deck at the instant the first foot touches: v_rel = v_booster - v_deck. The peak deck speed is A w, close to 1.8 m/s in sea state 5, nearly the whole 2 m/s allowance.
Leg crush. Absorbing the vertical energy over a stroke s at constant crush deceleration a_c gives s = v^2 / (2 a_c). With a_c = 2.5 g and a 0.9 m stroke the structural limit is about 6.6 m/s, so 2 m/s is the operating limit and anything above is a hard landing.
Tip-over. After touchdown the vehicle can rotate about the downhill edge of its four-foot footprint (half-width R = 9 m x cos 45 degrees = 6.4 m). With centre of mass height h and moment of inertia I_p about the pivot, the restoring torque is m g (R cos phi - h sin phi); it vanishes at phi = atan(R/h), about 22 degrees. The code integrates this inverted pendulum from the sideways speed at touchdown (angular speed m v_lat h / I_p) and reports tip-over if it passes that angle.
Simplifications. Single rigid body with small-angle attitude dynamics, no yaw or roll about the axis, no fuel slosh, constant specific impulse, point-like contact, legs treated as perfect crush absorbers, deck motion prescribed (not coupled to the booster), illustrative masses and thrust rather than any real vehicle's data. Guidance is a simple constant-deceleration law, not a flight algorithm.
Independent educational model, not affiliated with or endorsed by any company named here; trademarks belong to their owners. Numbers are textbook-level/publicly reported approximations; the vehicle is a generic stylised booster. Inspired by publicly described propulsive recovery of reusable launch vehicles (SpaceX).