Pass theta_prev to keep the solver on a consistent branch across calls. A reasonable initial value is (0.0, 0.0) at startup. If the URDF tree is reversed, the rotation composition in ...